/* style.css - one stylesheet for the whole site.
 *
 * Dark by default because the thing it wraps is: anny_viewer_v3.html renders a grey body on a dark
 * stage, and a white chrome around it would make the viewport look like a hole punched in the page.
 * The palette is taken from the viewer so the wrapper and the tool read as one product.
 *
 * No framework. The heavy lifting is inside a 37 MB static page, so a CSS framework would add
 * weight to every route to style the handful of forms and lists that are actually ours.
 */

:root {
  --bg: #12151c;
  --bg-raised: #1a1f2a;
  --bg-input: #0e1117;
  --line: #2a3342;
  --line-soft: #222a36;
  --text: #dfe5ee;
  --text-dim: #93a0b4;
  --text-faint: #6b7788;
  --accent: #4aa3ff;
  --accent-hot: #6fb8ff;
  --ok: #46c98b;
  --warn: #e0a33e;
  --bad: #e8646b;
  --radius: 8px;
  --gap: 16px;
  --maxw: 1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hot); text-decoration: underline; }

/* ---- layout ------------------------------------------------------------------------------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

header.site {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 40;
}
header.site .wrap {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-height: 56px;
}
.brand {
  font-weight: 650;
  letter-spacing: 0.2px;
  color: var(--text);
  font-size: 16px;
}
.brand:hover { text-decoration: none; }
.brand small { color: var(--text-faint); font-weight: 400; margin-left: 6px; font-size: 12px; }
nav.site { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-wrap: wrap; }
nav.site a {
  padding: 6px 11px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 14px;
}
nav.site a:hover { background: #222a36; color: var(--text); text-decoration: none; }
nav.site a[aria-current="page"] { color: var(--text); background: #222a36; }

main { padding: 28px 0 64px; }

footer.site {
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 13px;
  padding: 20px 0 40px;
}
footer.site .wrap { display: flex; gap: var(--gap); flex-wrap: wrap; }

/* ---- type --------------------------------------------------------------------------------- */

h1 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; font-weight: 650; }
h2 { font-size: 20px; margin: 32px 0 10px; font-weight: 600; }
h3 { font-size: 16px; margin: 20px 0 8px; font-weight: 600; }
p { margin: 0 0 12px; }
.lede { font-size: 17px; color: var(--text-dim); max-width: 62ch; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 13px; }
code, .mono { font-family: var(--mono); font-size: 13px; }

/* ---- panels and cards --------------------------------------------------------------------- */

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.grid { display: grid; gap: var(--gap); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.billing-summary { margin-bottom: 22px; }
.billing-summary h2 { margin-top: 0; }
.credit-balances { display: grid; gap: 8px 20px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.product-price { font-size: 24px; margin: 4px 0 10px; }
.terms-list { margin: 0; padding-left: 20px; }
.terms-list li + li { margin-top: 8px; }

/* ---- forms -------------------------------------------------------------------------------- */

form.stack { display: grid; gap: 14px; max-width: 380px; }
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #232c3a;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
button:hover:not(:disabled), .btn:hover { background: #2b3644; text-decoration: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #05192e; font-weight: 600; }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent-hot); }
button.primary:disabled { background: #26384b; border-color: #33485f; color: var(--text-dim); opacity: 1; }
button.danger { border-color: #4a2a2e; color: var(--bad); }
button.danger:hover:not(:disabled) { background: #332225; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- notices. Colour is never the only signal; each carries a word. --------------------- */

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-faint);
  border-radius: 6px;
  padding: 11px 14px;
  margin: 0 0 var(--gap);
  background: #171c25;
  font-size: 14px;
}
.notice.err { border-left-color: var(--bad); }
.notice.ok { border-left-color: var(--ok); }
.notice.warn { border-left-color: var(--warn); }
.notice strong { display: block; margin-bottom: 2px; }
.notice[hidden] { display: none; }

/* ---- tables and lists --------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--text-dim); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
}

/* ---- the designer route ------------------------------------------------------------------- */

.designer-shell { display: flex; flex-direction: column; height: calc(100vh - 56px); }
.designer-shell > .wrap { width: 100%; }
#accessGate button { margin: 8px 0 0 10px; }
.designer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  flex-wrap: wrap;
}
.designer-bar .spacer { flex: 1 1 auto; }
#viewerFrame { flex: 1 1 auto; width: 100%; border: 0; display: block; background: var(--bg); }
.designer-status { font-size: 13px; color: var(--text-dim); }

/* ---- utility ------------------------------------------------------------------------------ */

.stack-sm { display: grid; gap: 8px; }
.mt { margin-top: 20px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
[hidden] { display: none !important; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  header.site .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .designer-shell { height: auto; }
  #viewerFrame { height: 70vh; }
}
