/* =====================================================================
   Glasshouse · the app (app.html)
   Brand: Mojo Styles "Signal", tailored (see brand/BRAND.md). A cool paper
   page; the phone stands on the one dark, gridded instrument (the glass
   box); the controls are set like a spec sheet beside it.
   ===================================================================== */
@import url("brand/glasshouse.css");

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--body); min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
kbd { font: 600 12px var(--mono); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r-xs); background: var(--surface); color: var(--ink); }

/* ---- header: the brand, an "experimental" pill, live stats in mono ---- */
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 60px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
header h1 { margin: 0; font: 700 21px/1 var(--display); letter-spacing: -0.01em; }
.gh-mark { width: 30px; height: 30px; flex: none; margin-top: -3px; }
.gh-glass { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.gh-phone { fill: var(--accent); }
.gh-glint { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; }
.tag { font: 600 12px/1.6 var(--body); color: var(--accent); background: var(--accent-soft); border-radius: var(--r-pill); padding: 1px 9px; }
.spacer { flex: 1; }
.stats { font: 12px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- layout ---- */
main { flex: 1; display: grid; grid-template-columns: minmax(300px, auto) minmax(320px, 520px); gap: 28px; padding: 28px 20px; justify-content: center; align-items: start; }

/* ---- the instrument: the phone on a dark gridded table ---- */
.device-col {
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 36px 18px; border-radius: var(--r-xl);
  background-color: var(--table);
  background-image: linear-gradient(var(--table-grid) 1px, transparent 1px), linear-gradient(90deg, var(--table-grid) 1px, transparent 1px);
  background-size: 24px 24px; box-shadow: var(--table-shadow);
}
:root[data-theme="dark"] .device-col { box-shadow: 0 0 0 1px var(--line), var(--table-shadow); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .device-col { box-shadow: 0 0 0 1px var(--line), var(--table-shadow); } }
/* A generic phone: rounded black glass with a cyan rim. */
.device { position: relative; background: #020607; border-radius: 46px; padding: 14px; box-shadow: 0 0 0 1.5px rgba(143, 227, 255, 0.28), 0 30px 50px -22px rgba(0, 0, 0, 0.85); }
.screen { position: relative; height: min(76vh, 840px); aspect-ratio: 1125 / 2436; border-radius: 34px; overflow: hidden; background: #000; }
.screen canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
.screen-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--table-muted); font: 13px/1.5 var(--mono); pointer-events: none; transition: padding 0.4s var(--ease); }
.side { position: absolute; top: 120px; display: flex; flex-direction: column; gap: 14px; }
.side.left { left: -5px; } .side.right { right: -5px; top: 160px; }
.side button { width: 5px; height: 56px; padding: 0; border: none; border-radius: 3px; background: #2a3a3e; cursor: pointer; }
.side.right button { height: 84px; }
.side button:active { background: var(--glow); }
.side button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.hint { color: var(--table-muted); font-size: 13px; text-align: center; }
.hint kbd { background: rgba(255, 255, 255, 0.06); border-color: #213a3d; color: var(--table-ink); }

/* ---- boot splash: the white mark on black while .screen has .booting ---- */
.boot-splash { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7%; background: #000; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s; }
.screen.booting .boot-splash { opacity: 1; visibility: visible; transition: opacity 0.6s var(--ease), visibility 0s; }
.boot-mark { width: 31.6%; height: auto; display: block; }
.boot-line { display: block; width: 26.7%; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); position: relative; overflow: hidden; }
.boot-line::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent); animation: boot-shimmer 2.4s ease-in-out infinite; }
@keyframes boot-shimmer { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .boot-line::after { animation: none; transform: translateX(75%); } }
html.calm .boot-line::after { animation: none; transform: translateX(75%); }
/* While booting, status text moves below the mark instead of over it. */
.screen.booting .screen-msg { align-items: flex-end; padding-bottom: 22%; }

/* ---- the panel: cards set like a spec sheet ---- */
.panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0 0 10px; font: 700 19px/1.2 var(--display); letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.card h2 .step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 700 13px var(--display); font-variant-numeric: tabular-nums; }
.card p { margin: 0 0 8px; }
.card.grow { flex: 1; display: flex; flex-direction: column; min-height: 220px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.row label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type="file"] { font: 14px var(--body); color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button { font: 600 14px var(--body); margin-right: 10px; padding: 7px 12px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--accent); }

/* ---- buttons ---- */
button { font: 600 15px/1 var(--body); padding: 11px 18px; border-radius: var(--r-m); border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.ghost:hover:not(:disabled) { filter: none; border-color: var(--accent); }
button.danger { color: #b3261e; }
button.danger:hover:not(:disabled) { border-color: #b3261e; }
:root[data-theme="dark"] button.danger { color: #ff8a80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.danger { color: #ff8a80; } }

/* ---- browser checks: Signal's status marks (filled = ok, amber ring = needs attention) ---- */
.checks { list-style: none; margin: 0; padding: 0; font-size: 14px; display: grid; gap: 4px; }
.checks li { display: flex; gap: 9px; align-items: baseline; margin: 0; }
.checks li::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; transform: translateY(-1px); }
.checks li.ok::before { background: var(--ok); }
.checks li.bad::before { width: 7px; height: 7px; border: 2px solid var(--built); }

/* ---- progress ---- */
.bar { height: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; margin: 10px 0 6px; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
#build-stage { font-variant-numeric: tabular-nums; font-size: 14px; }

/* ---- console: the kernel log, on the table's dark glass ---- */
.console { flex: 1; margin: 0; background: var(--code-bg); color: var(--code-ink); border-radius: var(--r-m); padding: 12px 14px; overflow: auto; font: 11.5px/1.4 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 46vh; min-height: 160px; }

a { color: var(--accent); text-underline-offset: 3px; word-break: break-word; }
a:not([href]) { color: var(--ink); font-weight: 600; }
ol { padding-left: 20px; margin: 8px 0 0; } li { margin: 4px 0; }
footer { padding: 16px 20px 22px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

@media (max-width: 860px) {
  main { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .device-col { padding: 22px 16px 14px; }
  .screen { height: 70vh; }
  header { padding: 0 16px; }
  .stats { display: none; }
}
@media (max-width: 400px) {
  .screen { height: auto; width: calc(100vw - 92px); }
}
