/* Claude Lens — a heads-up display, not a screen.
 *
 * Built to the evidence (see reports/Smart glasses interaction standards.md):
 *   · Additive optics: black is clear glass; every lit pixel lands in the eye.
 *   · ~42 px per degree: nothing below 24 px (0.57°), body 28 px, titles 36 px.
 *   · Text tone ≥ 75 against the world (Glimmer); the dim gray is for rules, never words.
 *   · Focus is a 3 px ring (Meta), the one lit surface on a screen.
 *   · Long or safety-critical text sits on a dim plate (tone < 34).
 *   · Nothing loops. Arrivals fade slowly; focus answers instantly.
 *   · One accent: Claude's clay marks only what wants you.
 */
@import url('fonts/fonts.css');

:root {
  --glass: #000;
  --text: #f4eee4;        /* tone ~94 */
  --text-2: #cdc5b7;      /* tone ~80: secondary words */
  --rule: #6f695f;        /* decoration only: hairlines, idle pips */
  --plate: #23201d;       /* tone ~13: behind commands and long text */
  --lift: rgba(255, 246, 234, 0.1);
  --line: rgba(255, 246, 234, 0.22);
  --accent: #f3a67e;
  --accent-lift: rgba(243, 166, 126, 0.16);
  --accent-line: rgba(243, 166, 126, 0.75);

  --sans: "Atkinson Hyperlegible Next", -apple-system, Roboto, system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, monospace;
  --t-hero: 1.57rem;    /* 44 */
  --t-title: 1.29rem;   /* 36 */
  --t-body: 1rem;       /* 28 */
  --t-small: 0.89rem;   /* 25 */
  --t-label: 0.86rem;   /* 24: the floor */

  --gap: 0.57rem;       /* 16 */
  --r: 1rem;
  --pill: 999px;
  --ring: 0.11rem;      /* 3 px */

  font-size: clamp(16px, 4.67vmin, 32px);   /* 28 px at 600 */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--glass); color: var(--text); }
body { font-family: var(--sans); font-size: var(--t-body); line-height: 1.28; overflow: hidden; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, textarea { font: inherit; color: inherit; }
b, strong { font-weight: 700; }

#app { height: 100%; display: flex; flex-direction: column; gap: var(--gap); padding: 1.15rem 1.15rem 1rem; }  /* ≈ 32 px */
.grow { flex: 1; min-height: 0; }

/* ---------- heading: label + title ---------- */
.top { display: flex; flex-direction: column; gap: 0.1rem; }
.label { font-size: var(--t-label); font-weight: 600; text-transform: uppercase; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label.accent { color: var(--accent); }
.title { font-size: var(--t-title); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; }
.title.one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero { font-size: var(--t-hero); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.sub { font-size: var(--t-body); color: var(--text-2); text-wrap: balance; }
.offline { color: var(--accent); }

/* ---------- focus: one lit surface, a 3 px ring ---------- */
button, [tabindex] { outline: none; -webkit-tap-highlight-color: transparent; }
.focusable:focus-visible, .row:focus-visible, .btn:focus-visible, .tile:focus-visible, .chip:focus-visible, .call:focus-visible {
  background: var(--lift); box-shadow: inset 0 0 0 var(--ring) var(--accent);
}
.scroller:focus-visible, .field:focus { box-shadow: inset 0 0 0 var(--ring) var(--accent); }
.row, .btn, .tile, .chip, .call, .field, .scroller { transition: background 90ms, box-shadow 90ms; }

/* ---------- the call: what wants you, one sentence ---------- */
.call {
  display: flex; flex-direction: column; gap: 0.18rem; text-align: left;
  border: 0; background: none; border-radius: var(--r); padding: 0.45rem 0.55rem; margin: 0 -0.55rem; width: calc(100% + 1.1rem);
  cursor: pointer;
}
.call.arriving { animation: arrive 1.8s ease-out; }   /* Glimmer: slow arrivals are noticed without startling */
.call .sub.line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: nowrap; }
.call .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.call .sub { font-size: var(--t-body); color: var(--text); }
@keyframes arrive { from { opacity: 0; } }

/* ---------- fleet rows ---------- */
.rows { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 0.1rem; margin: 0 -0.55rem; }
.rows::-webkit-scrollbar { display: none; }
.rows.fade, .scroller.fade { -webkit-mask-image: linear-gradient(to bottom, #000 74%, transparent); mask-image: linear-gradient(to bottom, #000 74%, transparent); }
.row {
  display: grid; grid-template-columns: 1fr auto; column-gap: var(--gap); row-gap: 0.06rem; align-items: baseline;
  width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r); padding: 0.38rem 0.55rem; cursor: pointer;
}
.row .name { font-weight: 700; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row .detail { grid-column: 1 / -1; font-size: var(--t-small); color: var(--text-2); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row.quiet { cursor: default; }

/* ---------- status: glyph + word, no loops ---------- */
.st { display: inline-flex; align-items: center; gap: 0.32rem; font-size: var(--t-small); color: var(--text-2); white-space: nowrap; }
.st::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; box-sizing: border-box; }
.st.needs-you, .st.waiting-reply { color: var(--accent); font-weight: 600; }
.st.needs-you::before { background: var(--accent); }
.st.waiting-reply::before { border: 0.11rem solid var(--accent); }
.st.working::before { border: 0.11rem solid var(--text-2); border-right-color: transparent; transform: rotate(45deg); }  /* a still arc */
.st.idle::before { background: var(--rule); }
.st.ended::before { height: 0.11rem; border-radius: 1px; background: var(--rule); }

/* honest progress: Claude's own to-do list */
.steps { display: flex; align-items: center; gap: 0.5rem; font-size: var(--t-small); color: var(--text-2); }
.ticks { display: flex; gap: 0.14rem; flex: none; }
.ticks i { width: 0.5rem; height: 0.25rem; border-radius: 1px; background: var(--rule); display: block; }
.ticks i.done { background: var(--text-2); }
.ticks i.now { background: var(--accent); }
.steps .what { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- buttons ---------- */
.actions, .dock { display: flex; gap: var(--gap); }
.actions > *, .dock > * { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2.15rem; padding: 0 0.8rem; border-radius: var(--pill);
  background: none; border: 0.075rem solid var(--line); color: var(--text);
  font-size: var(--t-small); font-weight: 700; white-space: nowrap; cursor: pointer;
}
.btn .g { color: var(--accent); font-weight: 400; }
.btn.primary { color: var(--accent); border-color: var(--accent-line); background: var(--accent-lift); }
.btn.primary:focus-visible { background: rgba(243, 166, 126, 0.28); }
.btn.small { min-height: 1.8rem; font-size: var(--t-label); padding: 0 0.7rem; }
.btn.arming { position: relative; overflow: hidden; color: var(--text-2); border-color: var(--line); background: none; }
.btn.arming::after { content: ""; position: absolute; left: 0; bottom: 0; height: 0.11rem; width: 100%; background: var(--accent); transform-origin: left; animation: arm 500ms linear forwards; }
@keyframes arm { from { transform: scaleX(0); } }
.btn.armed { background: var(--accent); color: #000; border-color: var(--accent); }
.btn.armed:focus-visible { background: var(--accent); box-shadow: inset 0 0 0 var(--ring) #fff4ea; }

/* ---------- approvals: friction scales with risk ---------- */
.plate { background: var(--plate); border-radius: var(--r); padding: 0.55rem 0.75rem; }
.cmd { font-family: var(--mono); font-weight: 500; font-size: var(--t-small); line-height: 1.32; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.scroller { overflow-y: auto; scrollbar-width: none; border-radius: var(--r); }
.scroller::-webkit-scrollbar { display: none; }
.risk-high .plate { box-shadow: inset 0 0 0 0.075rem var(--accent-line); }
.blast { display: flex; gap: 0.45rem; align-items: baseline; font-size: var(--t-small); color: var(--text-2); }
.blast b { color: var(--text); font-weight: 600; }
.risk-high .blast::before { content: "!"; flex: none; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--accent); color: #000; font-weight: 700; font-size: 0.72rem; display: inline-flex; align-items: center; justify-content: center; transform: translateY(0.12rem); }
.hint { font-size: var(--t-label); color: var(--text-2); display: flex; align-items: center; gap: 0.5rem; }
.hint .btn.small { flex: none; }

/* ---------- session ---------- */
.msg { flex: 1; min-height: 0; font-size: var(--t-small); line-height: 1.38; padding: 0.45rem 0.6rem; margin: -0.2rem -0.6rem 0; }
.msg p { margin: 0 0 0.35rem; } .msg p:last-child { margin: 0; }
.msg .h { font-weight: 700; }
.msg ul { margin: 0 0 0.35rem; padding-left: 1rem; } .msg li::marker { color: var(--rule); }
.msg code { font-family: var(--mono); font-size: 0.92em; color: var(--accent); }
.msg pre { font-family: var(--mono); font-size: 0.84em; color: var(--text-2); white-space: pre-wrap; margin: 0.2rem 0; }
.replies { display: flex; flex-direction: column; gap: 0.08rem; margin: 0 -0.55rem; }
.chip { display: flex; align-items: center; gap: 0.55rem; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r); padding: 0.32rem 0.55rem; font-size: var(--t-small); cursor: pointer; }
.chip::before { content: "›"; color: var(--accent); font-weight: 700; flex: none; }
.chip.thinking { color: var(--text-2); cursor: default; }
.chip.thinking::before { content: "·"; }

.field { flex: 1; min-height: 4rem; resize: none; background: none; border: 0.075rem solid var(--line); border-radius: var(--r); padding: 0.6rem 0.8rem; font-size: var(--t-title); line-height: 1.3; }
.field::placeholder { color: var(--text-2); font-style: italic; }
.field:focus { border-color: transparent; }

/* ---------- Burrow ---------- */
.kept { display: flex; align-items: baseline; gap: 0.45rem; font-size: var(--t-hero); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.spark { color: var(--accent); font-weight: 400; }
.trail { display: flex; gap: 0.32rem; align-items: center; }
.trail i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rule); display: block; }
.trail i.now { background: var(--accent); width: 0.64rem; height: 0.64rem; }
.quote { font-size: var(--t-small); line-height: 1.32; }
.row.echo .quote, .row.theme .quote { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .when { font-size: var(--t-label); color: var(--text-2); align-self: start; }
.row.theme { grid-template-columns: 2.4rem 1fr; align-items: baseline; }
.row.theme .n { font-size: var(--t-title); font-weight: 700; color: var(--accent); text-align: right; line-height: 1; }
.row.theme .n small { font-size: 0.6em; font-weight: 400; }
.row.theme .meta { grid-column: 2; font-size: var(--t-label); color: var(--text-2); }
.unearthed { font-size: var(--t-body); line-height: 1.4; }
.unearthed .u-title { font-size: var(--t-title); font-weight: 700; line-height: 1.15; margin-bottom: 0.35rem; }
.unearthed .tags { margin-top: 0.5rem; font-size: var(--t-label); color: var(--text-2); display: flex; gap: 0.6rem; }

/* ---------- Mac ---------- */
.tiles { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 0.15rem; margin: 0 -0.3rem; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; border: 0; background: none; border-radius: var(--r); cursor: pointer; }
.tile svg { width: 1.3rem; height: 1.3rem; stroke: var(--text-2); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile .lb { font-size: var(--t-label); font-weight: 600; text-align: center; line-height: 1.05; }
.tile:focus-visible svg { stroke: var(--accent); }

.banner { display: flex; align-items: center; gap: 0.5rem; font-size: var(--t-label); font-weight: 600; color: var(--accent); text-transform: uppercase; }
.banner::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); }
.dpad { flex: 1; min-height: 0; outline: none; display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr auto 1fr; grid-template-areas: ". u ." "l c r" ". d ."; place-items: center; gap: 0.45rem; }
.dir { display: flex; align-items: center; gap: 0.32rem; font-size: var(--t-small); font-weight: 700; transition: color 90ms; }
.dir .ar { color: var(--text-2); font-weight: 400; }
.dir.u { grid-area: u; flex-direction: column; align-self: end; } .dir.d { grid-area: d; flex-direction: column-reverse; align-self: start; }
.dir.l { grid-area: l; justify-self: end; } .dir.r { grid-area: r; flex-direction: row-reverse; justify-self: start; }
.dir.off { opacity: 0.25; }
.dir.hit, .dir.hit .ar { color: var(--accent); }
.pinch { grid-area: c; width: 4.4rem; height: 4.4rem; border-radius: 50%; border: var(--ring) solid var(--accent-line); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--accent); font-size: var(--t-small); font-weight: 700; line-height: 1.05; }
.pinch small { font-size: var(--t-label); font-weight: 600; color: var(--text-2); }
.pinch.hit { background: var(--accent-lift); }
.echo-line { text-align: center; font-size: var(--t-small); color: var(--text-2); min-height: 1.2rem; }
.echo-line b { color: var(--accent); }

/* ---------- empty / loading ---------- */
.empty { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 0.4rem; }
.mark { display: inline-flex; gap: 0.12rem; }
.mark i { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 0.14rem solid var(--accent); display: block; }

/* ---------- toast: top, never over the actions ---------- */
#toast {
  position: fixed; left: 50%; top: 0.85rem; transform: translateX(-50%);
  background: #000; border: var(--ring) solid var(--accent-line); border-radius: var(--pill);
  padding: 0.32rem 0.9rem; font-size: var(--t-label); font-weight: 700; white-space: nowrap;
  box-shadow: 0 0 0 0.5rem #000;
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
