/* Foundation: shared tokens, reset, layout, and reusable components.
 * Keep the HTML stylesheet order: specificity and module order define the cascade.
 */

/* Shared design tokens */

:root {
  /* Palette */
  --color-portfolio-ink: #121f39;
  --color-portfolio-rule: #637be8;
  --color-classic-ink: #18263d;
  --color-white: #fff;
  --color-brand: #4c18df;
  --color-signal: #03b9fc;
  --color-opening-ground: #171c36;
  --color-opening-ink: #eef2ff;
  --color-opening-accent: #a7baff;
  --color-reading-ground: #edf0fc;
  --color-reading-ink: #272e52;
  --color-action: #294d8a;
  --color-action-hover: #1c3867;
  --color-ledger-ink: #202e48;
  --color-illustration: #8ba4f5;
  --color-progress-track: #ccd5eb;
  --color-brand-hover: #3610b3;

  /* Typography */
  --font-editorial-display: "Manrope",system-ui,sans-serif;
  --font-editorial-body: "IBM Plex Sans",system-ui,sans-serif;
  --title-font: 'Plus Jakarta Sans',Inter,system-ui,-apple-system,Arial,sans-serif;
  --body-font: Inter,system-ui,-apple-system,Arial,sans-serif;
  --font-size-caption: 11px;
  --font-size-small: 12px;
  --font-size-label: 13px;
  --font-screening: Sora, system-ui, sans-serif;
  --font-brief-label: 'IBM Plex Sans', sans-serif;

  /* Spacing */
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* Layout and component dimensions */
  --size-header-desktop: 78px;
  --shell: min(1360px,calc(100% - clamp(36px,6vw,110px)));
  --radius: 26px;

  /* Foundation semantic roles */
  --primary: var(--color-brand);
  --secondary: var(--color-signal);
  --ter: #71DBB8;
  --ground: #F5F8FB;
  --ink: #121D30;
  --night: #0A1526;
  --muted: #607086;
  --line: #D9E1EE;
}

/* Reset and base elements */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.7 var(--body-font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

svg,
img {
  display: block;
  max-width: 100%;
}

p,
h1,
h2,
h3,
h4 {
  margin: 0;
}

p {
  color: var(--muted);
}

h1,
h2,
h3 {
  font-family: var(--title-font);
  line-height: 1.08;
  letter-spacing: -.052em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 4px;
}

.skip {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 999;
  padding: 12px;
  background: var(--primary);
  color: var(--color-white);
}

.skip:focus {
  top: 12px;
}

/* Navigation */

.site-header {
  position: sticky;
  z-index: 80;
  top: 0;
  background: rgba(250,252,255,.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  height: var(--size-header-desktop);
  display: flex;
  align-items: center;
  gap: 25px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 800;
  letter-spacing: -.035em;
  font-size: var(--font-size-label);
  max-width: 270px;
  line-height: 1.28;
}

.logo-symbol {
  flex: 0 0 37px;
  height: 37px;
  border-radius: 11px;
  background: var(--night);
  position: relative;
  overflow: hidden;
}

.logo-symbol span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--secondary);
  left: 8px;
  top: 21px;
}

.logo-symbol span:nth-child(2) {
  left: 17px;
  top: 13px;
  background: var(--primary);
}

.logo-symbol span:nth-child(3) {
  left: 27px;
  top: 7px;
  background: var(--ter);
}

.desktop-menu {
  display: flex;
  align-items: center;
  gap: clamp(16px,2vw,35px);
  margin-left: auto;
}

.desktop-menu a {
  font-size: var(--font-size-label);
  font-weight: 700;
  color: #42526D;
  transition: color .2s;
}

.desktop-menu a:hover,
.desktop-menu a[aria-current=page] {
  color: var(--primary);
}

.nav-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-shrink: 0;
  border-radius: 100px;
  color: var(--color-white);
  background: var(--primary);
  font-size: var(--font-size-small);
  font-weight: 750;
  padding: 13px 20px;
  transition: transform .25s ease,box-shadow .25s ease;
}

.nav-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -18px var(--primary);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  background: var(--color-white);
  border: 1px solid var(--line);
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

.nav-toggle span {
  height: 2px;
  width: 22px;
  background: var(--ink);
  transition: transform .2s;
}

.nav-toggle[aria-expanded=true] span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav-toggle[aria-expanded=true] span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.mobile-menu {
  display: none;
  position: absolute;
  top: var(--size-header-desktop);
  left: 0;
  right: 0;
  padding: 18px max(24px,4vw) 28px;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 45px -32px rgba(8,22,38,.4);
}

.mobile-menu[hidden] {
  display: none!important;
}

.mobile-menu>a {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 750;
  color: var(--ink);
}

.mobile-menu .mobile-cta {
  display: block;
  background: var(--primary);
  color: var(--color-white);
  text-align: center;
  border-radius: 14px;
  margin-top: 14px;
}

.page-hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 8% 20%,rgba(76,24,223,.10),transparent 45%),radial-gradient(ellipse at 90% 10%,rgba(3,185,252,.13),transparent 33%),var(--ground);
  padding: clamp(70px,7vw,126px) 0 clamp(82px,9vw,138px);
}

.page-hero:before {
  content: '';
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: .25;
  background-image: linear-gradient(90deg,rgba(15,26,44,.055) 1px,transparent 1px);
  background-size: calc(100%/12) 100%;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0,1.03fr) minmax(0,.97fr);
  align-items: center;
  gap: clamp(24px,4vw,70px);
  position: relative;
}

.hero-text {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: var(--font-size-caption);
  line-height: 1.5;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.glow-dot {
  width: 7px;
  height: 7px;
  background: var(--secondary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(3,185,252,.12);
}

.hero-text h1 {
  font-size: clamp(3rem,5.7vw,7rem);
  line-height: .99;
  letter-spacing: -.078em;
  max-width: 13ch;
  margin: 24px 0 23px;
  text-wrap: balance;
}

.hero-deck {
  font-size: clamp(1.05rem,1.35vw,1.25rem);
  max-width: 54ch;
  color: #52637D;
  line-height: 1.74;
}

/* Actions */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 51px;
  border-radius: 100px;
  font-size: var(--font-size-label);
  font-weight: 800;
  padding: 14px 22px;
  transition: transform .27s ease,box-shadow .27s ease,background .27s ease;
}

.button:hover {
  transform: translateY(-3px);
}

.button-primary {
  background: linear-gradient(120deg,var(--primary),#5128F2 60%,#157DED);
  color: var(--color-white);
  box-shadow: 0 18px 30px -21px rgba(76,24,223,.6);
}

.button-light {
  background: var(--color-white);
  color: var(--night);
}

.page-hero-compact {
  padding: 66px 0 76px;
}

.page-hero-compact .hero-text h1 {
  font-size: clamp(2.7rem,4.65vw,5.1rem);
}

.section {
  padding: clamp(72px,7vw,125px) 0;
}

.section-alt {
  background: var(--color-white);
}

.section-intro {
  max-width: 850px;
  margin-bottom: 40px;
}

.section-intro h2 {
  font-size: clamp(2.25rem,4.2vw,4.6rem);
  margin: 16px 0;
}

.section-intro>p {
  max-width: 66ch;
  font-size: 1.07rem;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 18px;
}

/* Content cards */

.resource-card {
  position: relative;
  background: var(--color-white);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 290px;
  box-shadow: 0 15px 55px -43px rgba(13,30,53,.3);
  transition: transform .3s ease,box-shadow .3s ease,border-color .3s ease;
}

.resource-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 28px 60px -36px rgba(13,30,53,.22);
  border-color: rgba(76,24,223,.23);
}

.resource-card h3 {
  font-size: clamp(1.3rem,1.6vw,1.7rem);
  margin: 26px 0 15px;
  line-height: 1.23;
}

.resource-card h3 a:after {
  content: '';
  position: absolute;
  inset: 0;
}

.resource-card>p {
  font-size: .92rem;
}

.card-type {
  color: var(--primary);
  font: 850 11px ui-monospace,monospace;
  letter-spacing: .13em;
}

.card-arrow {
  position: absolute;
  right: 26px;
  bottom: 20px;
  color: var(--primary);
  font-weight: 900;
  font-size: 22px;
}

.case-resource {
  background: linear-gradient(160deg,#0C192C,#142847);
  border-color: #264160;
  color: var(--color-white);
}

.case-resource h3 {
  color: var(--color-white);
  margin: 10px 0;
}

.case-resource .card-type {
  color: #8FE8FF;
}

.case-resource .card-arrow {
  color: #89E6FF;
}

.case-resource .card-strap {
  color: #B8CCDE;
}

.card-num {
  font: 800 clamp(2.8rem,4vw,4.2rem)/1 var(--title-font);
  letter-spacing: -.06em;
  color: var(--ter);
  margin-top: 26px;
}

.case-resource .card-num {
  color: var(--ter);
}

/* Editorial content */

.editorial {
  max-width: 880px;
  font-size: 1.05rem;
  line-height: 1.85;
  color: #2F4058;
}

.editorial p {
  margin-bottom: 1.45em;
}

.editorial h2 {
  font-size: clamp(1.8rem,2.65vw,2.8rem);
  margin: 2.4em 0 .7em;
  scroll-margin-top: 110px;
}

.editorial h3 {
  font-size: 1.4rem;
  margin: 1.8em 0 .55em;
}

.editorial li {
  margin: .4em 0;
}

.editorial strong {
  color: var(--ink);
}

.editorial a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: .2em;
}

.editorial table {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
}

.editorial th,
.editorial td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.editorial th {
  background: #F2F6FB;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0,1fr);
  gap: clamp(35px,6vw,110px);
  align-items: start;
}

.article-toc {
  position: sticky;
  top: 110px;
  max-height: calc(100vh - 135px);
  overflow: auto;
}

.article-toc .eyebrow {
  display: block;
  margin-bottom: 15px;
}

.article-toc a {
  display: block;
  padding: 9px 12px;
  margin-bottom: 5px;
  font-size: var(--font-size-label);
  line-height: 1.45;
  border-radius: 10px;
  font-weight: 650;
  color: #5F7189;
  transition: background .2s,color .2s;
}

.article-toc a:hover,
.article-toc a.active {
  background: #EAEAFF;
  color: var(--primary);
}

.article-toc .toc-cta {
  display: flex;
  margin-top: 26px;
  background: var(--primary);
  color: var(--color-white);
  border-radius: 14px;
  padding: 14px 15px;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--font-size-small);
}

.bottom-cta {
  background: var(--night);
  padding: 76px 0;
  color: var(--color-white);
}

.cta-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.bottom-cta h2 {
  font-size: clamp(2.3rem,4vw,4.5rem);
  max-width: 17ch;
  margin: 15px 0;
}

.bottom-cta p {
  color: #B9CBE0;
  max-width: 60ch;
}

/* Contact form */

.form-wrap {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: clamp(25px,4vw,50px);
  border: 1px solid var(--line);
  box-shadow: 0 25px 80px -55px rgba(0,0,0,.28);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.span-2 {
  grid-column: span 2;
}

.field label {
  font-size: var(--font-size-label);
  font-weight: 750;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #CBD5E4;
  border-radius: 13px;
  background: #F8FAFD;
  color: var(--ink);
  padding: 14px 16px;
}

.field textarea {
  min-height: 125px;
}

.form-note {
  font-size: var(--font-size-small);
  margin: 16px 0;
}

/* Footer */

.site-footer {
  background: #071321;
  color: var(--color-white);
  padding-top: 65px;
}

.foot-columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 60px;
  padding-bottom: 55px;
}

.foot-logo {
  font-size: 17px;
  color: var(--color-white);
  font-weight: 850;
  line-height: 1.25;
  max-width: 300px;
}

.foot-columns>div>p:nth-child(2) {
  font-size: var(--font-size-label);
  color: #B5C7D9;
  max-width: 32ch;
  margin-top: 16px;
}

.foot-columns nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.foot-columns nav a {
  font-size: var(--font-size-label);
  color: #CBD7E4;
}

.foot-columns nav a:hover {
  color: var(--color-white);
}

.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-8);
  border-top: 1px solid #2A3849;
  padding: 22px 0;
  font-size: var(--font-size-caption);
  color: #AEBECE;
}

.foot-credit a {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.back-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: var(--color-brand);
  color: var(--color-white);
  box-shadow: 0 15px 45px -20px var(--color-brand);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .25s,transform .25s;
}

.back-top.visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-top svg.progress {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.back-top circle {
  fill: none;
  stroke-width: 2.6;
}

.back-top circle.track {
  stroke: rgba(255,255,255,.22);
}

.back-top circle.trace {
  stroke: var(--color-white);
  stroke-linecap: round;
  stroke-dasharray: 144.51;
  stroke-dashoffset: 144.51;
}

.back-top svg.arrow {
  position: relative;
  width: 20px;
  height: 20px;
  z-index: 2;
}

@media (prefers-reduced-motion:no-preference) {
  .resource-card:hover .card-arrow {
    transform: translate(3px,-3px);
  }

  .card-arrow {
    transition: transform .3s ease;
  }
}

@keyframes art-arrive {
  from {
    opacity: 0;
    transform: translateY(24px) scale(.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes path-arrive {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes glow-breathe {
  from {
    filter: drop-shadow(0 0 4px rgba(3,185,252,.35));
  }

  to {
    filter: drop-shadow(0 0 22px rgba(3,185,252,.7));
  }
}

@keyframes soft-drift {
  to {
    transform: translateY(-14px) scale(1.035);
  }
}

@media (max-width:1060px) {
  .desktop-menu,
  .nav-contact {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .mobile-menu:not([hidden]) {
    display: block;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-text h1 {
    max-width: 18ch;
  }

  .resource-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .article-layout {
    grid-template-columns: 180px minmax(0,1fr);
    gap: 35px;
  }
}

@media (max-width:720px) {
  :root {
    --shell: calc(100% - 36px);
  }

  .site-logo {
    font-size: var(--font-size-small);
    max-width: 230px;
  }

  .nav-inner {
    height: 72px;
  }

  .mobile-menu {
    top: 72px;
  }

  .page-hero,
  .page-hero-compact {
    padding: 64px 0 65px;
  }

  .hero-text h1,
  .page-hero-compact .hero-text h1 {
    font-size: clamp(2.85rem,10.5vw,5.2rem);
    max-width: none;
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .resource-card {
    min-height: 235px;
  }

  .article-layout {
    display: block;
  }

  .article-toc {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
    margin-bottom: 35px;
  }

  .article-toc nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0;
  }

  .article-toc nav a {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .article-toc .toc-cta {
    max-width: 280px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.span-2 {
    grid-column: auto;
  }

  .cta-inner {
    flex-direction: column;
    align-items: start;
  }

  .foot-columns {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }

  .foot-columns>div {
    grid-column: span 2;
  }

  .editorial {
    font-size: 1rem;
  }
}

@media (max-width:420px) {
  .hero-text h1 {
    font-size: clamp(2.55rem,10vw,4rem);
  }

  .foot-columns {
    grid-template-columns: 1fr;
  }

  .foot-columns>div {
    grid-column: span 1;
  }

  .foot-bottom {
    display: block;
  }

  .foot-bottom span {
    display: block;
    margin-bottom: 7px;
  }
}

@media (prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *:before,
  *:after {
    animation: none!important;
    transition-duration: .001ms!important;
  }
}

@media (min-width:1061px) {
  .theme-ledger .hero-grid {
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  }

  .theme-ledger .hero-text {
    order: 2;
  }

  .theme-ledger .hero-text h1 {
    font-size: clamp(3.5rem,5.2vw,6.5rem);
  }
}

@media (max-width:1060px) {
  .theme-ledger .hero-text {
    order: unset;
  }
}
