@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/InterTight-VariableFont_wght.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/assets/fonts/JetBrainsMono-VariableFont_wght.woff2") format("woff2");
}

:root {
    --paper: #f3efe4;
    --paper-2: #ece7d6;
    --ink: #0a0a0a;
    --ink-soft: #2a2a28;
    --muted: #7a7668;
    --rule: #0a0a0a;
    --accent: #f38020;
    --acid: #d7ec3f;

    --font-display: "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    --font-body: "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    --font-mono: "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
p + p { margin-top: 1em; }

html {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.5;
}
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* Background grid — subtle dot pattern like blueprint paper */
.paper {
    background-color: var(--paper);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(10,10,10,0.08) 1px, transparent 0);
    background-size: 24px 24px;
}

/* Page frame */
.frame {
    max-width: 1280px;
    margin: 0 auto;
    border-left: 1.5px solid var(--rule);
    border-right: 1.5px solid var(--rule);
    min-height: 100vh;
    position: relative;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-bottom: 1.5px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.topbar .brand::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--ink);
    display: inline-block;
}
.topbar .links { display: flex; gap: 1.5rem; }
.topbar .links a { text-decoration: none; }
.topbar .links a:hover { text-decoration: underline; }
@media (max-width: 34rem) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.75rem 1.25rem;
    }
    .topbar .links { gap: 1rem; }
}

/* Eyebrow tag — package-style */
.eyebrow {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border: 1.5px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--paper);
}

/* Hero */
.hero {
    border-bottom: 1.5px solid var(--rule);
    padding: 3.5rem 1.5rem 2rem;
    position: relative;
}
.hero h1 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.85rem, 9vw, 8rem);
    line-height: 0.85;
    letter-spacing: -0.03em;
    margin: 1.5rem 0 0;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.hero h1 .dot { color: var(--accent); }
.hero .tagline {
    max-width: 40rem;
    font-size: clamp(1.05rem, 1.6vw, 1.375rem);
    line-height: 1.4;
    margin: 1.5rem 0 0;
    color: var(--ink-soft);
}
.hero .tagline strong { font-weight: 700; color: var(--ink); }

.hero-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 2.5rem;
    border-top: 1.5px solid var(--rule);
    border-bottom: 1.5px solid var(--rule);
}
.hero-meta > div {
    padding: 1rem 1.25rem;
    border-right: 1.5px solid var(--rule);
}
.hero-meta > div:last-child { border-right: 0; }
.hero-meta dt {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.35rem;
}
.hero-meta dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}
@media (max-width: 40rem) {
    .hero-meta { grid-template-columns: repeat(2, 1fr); }
    .hero-meta > div:nth-child(2) { border-right: 0; }
    .hero-meta > div:nth-child(1), .hero-meta > div:nth-child(2) {
        border-bottom: 1.5px solid var(--rule);
    }
}

.section {
    border-bottom: 1.5px solid var(--rule);
    padding: 3rem 1.5rem;
    position: relative;
}
.section-acid { background: var(--acid); }
.section-acid .intro,
.section-acid p { color: var(--ink); }
.section-acid .offset-hint { color: var(--ink-soft); }
.section h2 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 7vw, 5rem);
    line-height: 0.88;
    letter-spacing: -0.03em;
    margin: 0 0 1.5rem;
    color: var(--ink);
}
.section .intro {
    max-width: 40rem;
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--ink-soft);
    margin: 0 0 2.5rem;
}

/* Live clock block — the hero card */
.clock-wrap {
    border: 1.5px solid var(--rule);
    background: var(--ink);
    color: #e6e4dc;
    padding: 2rem 2rem 2rem;
    position: relative;
    overflow: hidden;
}
.clock-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}
.clock-wrap > * { position: relative; }
.clock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9a9685;
    margin-bottom: 1rem;
}
.clock-header .pulse {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.clock-header .pulse::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.85); }
}

.clock-main {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    font-size: clamp(1.75rem, 7vw, 5rem);
    color: #f5f2e7;
    margin: 0.5rem 0 1rem;
}
.clock-main > span { white-space: nowrap; }

.clock-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    margin-top: 1.5rem;
}
.clock-grid > div { min-width: 0; }
.clock-grid dt {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9a9685;
    margin: 0 0 0.4rem;
}
.clock-grid dt a { color: inherit; text-decoration: none; border-bottom: 1px dotted #9a9685; }
.clock-grid dt a:hover { color: #f5f2e7; }
.clock-grid dd {
    margin: 0;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1rem;
    color: #f5f2e7;
    word-break: break-word;
}
@media (max-width: 40rem) {
    .clock-grid { grid-template-columns: 1fr; gap: 1rem; }
}

.offset-hint {
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--muted);
    font-family: var(--font-mono);
}

/* Info grid (server details) */
.kv-grid {
    border: 1.5px solid var(--rule);
    background: var(--paper-2);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}
.kv-grid > div {
    padding: 1.25rem 1.5rem;
    border-bottom: 1.5px solid var(--rule);
    border-right: 1.5px solid var(--rule);
}
.kv-grid > div:nth-child(2n) { border-right: 0; }
.kv-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv-grid dt {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.35rem;
}
.kv-grid dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.kv-grid dd a { text-decoration: underline; text-decoration-thickness: 1.5px; }
@media (max-width: 40rem) {
    .kv-grid { grid-template-columns: 1fr; }
    .kv-grid > div {
        border-right: 0 !important;
        border-bottom: 1.5px solid var(--rule) !important;
    }
    .kv-grid > div:last-child { border-bottom: 0 !important; }
}

/* Code blocks — never wrap; scroll horizontally instead */
pre {
    background: var(--ink);
    color: #e6e4dc;
    border: 1.5px solid var(--rule);
    padding: 1.25rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre;
    margin: 0 0 1.25rem;
    overflow-x: auto;
    max-width: 100%;
}
pre::-webkit-scrollbar { height: 8px; }
pre::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
pre code {
    color: inherit;
    background: transparent;
    padding: 0;
    border: 0;
    font-size: inherit;
    font-family: inherit;
}
code {
    font-family: var(--font-mono);
    background: var(--paper-2);
    color: var(--ink);
    padding: 0.15em 0.4em;
    border: 1px solid rgba(10,10,10,0.15);
    font-size: 0.85em;
    word-break: break-all;
}

.rt-block {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1.5px solid var(--rule);
    background: var(--paper-2);
}
.rt-row {
    padding: 1.25rem 1.5rem;
    border-bottom: 1.5px solid var(--rule);
}
.rt-row:last-child { border-bottom: 0; }
.rt-row dt {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.5rem;
}
.rt-row dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    word-break: break-all;
}

/* Footer */
footer {
    border-top: 1.5px solid var(--rule);
    padding: 2rem 1.5rem;
    background: var(--paper);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}
footer a { color: var(--ink); }
@media (max-width: 40rem) {
    footer { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}

.section p { color: var(--ink-soft); }
.section h3 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    margin: 2rem 0 1rem;
}
.section h3 + p { margin-bottom: 1rem; }

/* Pulse state driven by the sync status observer */
.clock-header .pulse[data-state="idle"]::before {
    background: #f59e0b;
    animation: none;
}

/* Topbar health dot — acid when synced, matching the live sync section */
.topbar .brand[data-state="active"]::before {
    background: var(--acid);
    box-shadow: 0 0 0 3px rgba(215,236,63,0.3);
}

/* Loading skeleton for the main clock — shimmer until first sample */
.clock-main.loading {
    color: transparent;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 0%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
    animation: skeleton 1.4s ease-in-out infinite;
    border-radius: 2px;
}
@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Live offset sparkline */
.spark {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.spark-head {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9a9685;
}
.spark svg {
    width: 100%;
    height: 44px;
    display: block;
}
.spark svg polyline {
    fill: none;
    stroke: var(--acid);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.spark svg line.axis {
    stroke: rgba(255,255,255,0.18);
    stroke-width: 1;
    stroke-dasharray: 2 3;
}

/* Connect section — client config cards */
.connect-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1.5px solid var(--rule);
}
.connect-card {
    padding: 1.5rem;
    border-bottom: 1.5px solid var(--rule);
    background: var(--paper-2);
}
.connect-card:last-child { border-bottom: 0; }
.connect-card h3 {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.75rem;
}
.connect-card p {
    font-size: 0.95rem;
    margin: 0 0 0.85rem;
}
.connect-card pre {
    margin: 0;
}

.error-page .frame {
  border-right: 1.5px solid var(--rule);
  display: flex;
  flex-direction: column;
}

.error-page .eyebrow {
  width: fit-content;
}

.error-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3.5rem 1.5rem;
  border-bottom: 1.5px solid var(--rule);
}

.error-body h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(4rem, 15vw, 12rem);
  line-height: 0.85;
  letter-spacing: -0.03em;
  margin: 1.5rem 0 0;
  color: var(--ink);
}

.error-body h1 .dot {
  color: var(--accent);
}

.error-body .tagline {
  max-width: 40rem;
  font-size: clamp(1.05rem, 1.6vw, 1.375rem);
  line-height: 1.4;
  margin: 1.5rem 0 2rem;
  color: var(--ink-soft);
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}
