/* ---------------------------------------------------------------
   Adeia — SDK reference page

   Layout for sdk.html only. Every selector is scoped under .page-sdk,
   which sits on <body>, so nothing here can reach the landing page
   even if both stylesheets are ever loaded together.

   Colour, type, spacing and easing come from tokens.css. The shared
   classes — .container, .section, .ground--*, .display, .h1, .h2,
   .h3, .lead, .body, .label, .mono, .quiet, .plus-link — come from
   base.css and are not restated here. The masthead and the footer are
   re-authored below rather than imported, because their rules live in
   hero.css and closing.css, which this page does not load.

   Contrast, measured against each ground it is used on:

     on --ink #222222      --mist      #eddfee   12.4:1   body, code
                           --on-ink-q  #a99aab    5.99:1  code comments
                           --orchid    #cd8dbd    6.17:1  display, keywords
     on --bone #ede8da     --on-bone   #2a2a24   11.8:1   body
                           --on-bone-q #57564c    6.04:1  quiet body
     on --paper #ffffff    --on-paper  #222222   15.9:1   body
                           --on-paper-q #5c5c5c   6.69:1  quiet body
     on --forest #1f2d1d   --on-forest #e4ecdf   11.96:1  body, links
                           --on-forest-q #a9b8a4  6.94:1  quiet body
                           --orchid    #cd8dbd    5.61:1  display, plus mark

   Every one clears WCAG AA at the size it is used, including the 10px
   mono labels and the 12px chips. No text on this page is set in a
   colour that is not on that list.
   --------------------------------------------------------------- */

/* =====================================================================
   Shared page furniture
   ===================================================================== */

/* Visible only once it is focused, which is the whole point of it. */
.page-sdk .page-sdk__skip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--orchid);
  color: var(--ink);
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-120%);
}

.page-sdk .page-sdk__skip:focus-visible {
  transform: none;
}

/* ---------- masthead ----------
   Fixed, so it floats over grounds no single section owns. It carries
   its own hairline token because it sits outside any .ground. */
.page-sdk .masthead {
  --rule: var(--rule-on-ink);

  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 1.375rem var(--pad-x);
  color: var(--mist);
}

/* An ink scrim under the bar. Invisible against the hero; over the
   bone and paper grounds further down it is the thing keeping the
   wordmark and the Menu label above 4.5:1. */
.page-sdk .masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to bottom,
    rgba(34, 34, 34, 0.92),
    rgba(34, 34, 34, 0.62) 55%,
    rgba(34, 34, 34, 0)
  );
  pointer-events: none;
}

.page-sdk .masthead__mark {
  font-size: var(--t-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  color: var(--mist);
}

/* A <button> needs its own reset before .plus-link's flexbox applies. */
.page-sdk .masthead__menu {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--sans);
  color: var(--mist);
  cursor: pointer;
}

.page-sdk .masthead__menu-label {
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

/* The ground driver in motion.js makes every .ground transparent so
   the page crossfades as one surface. The menu panel is a .ground too,
   and a transparent full-screen overlay is a menu you cannot read —
   so it keeps its fill. Specificity has to beat html.ground-driven
   .ground, hence the doubled class. */
.page-sdk .menu.ground--ink {
  background-color: var(--ink);
}

/* ---------- section heads ----------
   Eyebrow, title, and an optional note. Used by all four content
   sections so their openings line up down the page. */
.page-sdk .sdk-head {
  display: grid;
  gap: clamp(0.75rem, 1.4vw, 1.25rem);
  padding-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.page-sdk .sdk-head__title {
  max-width: 20ch;
}

.page-sdk .sdk-head__note {
  max-width: 62ch;
}

/* ---------- code ----------
   Always an ink panel, on whatever ground it lands. Two consequences,
   both handled here: the panel re-points --quiet and --rule at their
   ink values, because the enclosing .ground set them for its own
   surface, and the panel is a scroll container, so it is focusable. */
.page-sdk .sdk-code {
  --quiet: var(--on-ink-quiet);
  --rule: var(--rule-on-ink);

  margin: 0;
  padding: clamp(1rem, 1.8vw, 1.5rem);
  background: var(--ink);
  color: var(--mist);
  border: 1px solid var(--rule-on-ink);
  font-family: var(--mono);
  /* Linear in viewport width like the rest of the scale: 15.3px at
     1440, 13.1px at 600. Small enough to read as code, never below
     the point where the mono face loses its counters. */
  font-size: calc(0.72rem + 0.26vw);
  line-height: 1.7;
  font-variant-ligatures: none;
  tab-size: 2;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.page-sdk .sdk-code code {
  font: inherit;
}

/* Comments and shell prompts. */
.page-sdk .sdk-code__c {
  color: var(--on-ink-quiet);
}

/* Keywords and primitive types. */
.page-sdk .sdk-code__k {
  color: var(--orchid);
}

/* String and status literals. Weight, not hue, does the work — the
   colour is the same mist the rest of the block is set in. */
.page-sdk .sdk-code__s {
  color: var(--mist);
  font-weight: 600;
}

/* A single line: the declaration itself, set apart from its prose. */
.page-sdk .sdk-code--sig {
  font-size: calc(0.76rem + 0.28vw);
}

/* Inline code in running prose. The fill is mixed from the current
   ink, so one rule works on every ground without a variant. */
.page-sdk .sdk-inline {
  font-family: var(--mono);
  font-size: 0.9em;
  background: color-mix(in srgb, currentColor 8%, transparent);
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}

/* Small mono tag: a default value, a status code, "required". */
.page-sdk .sdk-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-small);
  font-weight: 600;
  line-height: 1.3;
  color: var(--quiet);
  border: 1px solid var(--rule);
  padding: 0.15em 0.5em;
  white-space: nowrap;
}

/* =====================================================================
   Hero — ink
   ===================================================================== */

.page-sdk .sdk-hero {
  display: grid;
  align-items: end;
  /* Well short of a viewport. This is a reference page; the first
     method should be reachable with one scroll, not three. */
  min-height: min(64svh, 40rem);
  padding-block: clamp(8rem, 18vh, 12rem) clamp(3.5rem, 7vw, 6rem);
}

.page-sdk .sdk-hero__inner {
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
}

.page-sdk .sdk-hero__title {
  max-width: 22ch;
}

.page-sdk .sdk-hero__lead {
  max-width: 56ch;
  color: var(--on-ink);
  border-top: 1px solid var(--rule);
  padding-top: clamp(1.25rem, 2.4vw, 2rem);
}

/* =====================================================================
   Install and the sixty-second version — bone
   ===================================================================== */

.page-sdk .sdk-steps {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-sdk .sdk-step {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  border-top: 1px solid var(--rule);
  padding-top: clamp(1rem, 2vw, 1.5rem);
}

.page-sdk .sdk-step__ordinal {
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--quiet);
}

.page-sdk .sdk-step__code {
  margin-top: 0.25rem;
}

.page-sdk .sdk-step__copy {
  max-width: 46ch;
}

/* The worked example. Prose on the left, the block on the right, so
   the code keeps its full measure rather than being squeezed into a
   column that forces every line to wrap. */
.page-sdk .sdk-sixty {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  margin-top: clamp(3.5rem, 7vw, 6rem);
  border-top: 1px solid var(--rule);
  padding-top: clamp(2rem, 4vw, 3.5rem);
}

.page-sdk .sdk-sixty__aside {
  display: grid;
  gap: clamp(0.75rem, 1.4vw, 1.125rem);
  align-content: start;
}

.page-sdk .sdk-sixty__title {
  max-width: 16ch;
}

.page-sdk .sdk-sixty__copy {
  max-width: 44ch;
}

/* =====================================================================
   Method reference — paper
   ===================================================================== */

/* The record every method resolves to, stated once before the
   methods so none of them has to restate it. */
.page-sdk .sdk-record {
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.page-sdk .sdk-record__note {
  max-width: 62ch;
}

.page-sdk .sdk-methods {
  display: grid;
}

/* One entry: the name on the left, everything you need to use it on
   the right. Hairline-separated rather than boxed, so six of them in
   a column do not read as six cards. */
.page-sdk .sdk-method {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--rule);
  padding-block: clamp(2rem, 4vw, 3.25rem);
}

.page-sdk .sdk-method:last-child {
  border-bottom: 1px solid var(--rule);
}

.page-sdk .sdk-method__id {
  display: grid;
  gap: 0.4rem;
  align-content: start;
}

.page-sdk .sdk-method__name {
  font-size: var(--t-h3);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.page-sdk .sdk-method__detail {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  min-width: 0;
}

.page-sdk .sdk-method__note {
  max-width: 62ch;
}

/* The sentences that stop somebody shipping a bug. Same accent rule
   the landing page gives its processor disclosure. */
.page-sdk .sdk-method__note--marked {
  border-left: 1px solid var(--orchid);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* ---------- option and property lists ---------- */

.page-sdk .sdk-opts {
  display: grid;
  margin: 0;
}

.page-sdk .sdk-opt {
  display: grid;
  gap: 0.5rem;
  border-top: 1px solid var(--rule);
  padding-block: clamp(0.75rem, 1.4vw, 1rem);
}

.page-sdk .sdk-opt:last-child {
  border-bottom: 1px solid var(--rule);
}

.page-sdk .sdk-opt__term {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
}

.page-sdk .sdk-opt__name {
  font-size: var(--t-body);
  font-weight: 600;
}

.page-sdk .sdk-opt__desc {
  margin: 0;
  max-width: 62ch;
  color: var(--quiet);
}

/* ---------- returns / throws ---------- */

.page-sdk .sdk-facts {
  display: grid;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.page-sdk .sdk-facts__term {
  color: var(--quiet);
  padding-top: 0.35em;
}

.page-sdk .sdk-facts__desc {
  margin: 0;
  max-width: 62ch;
}

/* =====================================================================
   The three outcomes — paper
   ===================================================================== */

.page-sdk .sdk-grid {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Outcomes are never told apart by hue. The marker bar is a different
   shape in each state — hairline, solid, dashed — the held card
   carries a fill and the heaviest name in the section, and each
   status is spelled out with its own HTTP code beside it. */
.page-sdk .sdk-outcome {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  border: 1px solid var(--rule);
  padding: clamp(1.25rem, 2.4vw, 2rem);
}

.page-sdk .sdk-outcome__bar {
  display: block;
  height: 0;
  border-top: 3px solid var(--on-paper);
  width: 3.5rem;
  margin-bottom: 0.5rem;
}

.page-sdk .sdk-outcome--executed .sdk-outcome__bar {
  border-top-width: 1px;
  border-top-color: var(--quiet);
}

.page-sdk .sdk-outcome--denied .sdk-outcome__bar {
  border-top-style: dashed;
}

.page-sdk .sdk-outcome--held {
  background: var(--bone);
  border-color: var(--on-paper);
}

.page-sdk .sdk-outcome__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  justify-content: space-between;
}

.page-sdk .sdk-outcome__name {
  font-size: var(--t-lead);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.page-sdk .sdk-outcome--held .sdk-outcome__name {
  font-weight: 700;
}

.page-sdk .sdk-outcome__do {
  margin-top: 0.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.75rem;
}

.page-sdk .sdk-outcome__copy {
  max-width: 42ch;
}

/* The 200-is-not-an-error paragraph. It gets its own block because it
   is the one thing on this page a reader must not skim past. */
.page-sdk .sdk-callout {
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.125rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

.page-sdk .sdk-callout__lead {
  max-width: 24ch;
}

.page-sdk .sdk-callout__copy {
  max-width: 68ch;
}

/* =====================================================================
   Closing — forest
   ===================================================================== */

.page-sdk .sdk-closing {
  display: grid;
  align-items: center;
  padding-block: calc(var(--sec-y) * 1.2);
}

.page-sdk .sdk-closing__inner {
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
}

.page-sdk .sdk-closing__title {
  max-width: 18ch;
}

.page-sdk .sdk-closing__lead {
  max-width: 52ch;
  color: var(--mist);
}

.page-sdk .sdk-nots {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  list-style: none;
  margin: clamp(1rem, 2vw, 1.75rem) 0 0;
  padding: 0;
}

.page-sdk .sdk-not {
  display: grid;
  gap: 0.625rem;
  align-content: start;
  border-top: 1px solid var(--rule);
  padding-top: clamp(0.875rem, 1.6vw, 1.25rem);
}

.page-sdk .sdk-not__title {
  color: var(--orchid);
  margin: 0;
}

.page-sdk .sdk-not__copy {
  max-width: 40ch;
  color: var(--on-forest-quiet);
}

.page-sdk .sdk-closing__cta {
  margin: clamp(1rem, 2vw, 1.75rem) 0 0;
}

/* =====================================================================
   Footer — forest
   ===================================================================== */

.page-sdk .site-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  padding-block: clamp(2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--rule);
}

.page-sdk .site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.page-sdk .site-footer__link {
  text-decoration: none;
  font-size: var(--t-body);
  line-height: 1.4;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
  transition:
    color var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out);
}

.page-sdk .site-footer__link:hover,
.page-sdk .site-footer__link:focus-visible {
  color: var(--orchid);
  border-bottom-color: var(--orchid);
}

/* The page you are already on. Marked, but not styled as a target. */
.page-sdk .site-footer__link[aria-current="page"] {
  border-bottom-color: var(--rule);
}

.page-sdk .site-footer__meta {
  margin: 0;
  color: var(--quiet);
}

/* The one sentence on this page that is a disclosure rather than a
   pitch. Accent rule and full-contrast ink, so it cannot be read as
   fine print. */
.page-sdk .site-footer__note {
  margin: 0;
  max-width: 62ch;
  font-size: var(--t-body);
  line-height: var(--lh-body);
  border-left: 1px solid var(--orchid);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* =====================================================================
   Wider viewports

   One breakpoint per structure, all min-width, so the single-column
   rules above are the base case rather than an override.
   ===================================================================== */

@media (min-width: 48rem) {
  .page-sdk .sdk-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-sdk .sdk-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-sdk .sdk-nots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-sdk .sdk-facts {
    grid-template-columns: 7rem minmax(0, 1fr);
    align-items: baseline;
  }

  .page-sdk .sdk-facts__term {
    padding-top: 0;
  }

  .page-sdk .site-footer__inner {
    grid-template-columns: 1fr auto;
    align-items: baseline;
  }

  .page-sdk .site-footer__meta {
    justify-self: end;
    text-align: right;
  }

  .page-sdk .site-footer__note {
    grid-column: 1 / -1;
  }
}

@media (min-width: 64rem) {
  .page-sdk .sdk-sixty {
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    column-gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
  }

  .page-sdk .sdk-method {
    grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
    column-gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
  }

  .page-sdk .sdk-opt {
    grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
    column-gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: baseline;
  }
}

/* =====================================================================
   Reduced motion

   motion.js binds nothing when the preference is set, and motion.css
   neutralises its own resting states. Only this page's own hover and
   focus transitions are left to switch off.
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .page-sdk .site-footer__link {
    transition: none;
  }
}
