/* ==========================================================================
   nirhason.com/challenge — ARACHNE
   Loaded after styles.css and built on the same tokens. The one deliberate
   break from the site's design language is the console itself: this is the
   single place where the black-terminal cliché is the correct answer, because
   it is not decoration here, it is the interface.
   ========================================================================== */

/* ── Terminal palette. Fixed in both colour schemes — a terminal that
      repaints itself white in light mode is nobody's idea of a terminal. ── */
:root {
  --t-bg:     #070C14;
  --t-bar:    #101A28;
  --t-fg:     #C7D5E5;   /* 14.9:1 on --t-bg */
  --t-dim:    #7F93AB;   /*  5.6:1 — AA for the secondary lines */
  --t-teal:   #2FD3C4;
  --t-amber:  #F0C070;
  --t-red:    #FF8A75;
  --t-line:   #1E2C3E;
}

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

.topbar__home { text-decoration: none; }
.topbar__nav a[aria-current="page"] { color: var(--teal); border-bottom-color: var(--teal); }

/* ── Brief header ───────────────────────────────────────────────────────── */

.chal-hero {
  background: var(--navy);
  color: var(--on-navy);
  padding-block: clamp(2.75rem, 7vw, 4.5rem) clamp(2.5rem, 6vw, 4rem);
  position: relative;
  overflow: hidden;
}
.chal-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 2.75rem);
  mask-image: linear-gradient(to bottom, transparent, #000 55%, transparent);
}
.chal-hero .wrap { position: relative; z-index: 1; }

.chal-hero__name {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 122%;
  font-size: clamp(2.75rem, 11vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

.chal-hero__lede {
  max-width: 46ch;
  font-size: clamp(1.0625rem, 2.1vw, 1.3125rem);
  line-height: 1.5;
  text-wrap: balance;
}

.chal-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin-top: 1.6rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--on-navy-2);
}
.chal-hero__meta b { color: var(--teal); font-weight: 500; }

.chal-hero__cta { margin-top: clamp(1.75rem, 3.5vw, 2.25rem); }

/* ── Brief note ─────────────────────────────────────────────────────────── */

.chal-brief { padding-block: clamp(2.25rem, 5vw, 3.25rem) 0; }
.chal-brief__second { margin-top: 0.85rem; }
.chal-brief .row--note .row__body p { max-width: 66ch; color: var(--slate); }

/* ── Status strip ───────────────────────────────────────────────────────── */

.chal-console { padding-block: clamp(1.75rem, 4vw, 2.5rem) clamp(3rem, 7vw, 5rem); }

.chal-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.85rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
}
.chal-status__label { color: var(--teal-ink); }
.chal-status__count { color: var(--ink); letter-spacing: 0.06em; }
/* No opacity here on purpose: --slate is picked to sit exactly at AA on
   this ground, and fading it would put it under. */
.chal-status__hint {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0.02em;
}

.chips { display: inline-flex; gap: 0.3rem; }
.chip {
  width: 1.55rem;
  height: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: transparent;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.chip--on { background: var(--teal-ink); border-color: var(--teal-ink); }

/* ── The console ────────────────────────────────────────────────────────── */

.term {
  border: 1px solid var(--t-line);
  border-radius: var(--radius);
  background: var(--t-bg);
  overflow: hidden;
  box-shadow: 0 18px 48px -28px rgba(4, 10, 20, 0.85);
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: var(--t-bar);
  border-bottom: 1px solid var(--t-line);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--t-dim);
}
.term__dots { display: inline-flex; gap: 0.35rem; }
.term__dots i {
  width: 0.55rem; height: 0.55rem;
  border-radius: 50%;
  background: #24354a;
}
.term__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term__badge {
  margin-left: auto;
  padding: 0.15rem 0.45rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: var(--t-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.term__body {
  height: clamp(24rem, 62vh, 40rem);
  overflow-y: auto;
  overflow-x: auto;
  padding: 0.9rem clamp(0.75rem, 2vw, 1.15rem) 1.15rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--t-fg);
  scrollbar-color: #2b3d54 transparent;
}

.tl { white-space: pre; min-height: 1.55em; }
.tl--echo  { color: var(--t-teal); }
.tl--dim   { color: var(--t-dim); }
.tl--err   { color: var(--t-red); }
.tl--ok    { color: var(--t-amber); }
.tl__flag  { color: var(--t-amber); font-weight: 500; }

.term__form { display: flex; align-items: baseline; }
.term__prompt {
  flex: none;
  white-space: pre;
  color: var(--t-teal);
  cursor: text;
}
.term__input {
  flex: 1 1 auto;
  min-width: 4rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--t-fg);
  font: inherit;
  caret-color: var(--t-teal);
}
.term__input:focus { outline: none; }
.term__body:focus-within { box-shadow: inset 0 0 0 1px rgba(47, 211, 196, 0.28); }

/* The rest of this site works with JS off; this page cannot, and says so
   rather than presenting an input box that silently does nothing. */
.term__noscript {
  margin-bottom: 0.85rem;
  padding: 1rem 1.15rem;
  max-width: 62ch;
  border: 1px solid var(--line);
  border-left: 2px solid var(--amber);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--slate);
  font-size: 0.9375rem;
}

.term__legend {
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--slate);
}
.term__legend code { font-size: 1em; }

kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--surface);
}

/* ── Prose code ─────────────────────────────────────────────────────────── */

code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--ink);
}

.mail--inline {
  font-size: 0.875rem;
  padding: 0.2rem 0.5rem;
  vertical-align: baseline;
}

.chal-fineprint {
  margin-top: clamp(2rem, 4vw, 2.75rem);
  max-width: 62ch;
  font-size: 0.875rem;
  color: var(--slate);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}

.footer__meta a { color: var(--teal); text-decoration: none; }
.footer__meta a:hover { text-decoration: underline; }

/* ── Narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 46rem) {
  .term__body { font-size: 0.75rem; height: clamp(20rem, 58vh, 30rem); }

  /* The composer sits at 16px because iOS Safari zooms the whole page when
     you focus an input smaller than that - on a page whose entire purpose is
     typing, that means pinching back out after every command. Output stays
     dense; only the line you are writing gets bigger. */
  .term__form { font-size: 1rem; }
  .chal-status__hint { margin-left: 0; width: 100%; }
  .chal-hero__meta { gap: 0.3rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .chip { transition: none; }
}

@media print {
  .term, .chal-status, .term__legend { display: none; }
}
