/* ==========================================================================
   Caetano & Laborda — institutional stylesheet
   Tokens are the contract; see BRAND.md §4.
   ========================================================================== */

:root {
  /* Institutional core */
  --ink: #16232E;
  --deep: #10283B;
  --signal: #175A87;
  --signal-deep: #0F4166;
  --signal-soft: #E7EFF6;

  /* Bronze — the corporate accent.
     CONTRAST CONTRACT (measured, not assumed):
       --bronze        3.57:1 on paper / 4.24:1 on navy
                       => GRAPHIC ONLY. Rules, the mark, dividers, icons.
                          Never body text, never a link, never a label.
       --bronze-text   6.24:1 on paper  => safe for text on light ground
       --bronze-rev    6.26:1 on navy   => safe for text on dark ground */
  --bronze: #A67C3D;
  --bronze-text: #7A5626;
  --bronze-rev: #C89A5A;

  /* Surfaces */
  --paper: #F7F9FB;
  --surface: #FFFFFF;
  --rule: #DDE4EB;
  --muted: #55636F;

  /* Product identifiers — only when naming a product */
  --theravista: #0D9488;
  --falinha: #C4623A;
  --aeropass: #4A5CA6;
  --aeronav: #3F7A5E;
  --ritmovida: #BE123C;

  --serif: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0 0 1rem; max-width: var(--measure); text-wrap: pretty; }
a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--signal-deep); }

.wrap { max-width: 1140px; margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 820px; }

/* --- skip link ---------------------------------------------------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: .75rem 1.25rem;
}
.skip:focus { left: 0; }

/* --- masthead ----------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 249, 251, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; padding-block: .9rem;
}
.wordmark { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
/* The mark is composed with the wordmark in markup rather than shipped as a
   text-outlined SVG, so it stays crisp and uses the real webfont. */
.wordmark__mark { width: 30px; height: 30px; flex: none; color: var(--ink); }
.footer .wordmark__mark { color: #fff; }
.wordmark__lede { display: flex; align-items: baseline; gap: .6rem; }
.wordmark__name {
  font-family: var(--serif); font-size: 1.06rem; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; white-space: nowrap;
}
.wordmark__rule { width: 26px; height: 1px; background: var(--signal); flex: none; }
.wordmark__kind {
  font-size: .68rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.nav { display: flex; gap: 1.35rem; align-items: center; }
.nav a {
  font-size: .875rem; color: var(--muted); text-decoration: none;
  padding-block: .3rem; border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--signal); }
/* The descriptor is the first thing to go when the bar gets tight — the
   wordmark and the nav both have to stay on one line. */
@media (max-width: 1320px) { .wordmark__rule, .wordmark__kind { display: none; } }
@media (max-width: 860px) { .nav { display: none; } }

/* --- language switcher -------------------------------------------------- */
.masthead__right { display: flex; align-items: center; gap: 1.35rem; }
.langswitch { display: flex; align-items: center; gap: .1rem; flex: none; }
.langswitch a {
  font-size: .74rem; font-weight: 600; letter-spacing: .07em;
  color: var(--muted); text-decoration: none; padding: .22rem .45rem;
  border-radius: 2px; line-height: 1;
}
.langswitch a:hover { color: var(--ink); background: var(--signal-soft); }
.langswitch a[aria-current="true"] { color: var(--signal); background: var(--signal-soft); }
.langswitch span { color: var(--rule); font-size: .7rem; }

/* --- hero --------------------------------------------------------------- */
.hero { padding-block: clamp(4rem, 11vw, 8.5rem) clamp(3rem, 7vw, 5rem); }
.hero__eyebrow {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--signal); font-weight: 600; margin-bottom: 1.75rem;
  display: flex; align-items: center; gap: .8rem;
}
.hero__eyebrow::after { content: ""; height: 1px; flex: 1; max-width: 220px; background: var(--rule); }
.hero h1 { font-size: clamp(2.4rem, 6.2vw, 4.15rem); margin-bottom: 1.75rem; }
.hero__lede {
  font-size: clamp(1.08rem, 2.1vw, 1.3rem); color: var(--muted);
  max-width: 62ch; line-height: 1.55;
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 0 2.5rem;
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  font-size: .8rem; color: var(--muted);
}
.hero__meta strong { display: block; color: var(--ink); font-weight: 600; font-size: .93rem; }
.hero__meta > div { padding-block: .4rem; }

/* --- generic section ---------------------------------------------------- */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); border-top: 1px solid var(--rule); }
.section--dark { background: var(--deep); color: #E8EEF3; border-top: none; }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--dark p { color: #B7C6D2; }
.section--tint { background: var(--surface); }

.section__label {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--signal); font-weight: 600; margin-bottom: 1rem;
}
.section--dark .section__label { color: #6FA8CE; }
.section h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin-bottom: 1.25rem; }
.section__intro { font-size: 1.06rem; color: var(--muted); max-width: 60ch; }
.section--dark .section__intro { color: #B7C6D2; }

/* --- the continuum ------------------------------------------------------ */
.continuum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 3rem; }
.continuum__item { padding: 1.75rem 1.5rem 1.75rem 0; border-top: 2px solid var(--signal); position: relative; }
.continuum__item + .continuum__item { padding-left: 1.5rem; }
.continuum__n {
  font-family: var(--serif); font-size: .8rem; color: var(--signal);
  font-weight: 600; letter-spacing: .1em;
}
.continuum__item h3 { font-size: 1.18rem; margin: .55rem 0 .5rem; }
.continuum__item p { font-size: .9rem; color: var(--muted); margin: 0; }
@media (max-width: 880px) {
  .continuum { grid-template-columns: 1fr 1fr; }
  .continuum__item, .continuum__item + .continuum__item { padding-left: 0; padding-right: 1.25rem; }
}
@media (max-width: 540px) { .continuum { grid-template-columns: 1fr; } }

/* --- principles list ---------------------------------------------------- */
.principles { margin-top: 2.5rem; display: grid; gap: 0; }
.principle {
  display: grid; grid-template-columns: minmax(0, 15rem) 1fr; gap: 2rem;
  padding-block: 1.4rem; border-top: 1px solid rgba(255, 255, 255, .14);
}
.principle h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
.principle p { margin: 0; font-size: .93rem; }
@media (max-width: 720px) { .principle { grid-template-columns: 1fr; gap: .4rem; } }

/* --- programme cards ---------------------------------------------------- */
.programmes { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.25rem; margin-top: 2.75rem; }
.programme {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 3px;
  padding: 1.6rem 1.5rem; border-top: 3px solid var(--accent, var(--signal));
  display: flex; flex-direction: column;
}
/* Title and status chip STACK rather than sitting inline.
   Inline with justify-content:space-between, a long chip
   ("WORKING MVP · PRE-TRACTION") is nowrap and cannot shrink, so it
   overflowed the card edge. flex-wrap would fix the overflow but leaves one
   card wrapped and its neighbours inline, which reads as a bug rather than a
   choice. Stacking is deterministic at every viewport and every label length. */
.programme__head {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: .55rem; margin-bottom: .3rem;
}
.programme h3 { font-size: 1.22rem; }
/* The chip can still exceed a narrow card on its own line — allow it to wrap
   internally rather than clip. */
.programme .chip { max-width: 100%; white-space: normal; }
/* The role line is the card's thesis; it needs to read as a standalone
   statement, not as the first sentence of the body copy. */
.programme__role {
  font-family: var(--serif); font-size: 1rem; color: var(--ink); font-weight: 600;
  margin: .6rem 0 .85rem; padding-bottom: .85rem; border-bottom: 1px solid var(--rule);
}
.programme p { font-size: .89rem; color: var(--muted); margin: 0; }
.programme__foot { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--rule); font-size: .78rem; color: var(--muted); }

.chip {
  display: inline-block; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 600; padding: .28rem .6rem; border-radius: 2px; white-space: nowrap;
  background: var(--signal-soft); color: var(--signal-deep);
}
.chip--proto { background: #FDF0E7; color: #9A4A22; }
.chip--discovery { background: #F0F1F5; color: #4A5368; }
.chip--labs { background: #F5EEF1; color: #9B1C3B; }

/* --- consent layer diagram --------------------------------------------- */
.layer { margin-top: 3rem; border: 1px solid rgba(255,255,255,.16); border-radius: 3px; overflow: hidden; }
.layer__row { display: grid; grid-template-columns: repeat(4, 1fr); }
.layer__cell {
  padding: 1.1rem 1rem; border-right: 1px solid rgba(255,255,255,.16);
  border-bottom: 1px solid rgba(255,255,255,.16);
  font-size: .84rem; color: #C6D4DF;
}
.layer__cell:last-child { border-right: none; }
.layer__cell strong { display: block; color: #fff; font-weight: 600; margin-bottom: .2rem; font-size: .92rem; }
.layer__base {
  padding: 1.25rem 1rem; text-align: center; background: rgba(23, 90, 135, .35);
  font-size: .9rem; color: #fff;
}
.layer__base strong { font-family: var(--serif); font-size: 1.05rem; }
@media (max-width: 760px) {
  .layer__row { grid-template-columns: 1fr 1fr; }
  .layer__cell:nth-child(2n) { border-right: none; }
}

/* --- group entities ----------------------------------------------------- */
.entities { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; margin-top: 2.5rem; }
.entity { background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; padding: 1.6rem 1.5rem; }
.entity h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.entity__where { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--signal); font-weight: 600; margin-bottom: .9rem; }
.entity p { font-size: .89rem; color: var(--muted); margin: 0; }

/* --- research / method -------------------------------------------------- */
/* Four items: a 2x2 block reads as a balanced matrix; auto-fit gave 3+1 and a
   dangling gap at common desktop widths. */
.method { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.25rem 3rem; margin-top: 2.5rem; }
@media (max-width: 700px) { .method { grid-template-columns: 1fr; } }
.method h3 { font-size: 1.02rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0; margin-bottom: .45rem; }
.method p { font-size: .89rem; color: var(--muted); margin: 0; }

/* --- callout ------------------------------------------------------------ */
.callout {
  margin-top: 2.5rem; padding: 1.4rem 1.6rem; background: var(--signal-soft);
  border-left: 3px solid var(--signal); border-radius: 0 3px 3px 0;
}
.callout p { margin: 0; font-size: .93rem; color: var(--ink); }
.callout strong { font-weight: 600; }

/* --- placeholder marker ------------------------------------------------- */
.todo {
  display: inline-block; background: #FFF6D8; border: 1px dashed #C9A227;
  color: #6B5310; font-size: .78rem; padding: .12rem .5rem; border-radius: 2px;
  font-family: var(--sans); font-weight: 500;
}

/* --- contact ------------------------------------------------------------ */
/* One address, set large enough to be the section's terminal gesture. */
.contact-email { margin-top: 2rem; }
.contact-email a {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--signal);
  text-decoration: none;
  border-bottom: 2px solid var(--rule);
  padding-bottom: .15rem;
  transition: border-color 160ms ease, color 160ms ease;
}
.contact-email a:hover { color: var(--signal-deep); border-bottom-color: var(--signal); }
@media (prefers-reduced-motion: reduce) { .contact-email a { transition: none; } }

/* --- footer ------------------------------------------------------------- */
.footer { background: var(--ink); color: #9FB0BE; padding-block: 3rem 2rem; font-size: .84rem; }
.footer a { color: #C6D4DF; }
.footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.footer__brand .wordmark__name { color: #fff; }
.footer__brand .wordmark__kind { color: #7F94A5; }
.footer__cols { display: flex; gap: 3.5rem; flex-wrap: wrap; }
.footer__col h4 { font-family: var(--sans); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #7F94A5; font-weight: 600; margin-bottom: .7rem; }
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.footer__col a { text-decoration: none; }
.footer__col a:hover { text-decoration: underline; }
.footer__bottom { padding-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; font-size: .78rem; color: #7F94A5; }

/* --- focus -------------------------------------------------------------- */
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
.section--dark :focus-visible, .footer :focus-visible { outline-color: #7FB6DA; }

/* --- accessibility floor -----------------------------------------------
   The subject of this site is neurodivergent autonomy, so accessibility is
   part of the identity, not a later compliance pass.

   - WCAG 2.2 target size: every interactive control clears 24x24 CSS px.
     Nav and language links are small by design, so the floor is enforced
     with padding rather than by enlarging type.
   - Nothing conveys meaning by colour alone: status chips carry words,
     programme cards carry a coloured rule AND a text label.
   - Motion is optional everywhere (see prefers-reduced-motion below). */
.nav a, .langswitch a, .footer__col a, .contact-email a {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}
.langswitch a { min-width: 24px; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
