/* peaktime — design language follows xcribe.app: monochrome, system type,
   bold tracking-tight headings, subtle borders, dark mode via color scheme.
   Status-badge language (red peak / green off-peak, mono numerals) follows
   the deepakness.com/deepseek reference. */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Roboto Mono",
    "Droid Sans Mono", "DejaVu Sans Mono", monospace;

  --bg: #fafafa;
  --fg: #0c0a09;
  --muted: #57534e;
  --faint: #a8a29e;
  --card: #ffffff;
  --border: #e7e5e4;
  --code-bg: #f5f5f4;
  --accent: #0c0a09;

  --peak-fg: #b91c1c;
  --peak-bg: #fee2e2;
  --peak-dot: #ef4444;
  --off-fg: #15803d;
  --off-bg: #dcfce7;
  --off-dot: #22c55e;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(12, 10, 9, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --muted: #a1a1aa;
    --faint: #71717a;
    --card: #0a0a0a;
    --border: #262626;
    --code-bg: #171717;
    --accent: #ffffff;

    --peak-fg: #fca5a5;
    --peak-bg: rgba(185, 28, 28, 0.32);
    --peak-dot: #f87171;
    --off-fg: #86efac;
    --off-bg: rgba(21, 128, 61, 0.28);
    --off-dot: #4ade80;

    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.mono { font-family: var(--font-mono); }
.small { font-size: 0.75rem; }

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.site-header { padding: 1rem 0 0; }

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
}

.utc-clock {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- hero ---- */

.hero {
  text-align: center;
  padding: 4.5rem 0 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero .sub {
  max-width: 40rem;
  margin: 1.1rem auto 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero .sub em { font-style: normal; color: var(--fg); font-weight: 500; }

.hero .sub .quiet-link {
  color: inherit;
  font-weight: 500;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.hero .sub .quiet-link:hover { color: var(--fg); text-decoration-style: solid; }

.tz-pill {
  display: inline-block;
  margin: 1.4rem 0 0;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
}

.summary {
  margin: 1.1rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.summary strong { color: var(--fg); }

.noscript {
  margin: 0 auto 1.5rem;
  max-width: 40rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------ toolbar ---- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  padding-bottom: 1.1rem;
}

.sort-note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--faint);
}

.sort-note .peak-word { color: var(--peak-fg); font-weight: 600; }

/* Segmented filter control: real radios (native arrow-key/Space keyboard
   support), visually swallowed; labels become the segments. */
.segmented {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  /* Clip segment fills to the pill so the checked segment can never poke
     past the rounded ends with square corners (HIVE-18). */
  overflow: hidden;
}

.segmented input {
  position: absolute;
  appearance: none;
  -webkit-appearance: none;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.segmented label:not(:first-of-type) { border-left: 1px solid var(--border); }

/* Round the outer ends of the first/last segment so a checked end segment
   follows the pill contour instead of painting square corners (HIVE-18). */
.segmented label:first-of-type { border-radius: 999px 0 0 999px; }
.segmented label:last-of-type { border-radius: 0 999px 999px 0; }

.segmented input:checked + label { background: var(--fg); color: var(--bg); }

.segmented input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.empty {
  margin: 0 0 1.5rem;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* -------------------------------------------------------------- rows ---- */
/* Proposal A — Rows (HIVE-14 pick): one quiet line per provider, hairline
   separators, no card boxes; details unfold from the row itself. */

.rows {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.row { border-top: 1px solid var(--border); }
.row.is-hidden { display: none; }

.row-head {
  all: unset;
  display: grid;
  grid-template-areas: "dot who status chev";
  grid-template-columns: 16px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 0.5rem 0.9rem;
  width: 100%;
  padding: 1rem 0.15rem;
  box-sizing: border-box;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.row-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 0;
}

.row-head:hover { background: color-mix(in srgb, var(--fg) 3%, transparent); }

.row .dot {
  grid-area: dot;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--off-dot);
  justify-self: start;
}

.row .dot.peak {
  background: var(--peak-dot);
  animation: pulse 2.2s ease-in-out infinite;
}

.who {
  grid-area: who;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}

.who .name { font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }

.who .product {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statusline {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.badge {
  flex: none;
  display: inline-block;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.peak { color: var(--peak-fg); background: var(--peak-bg); }
.badge.off { color: var(--off-fg); background: var(--off-bg); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.count {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.count .lbl { color: var(--faint); font-size: 0.7rem; margin-left: 0.4rem; }

.chev {
  grid-area: chev;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--faint);
  text-align: center;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.row.open .chev { transform: rotate(45deg); }

.row-body { display: none; padding: 0.1rem 0.15rem 1.4rem 2rem; }
.row.open .row-body { display: block; }

.grid {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0.6rem 1.25rem;
  margin: 0;
}

.grid dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0.14rem;
}

.grid dd { margin: 0; font-size: 0.85rem; min-width: 0; }
.grid dd.mono { font-size: 0.8rem; }
.grid dd.muted { color: var(--muted); }
.grid dd.active { color: var(--fg); }
.grid dt.active { color: var(--fg); }

.grid dd .occ { display: block; }
.grid dd .occ .tag { color: var(--faint); margin-right: 0.35rem; }
.grid dd .occ .tag.now { color: var(--peak-fg); font-weight: 600; }
.grid dd .occ .tag.next { color: var(--off-fg); font-weight: 600; }

.tzref { color: var(--faint); }

.grid a { text-decoration: underline dotted; text-underline-offset: 3px; }

.source { font-size: 0.8rem; color: var(--muted); }
.source:hover { color: var(--fg); }

/* ---------------------------------------------------------------- api ---- */

.api { padding: 4rem 0 2rem; scroll-margin-top: 1.5rem; }

.api h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

/* Copy-link affordance next to the API heading: a quiet "#" that appears on
   hover/focus; clicking copies the full /#api URL (see app.js). */
.anchor-link {
  margin-left: 0.55rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--faint);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.api-h:hover .anchor-link,
.anchor-link:focus-visible { opacity: 1; }

.anchor-link:hover { color: var(--fg); }

.anchor-done {
  margin-left: 0.5rem;
  font-size: 0.72rem;
  color: var(--off-fg);
}

.api h3 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 2.2rem 0 0.8rem;
}

.api-sub { color: var(--muted); max-width: 46rem; }

.api-sub code, .endpoint-desc code, .api-detail summary code, .fields-table td code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.08em 0.35em;
}

/* Progressive disclosure: full example responses live behind <details>, so the
   reference stays scannable (signatures + curl visible, JSON on demand). */
.api-detail {
  margin: 0.5rem 0 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.api-detail summary {
  cursor: pointer;
  padding: 0.55rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  list-style-position: outside;
}

.api-detail summary:hover { color: var(--fg); }

.api-detail[open] summary { border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }

.api-detail > .code-block { margin: 0; }

.api-detail > .code-block pre { border: 0; border-radius: 0 0 10px 10px; }

.endpoint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.6rem 0 0.5rem;
}

.method {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.14rem 0.5rem;
  color: var(--off-fg);
}

.path { font-size: 0.86rem; }
.endpoint-desc { font-size: 0.8rem; color: var(--muted); }

.code-block { position: relative; margin: 0 0 0.6rem; }

.code-block pre {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.6;
}

.copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-sans);
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.copy:hover { color: var(--fg); }
.copy.done { color: var(--off-fg); border-color: var(--off-fg); }

/* Field-by-field reference table */
.table-wrap { overflow-x: auto; max-width: 50rem; }

.fields-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8rem;
}

.fields-table th {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  padding: 0.45rem 0.9rem 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.fields-table td {
  padding: 0.5rem 0.9rem 0.5rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--muted);
}

.fields-table td:first-child { color: var(--fg); white-space: nowrap; font-size: 0.78rem; }
.fields-table td:nth-child(2) { white-space: nowrap; }
.fields-table tr:last-child td { border-bottom: 0; }

.api-note {
  margin-top: 1.6rem;
  font-size: 0.8rem;
  color: var(--faint);
  max-width: 46rem;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.6rem 0 2.2rem;
  color: var(--faint);
  font-size: 0.78rem;
  text-align: center;
}

.site-footer p { margin: 0.35rem 0; }

/* "Made with love by Ale" + the author's social links (mirrored from the
   xcribe.app footer: same hrefs/icons; monochrome per this site's language). */
.credit {
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.socials {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
}

.socials a {
  display: inline-flex;
  color: var(--faint);
  transition: color 0.2s ease;
}

.socials a:hover { color: var(--fg); }

.socials svg { width: 1.05rem; height: 1.05rem; }

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 680px) {
  .row-head {
    grid-template-areas: "dot who chev" "dot status status";
    row-gap: 0.6rem;
    padding: 0.85rem 0.15rem;
  }
  .who .product { display: none; }
  .row-body { padding-left: 0.15rem; }
  .grid { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .grid dt { margin-top: 0.6rem; }
  .grid dt:first-of-type { margin-top: 0; }
}

@media (max-width: 560px) {
  .hero { padding: 3rem 0 2.25rem; }
  .toolbar { justify-content: center; text-align: center; }
  .anchor-link { opacity: 1; } /* no hover on touch — keep it discoverable */
  .fields-table td:nth-child(2) { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .row .dot.peak { animation: none; }
  .chev { transition: none; }
}
