/* ==========================================================================
   daniyal.md — landing page
   Every value below resolves to a design-system token. No raw hex, no
   one-off durations, no easing curves that aren't in effects.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
p { margin: 0; }

::selection {
  background: var(--accent-green-soft);
  color: var(--ink-900);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   2. Page shell
   Three rows: top chrome / centred stage / bottom chrome. The stage takes
   the remaining height so the composition stays optically centred at any
   viewport size without magic numbers.
   -------------------------------------------------------------------------- */

.page {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100%;
  min-height: 100svh;
  isolation: isolate;
}

/* The one soft surface on the page. It is a paper-to-paper bloom — the same
   warm hue at two lightness steps — so it reads as light falling on stock,
   not as a colour gradient. It breathes on a 24s cycle, slow enough that you
   register it as depth rather than as motion. */
.page__bloom {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      58% 52% at 50% 40%,
      var(--paper-raised) 0%,
      rgba(252, 251, 247, 0) 70%
    );
  animation: bloom-breathe 24s var(--ease-standard) infinite;
  will-change: opacity, transform;
}

@keyframes bloom-breathe {
  0%, 100% { opacity: 0.7;  transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.05); }
}

/* --------------------------------------------------------------------------
   3. Chrome — editor-style metadata rails, top and bottom
   -------------------------------------------------------------------------- */

.chrome {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-8);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  line-height: 1;
}

/* Path and status sit left, version and contact right — top and bottom rails
   mirror each other, the way editor chrome does. */
.chrome--top,
.chrome--bottom { justify-content: space-between; }

.chrome--bottom { border-top: 1px solid var(--border-hairline); }

.path,
.status,
.contact,
.version { display: inline-flex; align-items: center; gap: 6px; }

.path__seg    { color: var(--ink-300); }
.path__sep    { color: var(--ink-150); }
.path__seg--current { color: var(--ink-500); }

.status__key  { color: var(--ink-300); }
.contact__key { color: var(--ink-300); }

/* Status pill, borrowed from the design system's Badge in the green tone. */
.status__value {
  padding: 3px 8px;
  border: 1px solid var(--accent-green-soft);
  border-radius: var(--radius-pill);
  background: var(--accent-green-soft);
  color: var(--accent-green-strong);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.version { color: var(--ink-300); }

/* The one link on the page. --ink-700 makes it the darkest thing in the rail,
   so it is unmistakably findable, while still sitting well below the ink-900
   status line in the hierarchy. The hairline underline carries the affordance
   so it never depends on colour alone. */
.contact__link {
  /* 12px of type is a 12px tap target. The padding grows the hit area past the
     24px WCAG 2.5.8 floor and the negative margin gives the space back to the
     layout, so nothing moves. */
  display: inline-block;
  padding-block: var(--space-2);
  margin-block: calc(var(--space-2) * -1);

  color: var(--ink-700);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition:
    color var(--duration-base) var(--ease-standard),
    text-decoration-color var(--duration-base) var(--ease-standard);
}

.contact__link:hover {
  color: var(--accent-green);
  text-decoration-color: var(--accent-green);
}

/* Hover states darken one step and never fill — the system's rule. */
.path,
.version {
  transition: color var(--duration-base) var(--ease-standard);
}

.path:hover .path__seg,
.path:hover .path__seg--current { color: var(--ink-500); }
.path:hover .path__sep          { color: var(--ink-300); }
.version:hover                  { color: var(--ink-500); }

.path__seg,
.path__sep {
  transition: color var(--duration-base) var(--ease-standard);
}

/* --------------------------------------------------------------------------
   4. Stage + boot column
   -------------------------------------------------------------------------- */

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-8);
  min-height: 0;
}

.boot {
  width: 100%;
  max-width: 560px;
}

/* Reveal primitive. JS flips [data-reveal] elements to .is-in; the transition
   lives here so motion stays declarative and reduced-motion can neutralise it
   in one place. */
.boot [data-reveal],
.chrome [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

.boot [data-reveal].is-in,
.chrome [data-reveal].is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* --------------------------------------------------------------------------
   5. Wordmark
   -------------------------------------------------------------------------- */

.wordmark {
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  font-size: clamp(2.25rem, 9vw, 4rem);   /* 36px → 64px, --text-3xl → --text-5xl */
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
  color: var(--ink-900);
  margin-bottom: var(--space-8);
  width: max-content;
  max-width: 100%;
}

.wordmark__ext {
  color: var(--ink-300);
  transition: color var(--duration-base) var(--ease-standard);
}

.wordmark:hover .wordmark__ext { color: var(--accent-green); }

/* --------------------------------------------------------------------------
   6. Lines
   -------------------------------------------------------------------------- */

.line {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: clamp(0.875rem, 2.6vw, 1rem); /* 14px → 16px */
  line-height: var(--leading-snug);
  min-height: 1.35em;                      /* holds the row before text lands */
}

.line__prompt {
  color: var(--accent-green);
  font-weight: var(--weight-medium);
  flex-shrink: 0;
}

.line__body {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
}

.line--compile { color: var(--ink-500); }

.line--final {
  color: var(--ink-900);
  font-weight: var(--weight-medium);
}

/* Editor caret that trails the text as it types, then retires. */
.caret {
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 2px;
  background: var(--ink-700);
  opacity: 0;
  transform: translateY(0.14em);
  transition: opacity var(--duration-fast) var(--ease-standard);
}

.caret.is-on { opacity: 1; }

/* Resting cursor. A soft ease rather than a hard step — it should pulse, not
   flicker. */
.cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--ink-700);
}

.cursor.is-blinking {
  animation: cursor-blink 1.15s var(--ease-standard) infinite;
}

@keyframes cursor-blink {
  0%, 42%   { opacity: 1; }
  58%, 92%  { opacity: 0; }
  100%      { opacity: 1; }
}

/* --------------------------------------------------------------------------
   7. Build indicator
   A 2px hairline that sweeps left to right — the same gesture as the design
   system's file-parse scan line. It fades out but keeps its box, so the
   final line never shifts position.
   -------------------------------------------------------------------------- */

.build {
  position: relative;
  height: 2px;
  margin: var(--space-4) 0 var(--space-6);
  border-radius: var(--radius-pill);
  background: var(--border-hairline);
  opacity: 0;
  overflow: hidden;
  transition: opacity var(--duration-base) var(--ease-standard);
}

.build.is-on { opacity: 1; }

.build__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent-green);
  transform: scaleX(0);
  transform-origin: left center;
}

/* Linear, not one of the eased tokens. Both --ease-out and --ease-standard are
   decelerate curves built for entrances: they put 65–75% of the sweep in the
   first fifth of the run, so the bar snaps and then crawls. A determinate
   progress fill has to move at a constant rate to read as work being done.
   The system sanctions linear for exactly this kind of transition. */
.build__fill.is-running {
  transition: transform var(--build-duration, 1000ms) linear;
  transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   8. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .chrome { padding: var(--space-5) var(--space-6); }
  .stage  { padding: var(--space-6); }
}

@media (max-width: 600px) {
  .chrome {
    padding: var(--space-4) var(--space-5);
    font-size: 11px;
  }
  .stage { padding: var(--space-5); }

  /* `status: wip` and the email won't share a 375px row at any honest size,
     so the bottom rail stacks instead of shrinking the type. */
  .chrome--bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .wordmark { margin-bottom: var(--space-7); }

  .build { margin: var(--space-3) 0 var(--space-5); }
}

/* Short landscape viewports — keep the column from crowding the rails. */
@media (max-height: 480px) {
  .chrome   { padding-block: var(--space-3); }
  .wordmark { margin-bottom: var(--space-6); }
  .build    { margin: var(--space-3) 0 var(--space-4); }
}

/* --------------------------------------------------------------------------
   9. Reduced motion — show the finished state, hold the cursor steady
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .page__bloom { animation: none; opacity: 0.85; }

  .boot [data-reveal],
  .chrome [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Hidden, but it keeps its box so the vertical rhythm matches the
     animated version exactly. */
  .build {
    visibility: hidden;
    opacity: 0;
    transition: none;
  }

  .caret { display: none; }

  .cursor,
  .cursor.is-blinking {
    opacity: 1;
    animation: none;
  }

  .wordmark__ext,
  .path__seg,
  .path__sep,
  .version,
  .contact__link { transition: none; }
}
