/* Raleway (SIL Open Font License, fonts/OFL.txt), served from FMRL itself so visitors' browsers
   make no requests to third parties. Variable font: one file per character subset covers every
   weight, and browsers only download the subsets a page's text uses. Paths are relative, so this
   works both at /static/ on the portal and at /_fmrl/ on site subdomains. */
/* cyrillic-ext */
@font-face {
  font-family: 'Raleway';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-italic-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Raleway';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-italic-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
  font-family: 'Raleway';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-italic-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Raleway';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-italic-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Raleway';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-italic-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-normal-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-normal-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-normal-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-normal-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Wordmark: FMRL letters, then the slate of LIVE. */
  --wm-1: #ef5f6e;
  --wm-2: #2fbf7f;
  --wm-3: #4a97e0;
  --wm-4: #e3a02c;
  --wm-slate: #8a9db3;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #66655f;
  --border: #e3e1da;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --online: #1f8a4c;
  --online-bg: #e3f4ea;
  --offline: #77756d;
  --offline-bg: #ecebe6;
  --pending: #9a6a00;
  --pending-bg: #fbf0d4;
  --danger: #c0392b;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wm-1: #ff8794;
    --wm-2: #5fdca5;
    --wm-3: #7fbcff;
    --wm-4: #ffcf66;
    --wm-slate: #9eb0c4;
    --bg: #161614;
    --surface: #1f1f1d;
    --text: #ecebe6;
    --muted: #a3a199;
    --border: #34332f;
    --accent: #7c9cff;
    --accent-text: #0e1220;
    --online: #5fd08e;
    --online-bg: #193425;
    --offline: #a3a199;
    --offline-bg: #2a2a27;
    --pending: #f0c055;
    --pending-bg: #3a3020;
    --danger: #ff7a6b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 Raleway, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Raleway's default figures are old-style; keep numbers even-height and aligned. */
  font-variant-numeric: lining-nums;
}

a { color: var(--accent); }
code { font: 0.9em ui-monospace, "Cascadia Code", Consolas, monospace; }
h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
h2 { font-size: 0.95rem; font-weight: 800; margin: 0; text-transform: uppercase; letter-spacing: 0.14em; }

/* Classes that set display (.btn, .live-preview, ...) must not un-hide hidden elements. */
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* FMRL over LIVE: heavy capitals set tight. The block is as wide as the wider word,
   and the other word is spread across that width. */
.wordmark {
  display: inline-grid; width: max-content; margin: 0;
  font-weight: 900; line-height: 0.88; text-transform: uppercase; text-decoration: none;
}
.wm-row { display: flex; justify-content: space-between; gap: 0.02em; }
.wm-top span:nth-child(1) { color: var(--wm-1); }
.wm-top span:nth-child(2) { color: var(--wm-2); }
.wm-top span:nth-child(3) { color: var(--wm-3); }
.wm-top span:nth-child(4) { color: var(--wm-4); }
.wm-bottom { color: var(--wm-slate); }

/* FMRL letters drift around the colour wheel, each starting from its own hue above.
   --wm-h is a registered number so the browser can interpolate it smoothly. */
@property --wm-h { syntax: '<number>'; inherits: true; initial-value: 0; }
@keyframes wm-spectrum { to { --wm-h: 360; } }
@supports (color: oklch(0% 0 0)) {
  .wm-top { --wm-l: 68%; --wm-c: 0.16; animation: wm-spectrum 40s linear infinite; }
  .wm-top span:nth-child(1) { color: oklch(var(--wm-l) var(--wm-c) calc(var(--wm-h) + 20)); }
  .wm-top span:nth-child(2) { color: oklch(var(--wm-l) var(--wm-c) calc(var(--wm-h) + 155)); }
  .wm-top span:nth-child(3) { color: oklch(var(--wm-l) var(--wm-c) calc(var(--wm-h) + 250)); }
  .wm-top span:nth-child(4) { color: oklch(var(--wm-l) var(--wm-c) calc(var(--wm-h) + 75)); }
}
@media (prefers-color-scheme: dark) {
  .wm-top { --wm-l: 80%; --wm-c: 0.13; }
}
@media (prefers-reduced-motion: reduce) {
  .wm-top { animation: none; }
}

.site-footer {
  max-width: 880px; margin: 0 auto; padding: 24px 16px 40px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center;
}
.site-footer a { color: inherit; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand.wordmark { font-size: 1rem; }
/* "Host Studio (name.domain)" can be long: trim it rather than overflow the bar on phones. */
.topbar #host-button { display: inline-block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The admin's site table: dates give way to the status and buttons on phones. */
@media (max-width: 640px) { .when { display: none; } }

.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 16px; }
.page-inner { display: grid; gap: 16px; min-width: 0; }
td.nowrap { white-space: nowrap; }
.hero { padding: 40px 0 16px; display: grid; justify-items: center; gap: 16px; text-align: center; }
.hero .wordmark { font-size: clamp(3.5rem, 17vw, 6.5rem); }
.tagline {
  max-width: 34em; color: var(--wm-slate); font-weight: 700;
  letter-spacing: 0.16em; font-size: 1.05rem; line-height: 1.7;
}
.intro { max-width: 40em; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: grid; gap: 12px; min-width: 0;
  margin:9px 0;
}

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.stack { display: grid; gap: 8px; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.error { color: var(--danger); margin: 0; }
p { margin: 0; }

input:not([type=checkbox]) {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; flex: 1 1 200px;
}

select {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; max-width: 100%;
}

.btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text);
}
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--border); justify-self: start; }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }
.btn:hover { filter: brightness(1.08); }

.pill { font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--offline-bg); color: var(--offline); }
.pill.online { background: var(--online-bg); color: var(--online); }
.pill.connecting { background: var(--pending-bg); color: var(--pending); }
.pill.live { background: var(--danger); color: var(--surface); }
.pill.suspended, .pill.error { background: var(--danger-bg, var(--offline-bg)); color: var(--danger); }
.pill.experimental { background: var(--pending-bg); color: var(--pending); }
h3 { font-size: 0.85rem; font-weight: 700; margin: 0; }
.backend-log {
  font: 0.8rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.backend-log:empty { display: none; }
.backend-log .error { color: var(--danger); }
.backend-log .warn { color: var(--pending); }
.live-preview { display: block; width: 100%; max-height: 360px; background: #000; border-radius: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stats div { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.stats span { display: block; font-size: 1.4rem; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.stats.funnel { margin-top: 12px; }
.stats label { font-size: 0.8rem; color: var(--muted); }

.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px;
  text-align: center; color: var(--muted);
}
.drop-zone.over { border-color: var(--accent); color: var(--accent); }

.row.end { justify-content: flex-end; flex-wrap: nowrap; }
.crumbs { font-size: 0.9rem; }
.link {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.link:hover { text-decoration: underline; }
.link.folder { font-family: ui-monospace, Consolas, monospace; font-weight: 600; word-break: break-all; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
td.path { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
td.error { color: var(--danger); }
.num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }

.host-list { list-style: none; margin: 0; padding: 0; }
.host-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.host-list li:last-child { border-bottom: 0; }
.host-list a { font-weight: 600; text-decoration: none; }

.spinner {
  width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
