/* ============================================================
   OHÙN — page styles on the ILÉ house system.
   house.css carries the tokens; nothing here retypes raw hex
   that the house already owns. Laws invoked per block.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* the hidden attribute must win over any display set below */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  position: relative; /* anchors the .grain finish */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* margins >= 72px on wide canvases, one left-aligned axis */
.shell {
  max-width: 1128px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) clamp(20px, 6vw, 72px) 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- header ---------- */

.head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; position: relative; z-index: 2;
}
.tick-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tick {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgb(255 90 31 / 0.16);
}
.eyebrow { font-size: 13px; } /* house recipe, web scale */
.index {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---------- hero — hierarchy axis 1: display scale ---------- */

.headline {
  margin-top: clamp(28px, 4.5vw, 48px);
  font-size: clamp(44px, 7vw, 76px);
  max-width: 15ch;
  position: relative; z-index: 2;
}
.headline .acc { color: var(--accent); } /* ONE accent word */

.standfirst {
  margin-top: 20px;
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 52ch;
  position: relative; z-index: 2;
}

/* ---------- workbench — asymmetry, not centered-everything ---------- */

.workbench {
  margin-top: clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(236px, 0.9fr);
  gap: 26px;
  align-items: stretch;
  position: relative; z-index: 2;
  flex: 1;
}
.slot { position: relative; display: flex; flex-direction: column; min-width: 0; }
.slot > * { flex: 1; }

/* ---------- FOCAL 1 — dropzone plate (white on cream, hairline frame) ---------- */

.dropzone {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  min-height: 340px;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  gap: 6px;
  padding: clamp(28px, 4vw, 52px);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.dropzone:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-raised);
}
.dropzone.dragover {
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
}
.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.dz-mark { color: var(--ink-muted); margin-bottom: 14px; }
.dropzone.dragover .dz-mark { color: var(--accent); }
.dz-title {
  font-family: var(--font-display);
  font-weight: 700; letter-spacing: -0.03em;
  font-size: clamp(22px, 2.6vw, 30px);
}
.dz-alt {
  font-size: 15px; font-weight: 500;
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.dz-hint {
  margin-top: 16px;
  font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-muted);
}

/* ---------- FOCAL 3 — job panel (the one dark stage) ---------- */

.job-panel {
  background: var(--panel);
  border-radius: 24px;
  padding: clamp(24px, 3vw, 36px);
  color: #fff;
  display: flex; flex-direction: column;
  gap: 22px;
  justify-content: center;
  min-height: 340px;
  overflow: hidden;
}
.job-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgb(255 255 255 / 0.14);
  padding-bottom: 14px;
}
.job-state { color: var(--peach); } /* eyebrow goes peach on panel — house recipe */
.job-state.failed { color: var(--bad); } /* semantic only */
.job-file {
  font-size: 12px; letter-spacing: 0.04em;
  color: rgb(255 255 255 / 0.66);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}

.j-phase { display: flex; flex-direction: column; gap: 16px; }

.work-line { font-size: 17px; font-weight: 500; }
.bar {
  height: 8px; border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  overflow: hidden;
}
.bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 160ms ease;
}
.bar-meta {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 12px; letter-spacing: 0.08em;
  color: rgb(255 255 255 / 0.66);
}
.bar.indeterminate { position: relative; }
.bar-sweep {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 30%; border-radius: 999px;
  background: var(--accent);
  animation: sweep 1.2s ease-in-out infinite;
}
@keyframes sweep {
  0%   { left: -30%; }
  100% { left: 100%; }
}

/* done */
.wave { width: 100%; height: 96px; display: block; border-radius: 8px; }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 22px;
}
.meta-grid > div {
  border-top: 1px solid rgb(255 255 255 / 0.14);
  padding: 10px 0 2px;
  min-width: 0;
}
.meta-grid dt {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgb(255 255 255 / 0.5);
}
.meta-grid dd { font-size: 14px; font-weight: 500; margin-top: 3px; }

.notes { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.notes li {
  font-size: 13px; line-height: 1.45;
  color: rgb(255 255 255 / 0.66);
}
.notes li::before {
  content: "— "; color: var(--peach);
}

.err-msg { font-size: 16px; line-height: 1.5; }

.job-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- buttons / pills ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  padding: 11px 22px;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.btn.accent { background: var(--accent); color: var(--ink); }
.btn.accent:hover { background: var(--accent-strong); color: #fff; }
.btn.ghost-light {
  background: transparent;
  border: 2px solid rgb(255 255 255 / 0.35);
  color: #fff;
}
.btn.ghost-light:hover { border-color: #fff; }
.btn:focus-visible { outline: 2px solid var(--peach); outline-offset: 3px; }
a.btn.accent:focus-visible { outline-color: var(--ink); }

/* ---------- FOCAL 2 — format column ---------- */

.formats {
  display: flex; flex-direction: column;
  align-self: start;
  gap: 10px;
  transition: opacity 160ms ease;
}
.formats.frozen { opacity: 0.45; pointer-events: none; }
.f-label { margin-bottom: 8px; }

.pill { position: relative; }
.pill input {
  position: absolute; opacity: 0;
  width: 1px; height: 1px;
}
.pill-body {
  display: flex; align-items: center;
  border: 2px solid rgb(29 20 16 / 0.22);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}
.pill-body:hover { border-color: var(--accent-border); }
.pill input:checked + .pill-body {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.pill input:focus-visible + .pill-body {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.wav-note {
  margin-top: 6px;
  font-size: 13px; line-height: 1.45;
  color: var(--ink-muted);
  max-width: 30ch;
}

/* ---------- footer ---------- */

.foot {
  margin-top: clamp(36px, 6vw, 64px);
  padding: 22px 0 30px;
  border-top: 2px solid var(--border);
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.foot .mono {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted);
}
.key-btn {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 500;
  color: var(--ink-muted);
  background: none; border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease;
}
.key-btn:hover { color: var(--ink); }
.key-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- key modal ---------- */

.modal-veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgb(29 20 16 / 0.52);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-raised);
  width: min(400px, 100%);
  padding: 30px 30px 32px;
}
.km-copy {
  margin-top: 14px;
  font-size: 14.5px; line-height: 1.5;
  color: var(--ink-muted);
}
#keyForm { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.key-input {
  font-size: 14px; letter-spacing: 0.06em;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 120ms ease;
}
.key-input:focus-visible {
  outline: none;
  border-color: var(--accent);
}
.km-err { font-size: 13px; color: var(--bad); line-height: 1.4; }

/* ---------- narrow canvases ---------- */

@media (max-width: 820px) {
  .workbench { grid-template-columns: 1fr; gap: 18px; }
  .formats {
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px;
  }
  .f-label { width: 100%; margin-bottom: 2px; }
  .wav-note { width: 100%; margin-top: 2px; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .dropzone, .job-panel { min-height: 240px; }
  .index { display: none; }
  .job-head { flex-wrap: wrap; gap: 2px 14px; }
}

/* phones — the sweet layer: tighter scale, thumb-sized targets, safe areas */
@media (max-width: 520px) {
  .shell {
    padding: 24px max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  }
  .headline {
    font-size: clamp(34px, 10.5vw, 44px);
    margin-top: 22px;
    max-width: none;
  }
  .standfirst { margin-top: 14px; font-size: 15.5px; }
  .workbench { margin-top: 24px; }

  .dropzone {
    min-height: 216px;
    padding: 26px 24px;
    border-radius: 20px;
  }
  .dz-mark { width: 38px; height: 38px; margin-bottom: 10px; }
  .dz-title { font-size: 22px; }
  .dz-hint { margin-top: 12px; }

  .job-panel {
    min-height: 0;
    padding: 22px 20px;
    border-radius: 20px;
    gap: 18px;
  }
  .job-state { font-size: 12px; }
  .work-line { font-size: 16px; }
  .bar { height: 10px; }
  .bar-meta { gap: 8px 16px; }
  .wave { height: 76px; }

  .meta-grid { gap: 0 14px; }
  .meta-grid > div { padding: 9px 0 2px; }
  .meta-grid dd {
    font-size: 13.5px;
    overflow-wrap: anywhere; /* a long token may never shove the grid */
  }

  .btn {
    padding: 12px 20px;
    min-height: 44px; /* thumb target */
    font-size: 15px;
    flex: 1 1 auto;
  }
  .job-actions { gap: 10px; }

  .pill-body { padding: 11px 16px; min-height: 44px; }
  .wav-note { font-size: 12.5px; }

  .foot {
    margin-top: 30px;
    flex-direction: column; align-items: flex-start;
    gap: 6px;
    padding-bottom: max(26px, env(safe-area-inset-bottom));
  }
  .foot .mono { font-size: 11px; }

  .modal { padding: 24px 22px 26px; }
  .key-input { font-size: 16px; } /* iOS zooms focus on <16px inputs */
}

/* ---------- motion respect ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; }
  .bar-sweep { animation: none; left: 35%; }
}
