/*
 * EPOCH — Design System
 *
 * Palette: Warm black, cream, single gold accent
 * Inspiration: Swiss watchmaking × Bloomberg terminal × Teenage Engineering
 * Rule: If it doesn't need to be there, it shouldn't be.
 */

/* ─── Tokens ─────────────────────────────── */
:root {
  --bg:        #111110;
  --surface:   #1a1918;
  --surface-2: #222120;
  --border:    #2e2c2a;
  --border-2:  #3a3835;

  --cream:     #e8e4de;
  --sub:       #a09a90;
  --muted:     #6b6560;
  --faint:     #3d3a37;

  --gold:      #c9a96e;
  --gold-dim:  rgba(201, 169, 110, 0.15);
  --err:       #c45c4f;
  --err-dim:   rgba(196, 92, 79, 0.12);
  --ok:        #6b9a73;

  --sans:      'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono:      'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;

  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Reset ──────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

::selection {
  background: var(--gold);
  color: var(--bg);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--sub); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold); text-decoration: underline; }

.thunderbolt {
  color: var(--gold);
  animation: flash 3s linear infinite;
}

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

code { font-family: var(--mono); }

/* ─── Top Bar ────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 17, 16, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.topbar-inner {
  max-width: 100vw;
  margin: 0 0;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-name { color: var(--cream); }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(107, 154, 115, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(107, 154, 115, 0); }
}

/* ─── Hero ───────────────────────────────── */
.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: 80px 24px 48px;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 64px;
  justify-content: center;
}

.clock-face {
  width: 260px;
  height: 260px;
  flex-shrink: 0;
}

.clock-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 40px rgba(201, 169, 110, 0.06));
}

.hand {
  transform-origin: 100px 100px;
  transition: none;
}

.readout {
  flex: 1;
  max-width: 380px;
}

.readout-time {
  font-family: var(--mono);
  font-size: clamp(3rem, 7vw, 4.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--cream);
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.readout-date {
  font-size: 0.95rem;
  color: var(--sub);
  margin-bottom: 28px;
  font-weight: 400;
}

.readout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.readout-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.readout-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.readout-value {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 400;
  text-align: right;
  word-break: break-all;
}

.hero-tagline {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 48px;
}

/* ─── Divider ────────────────────────────── */
.divider-line {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 1px;
}

.divider-line::after {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-2) 20%, var(--border-2) 80%, transparent);
}

/* ─── Section Label ──────────────────────── */
.section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 32px;
  padding-left: 2px;
}

/* ─── Console ────────────────────────────── */
.console-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 24px;
}

.console {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.console-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.console-dots {
  display: flex;
  gap: 6px;
}

.console-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--faint);
  transition: background 0.2s;
}

.console-dots span:nth-child(1):hover { background: #c45c4f; }
.console-dots span:nth-child(2):hover { background: #c9a96e; }
.console-dots span:nth-child(3):hover { background: #6b9a73; }

.console-title {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.console-actions { display: flex; }

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--border);
  color: var(--cream);
}

.console-input-row {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.console-prompt {
  color: var(--gold);
  font-weight: 500;
  user-select: none;
}

.console-method {
  color: var(--ok);
  font-weight: 500;
  user-select: none;
}

.console-base {
  color: var(--sub);
  user-select: none;
}

.console-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cream);
  font-family: var(--mono);
  font-size: 0.85rem;
  caret-color: var(--gold);
}

.console-input::placeholder {
  color: var(--faint);
  font-style: italic;
}

.run-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid var(--gold-dim);
  background: var(--gold-dim);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s var(--ease);
}

.run-btn:hover {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}

/* Presets */
.console-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.preset {
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--sub);
  font-family: var(--mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
}

.preset:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

/* Output */
.console-output {
  padding: 16px;
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
}

.output-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.output-line.comment { color: var(--muted); font-style: italic; }
.output-line.key { color: var(--sub); }
.output-line.string { color: var(--gold); }
.output-line.number { color: var(--cream); }
.output-line.error { color: var(--err); }
.output-line.url { color: var(--muted); font-size: 0.75rem; margin-top: 8px; }

/* Console scrollbar */
.console-output::-webkit-scrollbar { width: 6px; }
.console-output::-webkit-scrollbar-track { background: transparent; }
.console-output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Reference ──────────────────────────── */
.reference-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.ref-block {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.ref-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ref-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.ref-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(201, 169, 110, 0.25);
}

.ref-method.err {
  background: var(--err-dim);
  color: var(--err);
  border-color: rgba(196, 92, 79, 0.25);
}

.ref-method.sys {
  background: rgba(107, 154, 115, 0.12);
  color: var(--ok);
  border-color: rgba(107, 154, 115, 0.25);
}

.ref-endpoint {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--cream);
}

.ref-endpoint .param {
  color: var(--gold);
}

.ref-desc {
  color: var(--sub);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 16px;
  max-width: 640px;
}

.ref-code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.8;
}

.ref-code.err {
  border-color: rgba(196, 92, 79, 0.2);
}

.ref-code .key { color: var(--sub); }
.ref-code .str { color: var(--gold); }
.ref-code .num { color: var(--cream); font-weight: 500; }

.ref-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ref-examples code {
  padding: 5px 12px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--sub);
  transition: all 0.15s;
}

.ref-examples code:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ─── Footer ─────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 100vw;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.footer-inner a { font-size: 0.72rem; }

/* ─── Responsive ─────────────────────────── */
@media (max-width: 700px) {
  .hero { padding: 48px 20px 32px; }

  .hero-inner {
    flex-direction: column;
    gap: 32px;
  }

  .clock-face {
    width: 200px;
    height: 200px;
  }

  .readout {
    max-width: 100%;
    text-align: center;
  }

  .readout-time { font-size: 2.8rem; }

  .readout-cell { flex-direction: column; gap: 4px; align-items: center; }
  .readout-value { text-align: center; }

  .console-input-row {
    flex-wrap: wrap;
  }

  .console-base { display: none; }

  .console-input { min-width: 100%; order: 5; margin-top: 8px; }

  .topbar-nav { gap: 16px; font-size: 0.72rem; }

  .footer-inner {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .ref-examples { flex-direction: column; }
}

/* ─── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
