/* Alterspective Agent — landing/landing.css
 *
 * The signed-out surface. Kept in its own stylesheet rather than appended to
 * workbench.css so the marketing surface and the workbench can be changed
 * independently; it inherits every colour, radius, and font token from the
 * :root block in workbench.css and mints none of its own (ADL ship-checklist
 * item 5 — no hex or rgba literals below, only tokens and color-mix over them).
 *
 * Rules leaned on: UX-BRAND-02 (Citrus carries Navy text, never white),
 * UX-BRAND-03 (outlined icons only), UX-BRAND-06 (reversed logo on dark),
 * UX-BRAND-07 (Chronicle Display at 36px and above, Montserrat below),
 * UX-AX-05 contrast, UX-AX-10 / ADL-ENV-02 reduced motion.
 */

/* ── Signed-out shell ────────────────────────────────────────────────────
   The defect this replaces: #landing-page is a child of <main>, and <main> is
   a three-column grid, so the landing page used to render inside the 268px
   sidebar column. Worse, `els.mainContent.hidden = !authed` in app.js could
   not actually hide the workspace, because .workspace carries a CSS `display`
   that outranks the `hidden` attribute — which is why the composer and the
   empty-state headline stayed on screen behind the landing copy.

   So the signed-out state is expressed as a layout, not as an attribute the
   cascade can overrule: one column, and every workbench region held closed. */
body.signed-out main {
  grid-template-columns: 1fr;
  overflow: hidden;
}
body.signed-out #sidebar,
body.signed-out .workspace,
body.signed-out #tool-rail,
body.signed-out #tool-rail-open,
body.signed-out .admin-shell,
body.signed-out .studio-shell {
  display: none !important;
}
body.signed-out .landing[hidden] {
  display: none !important;
}

/* The header's operator controls — activity, learning, Studio, admin, what's
   new, the environment and health pills, the chat toggle — all act on a
   workspace a signed-out visitor does not have. Leaving them on screen is a
   large part of why the signed-out page read as "you are already inside the
   app". Signed out, the chrome is the mark, the version, and the way in. */
body.signed-out header .btn-signin-keystone {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
body.signed-out header .btn-signin-keystone:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--bg-2);
}

body.signed-out #sidebar-btn,
body.signed-out #activity-btn,
body.signed-out #learning-btn,
body.signed-out #studio-btn,
body.signed-out #admin-btn,
body.signed-out #whats-new-btn,
body.signed-out #env-badge,
body.signed-out #health-trigger,
body.signed-out .skip-link {
  display: none !important;
}

/* ── Landing surface ─────────────────────────────────────────────────── */
.landing {
  display: block;
  width: 100%;
  /* The workbench pins <main> to the viewport, so the landing page is its own
     scroll container rather than the document's. Declared explicitly: leaving
     overflow-x:hidden alone would promote overflow-y to auto anyway, and a
     scroll container nobody meant to create is how this page ends up clipped
     the next time someone touches the layout. */
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background:
    radial-gradient(120% 90% at 82% 6%, color-mix(in srgb, var(--as-marine) 34%, transparent) 0%, transparent 62%),
    radial-gradient(90% 70% at 4% 92%, color-mix(in srgb, var(--as-green) 16%, transparent) 0%, transparent 60%),
    var(--bg);
}
.landing[hidden] {
  display: none !important;
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.landing-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center;
  gap: 40px;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(40px, 7vh, 96px) clamp(24px, 5vw, 72px) clamp(48px, 8vh, 104px);
  min-height: min(78vh, 720px);
}

.landing-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.landing-eyebrow {
  margin: 0 0 20px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.landing-eyebrow::before {
  content: '';
  display: inline-block;
  width: 26px;
  height: 1px;
  margin-right: 12px;
  vertical-align: 0.32em;
  background: var(--accent);
}

/* UX-BRAND-07: Chronicle Display is the heading face from 36px up, and this
   never falls below that even on the narrowest supported width. */
.landing-title {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.4vw, 68px);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.015em;
  color: var(--text);
}

.landing-lead {
  margin: 0 0 18px;
  max-width: 33em;
  font-size: 17px;
  line-height: 1.62;
  color: var(--text-dim);
}

.landing-stance {
  margin: 0 0 32px;
  padding-left: 16px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 62%, transparent);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
}

/* ── Actions ─────────────────────────────────────────────────────────── */
.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.2, 0, 0, 1),
              background-color 150ms cubic-bezier(0.2, 0, 0, 1),
              box-shadow 200ms cubic-bezier(0.2, 0, 0, 1);
}

/* UX-BRAND-02 / UX-BRAND-05: Citrus ground takes Navy text, never white.
   10.09:1, measured on the painted pair rather than on the token values —
   getComputedStyle on the rendered button reports rgb(171,221,101) over
   rgb(23,35,45), so no compositing or theme state is altering either side. */
.landing-btn.btn-signin-keystone {
  background: var(--accent);
  color: var(--as-navy);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 22%, transparent);
}
.landing-btn.btn-signin-keystone:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text) 12%);
  transform: translateY(-1px);
}
.landing-btn.btn-signin-keystone:active {
  transform: translateY(0);
}
.landing-btn[hidden] {
  display: none !important;
}
.landing-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.landing-btn-mark {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms cubic-bezier(0, 0, 0.2, 1);
}
.landing-btn:hover .landing-btn-mark {
  transform: translateX(3px);
}

/* Tempo (C11): the press is acknowledged before the federated redirect
   starts, so the click is never silent. */
.landing-btn.is-working {
  opacity: 0.72;
  transform: none;
  cursor: progress;
}

.landing-assurance {
  margin: 0;
  max-width: 46em;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ── The hand-drawn scene ────────────────────────────────────────────── */
.landing-scene {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 940px;
  aspect-ratio: 872 / 512;
  /* Bleeds past the page gutter: a hero that stops politely at a container
     edge reads as a picture, not as a surface. */
  margin-right: calc(-1 * clamp(12px, 3.5vw, 56px));
  /* AIRUN-044 Step 4: the tilt is applied to the element, never baked into
     the path coordinates, so the geometry stays editable and the hand-placed
     feel is tunable per surface. */
  transform: rotate(-3deg);
}
.landing-scene svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.landing-scene [data-flow-layer] {
  transition: transform 400ms cubic-bezier(0, 0, 0.2, 1);
  will-change: transform;
}

/* Every stroke in the scene: one weight family, round caps, no fills — the
   continuous-line house style and UX-BRAND-03's outlined-only rule. */
.flow-field path,
.flow-systems path,
.flow-systems circle,
.flow-figure path,
.flow-thread path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.flow-field path {
  stroke: var(--as-pale-blue);
  stroke-width: 1;
  opacity: 0.09;
}

.flow-systems {
  stroke: var(--as-pale-blue);
  stroke-width: 2.6;
}
.flow-systems path,
.flow-systems circle { stroke: inherit; }
/* Opacity taper — the motif strokes stay subordinate to the figure
   (AIRUN-044 Step 3). */
.flow-glyph { opacity: 0.34; transition: opacity 200ms cubic-bezier(0.2, 0, 0, 1); }
.flow-glyph[data-flow-glyph='mail']      { opacity: 0.40; }
.flow-glyph[data-flow-glyph='matter']    { opacity: 0.34; }
.flow-glyph[data-flow-glyph='draft']     { opacity: 0.30; }
.flow-glyph[data-flow-glyph='knowledge'] { opacity: 0.26; }
/* F1 — signal earns attention: a glyph lights only when the thread has
   actually been pushed onto it, never on its own. */
.flow-glyph.is-touched {
  opacity: 0.92;
  stroke: var(--accent);
}

.flow-figure-line {
  stroke: var(--as-pale-blue);
  stroke-width: 4.4;
  opacity: 0.82;
}

.flow-thread-line {
  stroke: var(--accent);
  stroke-width: 4.6;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 26%, transparent));
}
/* The work travelling the thread. Both are driven from JS (inline opacity),
   so they stay invisible until the loop actually runs — which it never does
   under reduced motion or with no JS. */
.flow-thread-comet {
  stroke: color-mix(in srgb, var(--accent) 52%, var(--text) 48%);
  stroke-width: 5.4;
  stroke-linecap: round;
  stroke-dasharray: 7 93;
  opacity: 0;
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 60%, transparent));
}
.flow-thread-spark {
  fill: color-mix(in srgb, var(--accent) 30%, var(--text) 70%);
  stroke: none;
  opacity: 0;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 78%, transparent));
}

/* Only one of the pair is ever painted: `rest` while the line draws itself
   on, `live` once the simulation owns the geometry. */
.flow-thread-live { opacity: 0; }
.landing-scene.is-live .flow-thread-rest { opacity: 0; }
.landing-scene.is-live .flow-thread-live { opacity: 1; }
.landing-scene.is-static .flow-thread-rest { opacity: 1; }

/* ── Entrance: the line draws itself ─────────────────────────────────── */
/* pathLength="100" normalises the dash maths, so the geometry can change
   without recomputing the dash array. */
@keyframes flow-draw {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}
@keyframes flow-fade-in {
  from { opacity: 0; }
}
.landing-scene.is-drawing .flow-figure-line,
.landing-scene.is-drawing .flow-thread-rest {
  stroke-dasharray: 100;
  animation: flow-draw 1400ms cubic-bezier(0.2, 0, 0, 1) backwards;
}
.landing-scene.is-drawing .flow-thread-rest { animation-delay: 620ms; }
.landing-scene.is-drawing .flow-glyph {
  animation: flow-fade-in 500ms cubic-bezier(0, 0, 0.2, 1) backwards;
}
.landing-scene.is-drawing .flow-glyph[data-flow-glyph='mail']      { animation-delay: 1500ms; }
.landing-scene.is-drawing .flow-glyph[data-flow-glyph='matter']    { animation-delay: 1640ms; }
.landing-scene.is-drawing .flow-glyph[data-flow-glyph='draft']     { animation-delay: 1780ms; }
.landing-scene.is-drawing .flow-glyph[data-flow-glyph='knowledge'] { animation-delay: 1920ms; }

/* ── Entrance: the copy settles in while the line draws ──────────────── */
@keyframes landing-rise {
  from { opacity: 0; transform: translateY(14px); }
}
.landing-copy > * {
  animation: landing-rise 620ms cubic-bezier(0, 0, 0.2, 1) backwards;
}
.landing-copy > :nth-child(1) { animation-delay: 60ms; }
.landing-copy > :nth-child(2) { animation-delay: 150ms; }
.landing-copy > :nth-child(3) { animation-delay: 260ms; }
.landing-copy > :nth-child(4) { animation-delay: 350ms; }
.landing-copy > :nth-child(5) { animation-delay: 440ms; }
.landing-copy > :nth-child(6) { animation-delay: 520ms; }
.landing-copy > :nth-child(7) { animation-delay: 580ms; }

/* ── Body sections ───────────────────────────────────────────────────── */
.landing-body {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 72px) 72px;
}

.landing-section-title {
  margin: 0 0 28px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-section { padding-top: 24px; }

.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-card {
  padding: 28px 26px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-2) 86%, transparent);
  transition: border-color 200ms cubic-bezier(0.2, 0, 0, 1),
              transform 200ms cubic-bezier(0.2, 0, 0, 1);
}
.landing-card:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  transform: translateY(-2px);
}

/* UX-BRAND-03: outlined marks only, at the brand's 1.5 stroke weight. */
.landing-card-mark {
  width: 34px;
  height: 34px;
  margin-bottom: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.landing-card h4 {
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.landing-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.62;
  color: var(--text-muted);
}
.landing-card-proof {
  margin-top: 16px !important;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px !important;
  color: var(--text-dim) !important;
}
.landing-card-proof span {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Flow programme ──────────────────────────────────────────────────── */
.landing-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 40px 56px;
  margin-top: 72px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}
.landing-flow .landing-section-title { grid-column: 1 / -1; margin-bottom: 4px; }

.landing-quote {
  margin: 0;
  padding: 0;
}
.landing-quote p {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(21px, 2.1vw, 27px);
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
}
.landing-quote footer a {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.landing-quote footer a:hover { border-bottom-color: var(--accent); }
.landing-quote footer a:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.landing-conditions {
  margin: 0;
  padding: 0;
  list-style: none;
  align-self: center;
}
.landing-conditions li {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
}
.landing-conditions li:last-child { border-bottom: 0; }
.landing-condition-index {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  padding-top: 2px;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.landing-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
/* UX-BRAND-01: left-aligned, never centred. UX-BRAND-04: no effects on the
   logo. UX-BRAND-06: the reversed mark, because this ground is Navy. */
.landing-foot-logo { height: 24px; width: auto; }
.landing-foot-note { margin: 0; font-size: 12px; color: var(--text-muted); }
.landing-last-updated { margin: 16px 0 0; font-size: 12px; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .landing-hero {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
  }
  /* Keep the task and its primary action ahead of the decorative scene. */
  .landing-scene {
    justify-self: center;
    max-width: 520px;
    margin-bottom: 8px;
  }
  .landing-copy { max-width: none; }
  .landing-flow { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 640px) {
  .landing-scene { max-width: 400px; }
  .landing-title { font-size: clamp(36px, 9vw, 44px); }
  .landing-lead { font-size: 16px; }
  .landing-btn { width: 100%; justify-content: center; }
}

/* ── Motion and transparency policy ──────────────────────────────────── */
/* UX-AX-10 / ADL-ENV-02. landing.js also refuses to start its animation loop
   at all under this query, so the guarantee does not rest on CSS alone. */
@media (prefers-reduced-motion: reduce) {
  .landing *,
  .landing *::before,
  .landing *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .landing-scene { transform: rotate(-3deg); }
  .landing-scene [data-flow-layer] { transform: none !important; will-change: auto; }
  .flow-thread-rest { opacity: 1; }
  .flow-thread-live { opacity: 0; }
  .flow-thread-comet,
  .flow-thread-spark { opacity: 0 !important; }
}

/* ADL-GLASS: the hero's atmospheric wash is decoration, so it goes when a
   person has asked for less of it. */
@media (prefers-reduced-transparency: reduce) {
  .landing { background: var(--bg); }
  .landing-card { background: var(--bg-2); }
  .flow-thread-line { filter: none; }
}
