/* Clearstar site styles: brand tokens, layout, navigation, footer and homepage sections.
   Shared across the homepage, interior pages and generated publications. */

:root {
  --navy: #0c1d36;
  --navy-2: #142640;
  --navy-line: #2a3a52;
  --bone: #ece0bf;
  --bone-2: #c9c2ad;
  --muted: #8a9ab0;
  --brass: #c19a5a;
  --brass-dark: #8a6a2b;
  --ink-2: #3a4a62;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Schibsted Grotesk', Calibri, Arial, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  --wordmark: 'Manrope', 'Schibsted Grotesk', sans-serif;
  --max: 1280px;
  --gutter: 32px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--navy);
  background-image:
    linear-gradient(rgba(236, 224, 191, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 224, 191, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--bone);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bone); text-decoration: none; }
a:hover { color: var(--brass); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.skip-link { position: absolute; top: 8px; left: 16px; z-index: 100; padding: 12px 20px; background: var(--bone); color: var(--navy); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.site-header [aria-current="page"] { color: var(--brass); }

img { max-width: 100%; }

.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

@media (max-width: 640px) {
  :root { --gutter: 20px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 24px;
  font-weight: 500;
  border: 1px solid var(--navy-line);
}
.btn-primary { background: var(--bone); color: var(--navy); border-color: var(--bone); font-weight: 700; }
.btn-primary:hover { background: var(--brass); border-color: var(--brass); color: var(--navy); }
.btn-outline-bone { border-color: var(--bone); }
.btn-dark { background: var(--navy); color: var(--bone); border-color: var(--navy); font-weight: 700; }
.btn-dark:hover { background: var(--navy-2); color: var(--bone); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 480px) {
  /* Paired actions stack at phone widths; a shrink-wrapped grid gives every
     button in the stack the width of the widest one (see also .cta-row). */
  .btn-row { display: grid; width: fit-content; max-width: 100%; }
  /* A label that must wrap splits evenly, centred like single-line labels, instead of leaving its arrow alone on a line. */
  .btn { padding-inline: 20px; text-wrap: balance; text-align: center; }
}

/* ---------- Navigation ---------- */
.site-header { position: relative; z-index: 10; }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
  padding-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 28px; width: auto; }
.brand span { font-family: var(--wordmark); font-weight: 800; font-size: 24px; letter-spacing: -0.025em; color: var(--bone); }
.nav-links { display: flex; gap: 32px; font-size: 15px; }
.nav-contact { padding: 10px 18px; border: 1px solid var(--bone); font-size: 14px; }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--navy-line);
  color: var(--bone);
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
}
.mobile-menu { display: none; }

@media (max-width: 900px) {
  .nav-links, .nav-contact { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .mobile-menu.open {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 var(--gutter) 24px;
  }
  .mobile-menu a { padding: 12px 0; border-bottom: 1px solid var(--navy-line); font-size: 17px; }
}

/* ---------- Typography ---------- */
.h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(46px, 6vw, 84px);
  line-height: 1.0;
  letter-spacing: -0.025em;
  font-weight: 400;
  text-wrap: balance;
}
.h2 {
  margin: 0 auto;
  max-width: 900px;
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 400;
  text-wrap: balance;
}
.lead { margin: 0; font-size: 19px; line-height: 1.55; color: var(--bone-2); max-width: 500px; text-wrap: pretty; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 48px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 88px;
}
/* Keep copy and visual side by side on narrow desktops, where auto-fit would stack them. */
@media (min-width: 901px) {
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Just above the breakpoint the copy column is too narrow for both actions (they wrap below ~935px);
   stack them at a shared width rather than leaving two unequal buttons. */
@media (min-width: 901px) and (max-width: 960px) {
  .hero .btn-row { display: grid; width: fit-content; }
}
.hero-copy { display: flex; flex-direction: column; gap: 32px; }
.core { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.core canvas { display: block; width: 100%; aspect-ratio: 1 / 1; cursor: grab; touch-action: pan-y; }
.core figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 28px;
  overflow: hidden;
}
.core-dot { width: 10px; height: 10px; flex-shrink: 0; background: var(--navy-line); }
.core-label {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---------- Metrics ---------- */
.metrics { padding-bottom: 96px; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 32px;
  border-top: 1px solid var(--navy-line);
  padding-top: 36px;
}
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric-value { font-family: var(--serif); font-size: 48px; line-height: 1; }
.metric-label { color: var(--muted); font-size: 15px; }
.metric-note { color: var(--muted); font-size: 12px; }
.metric-value.metric-unavailable { font-family: var(--sans); font-size: 24px; line-height: 2; color: var(--bone-2); }

/* ---------- Partners ---------- */
.partners { border-top: 1px solid var(--navy-line); border-bottom: 1px solid var(--navy-line); }
.partners-title { margin: 0; padding-top: 32px; text-align: center; font-size: 18px; font-weight: 700; }
.marquee { overflow: hidden; padding: 28px 0 36px; }
.marquee-track { display: flex; width: max-content; }
.marquee-track[data-ready] { animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-set { display: flex; flex: 0 0 auto; align-items: center; gap: 96px; padding-right: 96px; }
.marquee-set a { display: inline-flex; align-items: center; gap: 12px; color: var(--bone); opacity: 0.82; }
.marquee-set a:hover { opacity: 1; }
/* Greyscale keeps filled marks (Morpho's disc) legible where a white silhouette would flatten them. */
.marquee-set img { height: 32px; width: auto; max-width: 150px; object-fit: contain; filter: grayscale(1) brightness(1.35); }
/* OpenEden ships as a padded wordmark; size it to match the text names beside the other marks. */
.marquee-set img.partner-wordmark { height: 56px; max-width: 170px; }
.partner-name { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(calc(-1 * var(--marquee-distance))); } }

/* ---------- Sections ---------- */
.section { padding-top: 128px; padding-bottom: 128px; display: flex; flex-direction: column; gap: 64px; }
.band { background: var(--navy-2); }
.rule-top { border-top: 1px solid var(--navy-line); }

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 48px 40px;
}
.pillar { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--brass); padding-top: 28px; }
.pillar h3 { margin: 0; font-family: var(--serif); font-size: 25px; line-height: 1.2; font-weight: 400; }
.pillar p { margin: 0; color: var(--bone-2); font-size: 16px; line-height: 1.6; }

/* Each homepage chapter has its own visual treatment. */
.home-key-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px; }
/* :not() lets the 24px "Unavailable" fallback (.metric-unavailable) keep its size instead of overflowing its column. */
.home-key-figures .metric-value:not(.metric-unavailable) { font-size: clamp(38px, 4.2vw, 56px); }
.home-key-figures .metric-label { max-width: 220px; color: var(--bone-2); }
.home-chapter { width: calc(100% - var(--gutter) * 2); max-width: calc(var(--max) - var(--gutter) * 2); margin: 32px auto; border: 1px solid var(--navy-line); }
.home-chapter > .wrap { padding: 40px; gap: 32px; }
.home-chapter .h2 { text-align: left; margin: 0; max-width: 780px; }
.home-mandates-section, .home-decisions-section { background-color: var(--bone); color: var(--navy); border-color: var(--bone); }
.home-story-section, .home-research-section { background-color: var(--navy); }

/* Drafting marks stay inside empty panel margins, clear of all reading areas. */
:is(.home-chapter, .services-page .service-stage, .services-page .systems-section, .services-page #capabilities, .about-page .paper-section) { position: relative; }
:is(.home-chapter, .services-page .service-stage, .services-page .systems-section, .services-page #capabilities, .about-page .paper-section)::after {
  content: ''; position: absolute; pointer-events: none;
  width: var(--edge-width, 84px); height: var(--edge-height, 10px);
  top: var(--edge-top, auto); bottom: var(--edge-bottom, 8px);
  right: var(--edge-right, 24px); left: var(--edge-left, auto);
  background: var(--edge-mark) center / 100% 100% no-repeat;
  opacity: .65;
}
.home-mandates-section, .services-page #institutions, .services-page #capabilities {
  --edge-mark: url('/assets/diagrams/panel-dimension.svg'); --edge-width: 180px; --edge-height: 12px;
  --edge-top: 8px; --edge-bottom: auto;
}
.home-story-section, .services-page #issuers, .about-page .paper-section {
  --edge-mark: url('/assets/diagrams/panel-registration.svg'); --edge-width: 14px; --edge-height: 14px;
  --edge-right: 6px; --edge-bottom: 6px;
}
.home-decisions-section, .services-page #ecosystems, .services-page #systems { --edge-mark: url('/assets/diagrams/panel-hatch.svg'); }
.home-research-section {
  --edge-mark: url('/assets/diagrams/panel-dimension.svg'); --edge-width: 180px; --edge-height: 12px;
  --edge-left: 24px; --edge-right: auto;
}
.services-page #systems { --edge-left: 24px; --edge-right: auto; }
.home-mandates, .home-decisions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-mandates { gap: 24px; }
.home-mandates .pillar { padding: 28px; border: 1px solid rgba(12,29,54,.23); background: rgba(255,255,255,.18); gap: 24px; }
.home-mandates .btn { margin-top: auto; align-self: flex-start; text-align: center; text-wrap: balance; padding: 12px 16px; font-size: 14px; }

.home-story { display: grid; grid-template-columns: 1fr 1.2fr; align-items: start; gap: 48px; }
.home-story .h2 { text-align: left; }
.home-story-copy { color: var(--bone-2); font-size: 19px; line-height: 1.7; }
.home-story-copy p { margin: 0 0 24px; }

.home-story-copy .btn { margin-top: 8px; }


.home-research-section .feature-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-decisions .pillar { border: 0; padding-top: 0; gap: 20px; }
.home-decisions .pillar h3 { font-size: 29px; }
.home-decisions-section .btn-row { margin-top: 0; }
:is(.home-mandates-section, .home-decisions-section) .pillar p { color: var(--ink-2); }
:is(.home-mandates-section, .home-decisions-section) .btn { color: var(--navy); border-color: var(--navy); }
:is(.home-mandates-section, .home-decisions-section) .btn:hover { background: var(--navy); color: var(--bone); }
.feature .feature-cta.btn { align-self: flex-start; margin-top: auto; }
@media (max-width: 1000px) {
  .home-mandates .pillar { padding: 24px; }
  .home-key-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; }
}
@media (max-width: 359px) {
  /* Keep the live TVL figure (up to "$999.9M") inside its half-width column. */
  .home-key-figures { column-gap: 24px; }
  .home-key-figures .metric-value:not(.metric-unavailable) { font-size: 34px; }
}
@media (max-width: 900px) {
  .home-chapter > .wrap { padding: 28px 24px; }
  .home-research-section .feature-links { grid-template-columns: 1fr; }
  .home-research-section .feature { padding: 24px; }
  .home-story, .home-mandates, .home-decisions { grid-template-columns: 1fr; gap: 36px; }
  .home-story-copy { font-size: 17px; }
}

.feature-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 16px;
}
.feature {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 240px;
  padding: 40px;
  background: var(--navy-2);
  border: 1px solid var(--navy-line);
}
.feature-kicker { font-size: 15px; color: var(--brass); }
.feature-title { font-family: var(--serif); font-size: 30px; line-height: 1.2; }
.feature-text { color: var(--bone-2); font-size: 16px; line-height: 1.6; flex-grow: 1; }
.feature-cta { font-size: 16px; }
.feature.light { background: var(--bone); color: var(--navy); border-color: var(--bone); }
.feature.light .feature-kicker { color: var(--brass-dark); }
.feature.light .feature-text { color: var(--ink-2); }
.feature.light .feature-cta { font-weight: 700; }
.feature.light:hover { color: var(--navy); }

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 16px;
}
.service { display: flex; flex-direction: column; gap: 20px; padding: 40px; background: var(--navy); }
.service h3 { margin: 0; font-family: var(--serif); font-size: 32px; line-height: 1.1; font-weight: 400; }
.service-intro { margin: 0; font-size: 18px; color: var(--bone); }
.service-text { margin: 0; font-size: 16px; color: var(--bone-2); flex-grow: 1; }
.service-link { font-weight: 700; }
.service.light { background: var(--bone); color: var(--navy); }
.service.light .service-intro { color: var(--navy); }
.service.light .service-text { color: var(--ink-2); }
.service.light .service-link { color: var(--navy); }

.vaults {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
  gap: 48px 80px;
  align-items: center;
}
.vaults-copy { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; }
.vaults-copy p { margin: 0; color: var(--bone-2); font-size: 17px; max-width: 500px; }
.vaults svg { display: block; width: 100%; height: auto; }

.flow { stroke-dasharray: 3 17; animation: flow 1.8s linear infinite; }
.flow-slow { stroke-dasharray: 3 17; animation: flow 2.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -40; } }

.cta { background: var(--bone); color: var(--navy); }
.cta .wrap {
  padding-top: 128px;
  padding-bottom: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
}
.cta .h2 { font-size: clamp(36px, 4.8vw, 64px); line-height: 1.04; }
.cta-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: center; }
@media (max-width: 480px) {
  .cta-row { display: grid; width: fit-content; max-width: 100%; margin-inline: auto; }
}
.cta-mail { color: var(--navy); border-bottom: 1px solid var(--brass-dark); padding-bottom: 2px; }
.cta-mail:hover { color: var(--brass-dark); }
.btn-contact-email { color: var(--navy); border-color: var(--navy); }
.btn-contact-email:hover { background: var(--navy); color: var(--bone); }

/* ---------- Footer ---------- */
.site-footer .footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding-top: 64px;
  padding-bottom: 40px;
  font-size: 14px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 16px 32px; color: var(--bone-2); }
.footer-links a { color: var(--bone-2); }
.footer-links a:hover { color: var(--brass); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 40px;
  font-size: 13px;
  color: var(--muted);
  /* Divider spans the content width, matching the footer-top edges, not the gutters. */
  background: linear-gradient(var(--navy-line), var(--navy-line)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-bottom a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .marquee-track[data-ready], .flow, .flow-slow { animation: none; }
  .marquee-track { width: 100%; }
  .marquee-set { flex: 1; flex-wrap: wrap; justify-content: center; gap: 28px 48px; padding: 0 var(--gutter); }
  .marquee-set[aria-hidden="true"] { display: none; }
}

/* Shared grid rows align titles, body copy and actions between adjacent cards. */
@supports (grid-template-rows: subgrid) {
  .home-mandates .pillar { display: grid; grid-template-rows: subgrid; grid-row: span 3; }
  .home-decisions .pillar { display: grid; grid-template-rows: subgrid; grid-row: span 2; }
  /* A wrapped mandate label keeps every button in the row the same height. */
  @media (min-width: 901px) {
    .home-mandates .btn { margin-top: 0; align-self: stretch; }
  }
  @media (max-width: 900px) {
    .home-mandates .pillar, .home-decisions .pillar { display: flex; grid-row: auto; }
  }
}
