/* IndexLark hero: a depth field.
   Answers, engine tiles and work notes sit at four depths around the copy. Far
   objects are smaller, softer and quieter; the live card (with the lark perched on
   it) is the one object in focus. Positions are art-directed per layout:
     editorial >= 1200px  aligned headline on a staff, the engines as its notes,
                          live card right; no floating field
     split    861-1199px  copy left, live card right, a few objects on the edges
     phone    <= 860px    copy, then the live card; four small objects beside the lark
   Motion (hero.js) is transform and opacity only. Quillbase is a made-up company. */

.hero {
  --h-tile: #173C31; --h-tile-ink: #EEF2F0;
  --h-night: #0E1A16; --h-night-ink: #EEF2F0; --h-night-mute: #B9C9C0;
  --h-glow: rgba(255,255,255,.94);
  --live-w: 21rem;
  position: relative; isolation: isolate; overflow: clip;
  padding: calc(var(--bar) + 28px) var(--gutter) 40px;
  background: radial-gradient(54% 58% at var(--glow-x, 50%) 47%, var(--h-glow), transparent 72%), var(--fog);
}
html[data-theme="dark"] .hero { --h-tile: #1F5445; --h-night: #173027; --h-glow: rgba(23,60,49,.62); background: radial-gradient(54% 58% at var(--glow-x, 50%) 47%, var(--h-glow), transparent 72%), var(--fog); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .hero { --h-tile: #1F5445; --h-night: #173027; --h-glow: rgba(23,60,49,.62); background: radial-gradient(54% 58% at var(--glow-x, 50%) 47%, var(--h-glow), transparent 72%), var(--fog); }
}

/* ------------------------------------------------------------------ the copy */
.hero__stage { position: relative; z-index: 2; }
.hero__copy { position: relative; }
.hero h1 { font-weight: 660; font-size: clamp(2.25rem, 10.2vw, 3.75rem); line-height: 0.98; letter-spacing: -0.03em; }
.h1__l { display: block; }
.hero h1 mark {
  display: inline-block; background: var(--citrus); color: var(--ink);
  padding: 0.02em 0.16em 0.07em; margin-top: 0.12em;
  border: 1.5px solid var(--ink); border-radius: 6px;
  transform: rotate(-1.2deg);
}
/* the engine name retypes with the live card's active tab */
.h1__eng { white-space: nowrap; }
.h1__eng.is-typing::after { content: ""; display: inline-block; width: .06em; height: .78em; margin-left: .04em; background: currentColor; vertical-align: -.04em; }
.hero__dek { margin-top: var(--s5); max-width: 34em; font-size: clamp(1.125rem, 1.02rem + 0.35vw, 1.3125rem); line-height: 1.42; color: var(--ink); }
.hero__act { margin-top: var(--s5); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }
.hero__terms { margin-top: var(--s4); font-size: 16px; line-height: 1.45; color: var(--slate); }
.textpete--hero { margin-top: var(--s5); gap: 12px; text-align: left; }
.textpete--hero img { width: 48px; height: 48px; }
.textpete--hero p { font-size: 16px; }
.textpete--hero .textpete__q { font-size: 14px; }

/* ------------------------------------------------- the live card, in focus */
.hero__focus { position: relative; z-index: 3; font-size: 14px; }
.hero__live { position: relative; width: 100%; padding-top: .45em; box-shadow: var(--e3); }
/* The lark perches on the card's top-left corner. Only the bird takes the pointer,
   so the empty foot of its box never covers the engine tabs. */
.hero .ans__lark { position: absolute; z-index: 2; width: 14.5em; height: 14.5em; left: -.7em; right: auto; bottom: calc(100% - 2.96em); pointer-events: none; }
.hero .ans__lark .lark__bird { pointer-events: auto; }
.hero .ans__lark .lark__notes { transform: scale(.55); transform-origin: 800px 300px; }

/* ---------------------------------------------------------------- the field */
.field { position: absolute; inset: 0; z-index: 1; pointer-events: none; font-size: clamp(11.5px, .96vw, 17px); }
.fo { position: absolute; left: var(--x); top: var(--y); width: var(--w); translate: -50% -50%; }
.fo__b { rotate: var(--r, 0deg); scale: var(--s, 1); opacity: var(--o, 1); }
/* depth: scale, softness, quietness */
.fo--z1 { z-index: 4; --bob: 9px; }
.fo--z2 { z-index: 3; --s: .82; --o: .97; --bob: 7px; }
.fo--z2 .fo__b { filter: blur(.7px); }
.fo--z3 { z-index: 2; --s: .6; --o: .86; --bob: 5px; }
.fo--z3 .fo__b { filter: blur(2.4px); }
.fo--z4 { z-index: 1; --s: .48; --o: .7; --bob: 4px; }
.fo--z4 .fo__b { filter: blur(5px); }

.js .fo { animation: fo-in 900ms var(--ease) calc(80ms + var(--i, 0) * 55ms) both; }
.js .fo__b { animation: fo-bob calc(8s + var(--i, 0) * .55s) ease-in-out calc(var(--i, 0) * -1.7s) infinite; }
.js .hero__focus { animation: fo-in 900ms var(--ease) 260ms both; }
.hero.is-away .fo__b { animation-play-state: paused; }
@keyframes fo-in { from { opacity: 0; scale: .94; } to { opacity: 1; scale: 1; } }
@keyframes fo-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 calc(var(--bob, 6px) * -1); } }

/* answer sheets */
.fcard { background: var(--white); color: var(--ink); border: 1px solid rgba(14,26,22,.07); border-radius: var(--r-sheet); padding: 1.05em 1.2em 1em; box-shadow: var(--e2); }
.fo--z1 .fcard { box-shadow: var(--e3); }
.fcard__eng { display: flex; align-items: center; gap: .55em; margin-bottom: .7em; font: 600 .8em/1.2 var(--sc-font-mono); letter-spacing: .02em; color: var(--slate); }
.fcard__eng .ico { font-size: 1.25em; color: var(--ink); }
.fcard__q { font: 640 1.12em/1.16 var(--sc-font-display); letter-spacing: -0.022em; }
.fcard__a { margin-top: .5em; line-height: 1.42; color: var(--slate); }
.fcard mark { background: var(--citrus); color: var(--ink); font-weight: 650; padding: 0 .22em; border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--ink); }
.fcard__src { margin-top: .5em; font: 500 .76em/1.3 var(--sc-font-mono); color: var(--forest); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; overflow-wrap: anywhere; }
.fcard__foot { margin-top: .8em; padding-top: .65em; border-top: 1px solid var(--line); }
.field .st { font-size: max(.72em, 9px); line-height: 1.3; gap: .6em; }
.field .st::before { width: .8em; height: .8em; }
html[data-theme="dark"] :is(.fcard, .fchip, .fspark) { border-color: rgba(255,255,255,.09); }
@media (prefers-color-scheme: dark) { html:not([data-theme]) :is(.fcard, .fchip, .fspark) { border-color: rgba(255,255,255,.09); } }

/* engine tiles, and the lark's own */
.ftile { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 24%; background: var(--h-tile); color: var(--h-tile-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 0 0 1px rgba(255,255,255,.05), var(--e3); }
.ftile .ico { width: 50%; height: 50%; }
.ftile--lark svg { width: 80%; height: 80%; fill: currentColor; }

/* the fix, as a diff */
.fdiff { background: var(--h-night); color: var(--h-night-ink); border: 1px solid rgba(255,255,255,.07); border-radius: var(--r-sheet); padding: .9em 1em 1em; font: 500 .84em/1.5 var(--sc-font-mono); box-shadow: var(--e3); }
.fdiff p { white-space: nowrap; }
.fdiff__file { margin-bottom: .55em; font-size: .88em; color: var(--h-night-mute); }
.fdiff__del, .fdiff__add { padding: .12em .6em; border-radius: 3px; }
.fdiff__del { color: var(--h-night-mute); text-decoration: line-through; text-decoration-color: rgba(185,201,192,.7); }
.fdiff__add { margin-top: .2em; background: rgba(213,232,106,.16); box-shadow: inset 2px 0 0 var(--citrus); }

/* a note from Pete */
.fmsg { display: grid; grid-template-columns: 2.5em minmax(0, 1fr); gap: .75em; align-items: center; background: var(--h-night); color: var(--h-night-ink); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; padding: .8em 1em .85em .85em; line-height: 1.3; box-shadow: var(--e2); }
.fmsg img { width: 2.5em; height: 2.5em; border-radius: .5em; object-fit: cover; }
.fmsg b { display: block; font-weight: 700; }

/* the Monday report: a line, no figures */
.fspark { background: var(--white); color: var(--ink); border: 1px solid rgba(14,26,22,.07); border-radius: var(--r-sheet); padding: .85em 1em .9em; box-shadow: var(--e2); }
.fspark svg { width: 100%; height: auto; aspect-ratio: 160 / 46; margin-top: .7em; overflow: visible; }
.fspark__grid { fill: none; stroke: var(--line); stroke-width: 1; }
.fspark__line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.fspark circle { fill: var(--white); stroke: var(--ink); stroke-width: 2.5; }

/* evidence chips */
.fo:has(> .fo__b > .fchip) { width: auto; }
.fchip { display: inline-flex; background: var(--white); color: var(--ink); border: 1px solid rgba(14,26,22,.08); border-radius: var(--r-ctl); padding: .6em .85em; box-shadow: var(--e2); font-size: 1.1em; }

/* =================================================== centred: 1200px and up */
@media (min-width: 861px) {
  .hero {
    min-height: max(calc(100svh - 56px), 660px);
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--bar) + clamp(24px, 4.5vh, 64px)) var(--gutter) clamp(64px, 9vh, 112px);
  }
  .hero__stage { width: 100%; }
  .hero__focus { position: absolute; width: var(--live-w); font-size: calc(var(--live-w) / 23.5); }
}
/* staff: five lines behind the headline's first line; the engines sit on it as notes */
.hstaff { display: none; }

/* ============================================== editorial: 1200px and up
   Aligned headline on the left, its first line written on a staff with the
   five engines as its notes; the live card stands at the right, the lark on
   its corner singing back at the headline. A few far objects stay as depth. */
@media (min-width: 1200px) {
  .hero {
    --h1: clamp(3.75rem, min(6.9vw, 11.2vh), 7.25rem);
    --indent: calc(var(--h1) * 1.08);
    --live-w: clamp(19.5rem, 25vw, 27rem);
    --glow-x: 36%;
  }
  .hero__stage { max-width: var(--maxw); margin-inline: auto; }
  .hero__copy { display: block; text-align: left; }
  .hero h1 { font-size: var(--h1); line-height: 0.98; position: relative; z-index: 1; }
  .hero h1 .h1__l { padding-inline-start: var(--indent); }
  .hero h1 mark { transform-origin: 0 100%; margin-left: -0.1em; }
  .hero__copy > :not(h1):not(.hstaff) { margin-left: var(--indent); }
  .hero__dek { margin-top: var(--s6); max-width: 31em; }
  .hero__act { margin-top: var(--s6); }
  .hero__terms { max-width: 32em; }

  .hstaff {
    display: block; position: absolute; z-index: 0; top: calc(var(--h1) * -.3); height: calc(var(--h1) * 1.6);
    left: calc((100% - 100vw) / 2); right: calc((100% - 100vw) / 2);
    font-size: var(--h1);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  }
  .hstaff i { position: absolute; left: 0; right: 0; height: 1px; background: var(--mist); }
  html[data-theme="dark"] .hstaff i { background: var(--line); }
  .hstaff i:nth-child(1) { top: .46em; } .hstaff i:nth-child(2) { top: .63em; } .hstaff i:nth-child(3) { top: .8em; }
  .hstaff i:nth-child(4) { top: .97em; } .hstaff i:nth-child(5) { top: 1.14em; }
  /* the notes: centred on a line or a space, rising left to right */
  .hstaff__n {
    position: absolute; width: .52em; height: .52em; translate: -50% -50%;
    --sw: min(var(--maxw), 100vw - 2 * var(--gutter));
    /* Leave room for the longest animated engine name at large type sizes. */
    --first-note: max(var(--sw) * 0.6, var(--indent) + var(--h1) * 6.25);
    left: calc(50% - var(--sw) / 2 + var(--first-note) + (var(--sw) * 0.94 - var(--first-note)) * var(--p) / 4);
    top: calc((var(--y) + .3) * 1em);
    display: grid; place-items: center; border-radius: 26%;
    background: var(--h-tile); color: var(--h-tile-ink);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), var(--e2);
  }
  .hstaff__n .ico { width: 46%; height: 46%; }
  .js .hstaff__n { animation: note-in 700ms var(--ease) calc(420ms + var(--p) * 110ms) both; }
  .js .hstaff__n .ico { animation: note-bob 6s ease-in-out calc(var(--p) * -1.2s) infinite; }
  .hero.is-away .hstaff__n .ico { animation-play-state: paused; }

  /* the live card: right, the lark mirrored on its top-right corner */
  .hero__focus { right: 0; bottom: 0; }
  .hero .ans__lark { left: auto; right: -.7em; }
  .hero .ans__lark .lark { transform: scaleX(-1); }

  /* the staff carries the depth here; the floating field is for narrower layouts */
  .field { display: none; }
}
@keyframes note-in { from { opacity: 0; translate: -50% 10%; } to { opacity: 1; translate: -50% -50%; } }
@keyframes note-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -2px; } }

/* ================================================= split: 861px to 1199px */
@media (min-width: 861px) and (max-width: 1199px) {
  .hero { --live-w: clamp(19.5rem, 30vw, 22rem); --gap: clamp(24px, 4vw, 56px); --glow-x: 30%; }
  .hero__copy { max-width: calc(100% - var(--live-w) - var(--gap)); }
  .hero h1 { font-size: clamp(2.5rem, min(5.3vw, 9.4vh), 4rem); line-height: 0.96; }
  .hero h1 mark { margin-left: -0.08em; transform-origin: 0 100%; }
  .hero__focus { right: 0; top: 50%; translate: 0 -38%; }

  .fo--a-claude, .fo--a-pplx, .fo--a-gemini, .fo--t-pplx, .fo--c-accurate, .fo--c-named { display: none; }
  .fo--spark      { --x: 79%;   --y: 11.5%; --w: 11em;  --r: -3deg; }
  .fo--t-gemini   { --x: 94.5%; --y: 13%;   --w: 4.2em; --r: -8deg; }
  .fo--c-cited    { --x: 64%;   --y: 13%;   --r: -4deg; }
  .fo--diff       { --x: 81%;   --y: 89%;   --w: 17em;  --r: 3deg; }
  .fo--t-openai   { --x: 63.5%; --y: 93%;   --w: 4.6em; --r: 9deg; }
  .fo--t-lark     { --x: 97%;   --y: 80%;   --w: 4.2em; --r: -6deg; }
  .fo--msg        { --x: 42%;   --y: 100%;  --w: 17em;  --r: -2deg; }
  .fo--a-google   { --x: 12%;   --y: 101%;  --w: 17em;  --r: 2deg; }
  .fo--t-claude   { --x: 54%;   --y: 9.5%;  --w: 5em;   --r: -10deg; }
  .fo--t-google   { --x: 99%;   --y: 97%;   --w: 4.4em; --r: -5deg; }
}

/* ======================================================= phone: up to 860px */
@media (max-width: 860px) {
  .hero { display: grid; grid-template-columns: minmax(0, 1fr); --glow-x: 30%; }
  .hero__stage { display: contents; }
  .hero__copy { grid-area: 1 / 1; z-index: 2; }
  .h1__l { display: inline; }
  .h1__l:first-child, .h1__l:last-child { display: block; }
  .hero h1 mark { margin-left: -0.08em; transform-origin: 0 100%; }
  /* the lark stands 9em tall on the card: leave it room above */
  .hero__focus { grid-area: 2 / 1; padding-top: 112px; font-size: 13.5px; }
  .hero .ans__lark { width: 9em; height: 9em; left: .2em; bottom: calc(100% - 1.85em); }
  .field { grid-area: 2 / 1; position: relative; inset: auto; margin-inline: calc(var(--gutter) * -1); font-size: 12px; }
  .fo { display: none; }
  .fo--t-gemini, .fo--t-claude, .fo--c-cited, .fo--diff { display: block; }
  .fo--t-gemini { --x: 72%;  --y: 52px;  --w: 3.8em; --r: -8deg; }
  .fo--t-claude { --x: 96%;  --y: 96px;  --w: 4.6em; --r: 10deg; }
  .fo--c-cited  { --x: 88%;  --y: 20px;  --r: 4deg; }
  .fo--diff     { --x: 82%;  --y: calc(100% + 6px); --w: 15em; --r: -2deg; }
}

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .js .fo, .js .fo__b, .js .hero__focus, .js .hstaff__n, .js .hstaff__n .ico { animation: none; }
  .h1__eng.is-typing::after { display: none; }
}

@media print { .field { display: none; } }
