/* Tokens and patterns mirror teisoraFeAstro/src/styles (base.css, nav.css, account.css, contacts.css). */

@font-face {
  font-family: 'Open Sans'; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url('/fonts/open-sans-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Open Sans'; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url('/fonts/open-sans-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 {
  --paper: #fbfaf7;
  --ink: #16181c;
  --ink-soft: #4a4f57;
  --ink-faint: #8a8479;
  --rule: #d8d3c9;
  --rule-strong: #bfb8ab;
  --accent: #7a1f2b;
  --accent-deep: #5f1721;
  --wash: #f2efe8;
  --mute: #b9b3a8;
  --eyebrow: #857f74;

  /* Status (validated for CVD separation + 3:1 against the paper surface). */
  --up: #2a7a50;
  --up-fade: rgba(42, 122, 80, 0.10);
  --partial: #b07a10;
  --partial-fade: #fbe3a6;
  --partial-line: #d9a520;
  --down: #b3261e;
  --down-fade: rgba(179, 38, 30, 0.10);
  --empty: #e6e1d7;

  --font: 'Valley Sans', 'Open Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;
  --gutter: clamp(1rem, 4vw, 4rem);

  color-scheme: light;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { overflow-y: scroll; background: var(--paper); }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--paper); }
body > main { flex: 1 0 auto; }
a { color: inherit; }

/* Header */
.nav {
  max-width: 1440px; width: 100%; margin: 0 auto; min-height: 4.85rem;
  padding: 0.85rem var(--gutter) 0; display: flex; align-items: center; gap: 2rem;
  border-bottom: 1px solid var(--rule);
}
.nav__brand {
  display: flex; align-items: center; gap: 0.7rem; margin-right: auto; line-height: 1;
  font-size: 1.05rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink); text-decoration: none;
}
.nav__sub {
  padding-left: 0.7rem; border-left: 1px solid var(--rule);
  font-weight: 400; color: var(--ink-soft); letter-spacing: 0.01em;
}
.nav__back { font-size: 0.88rem; color: var(--ink-soft); text-decoration: none; transition: color .15s ease; }
.nav__back:hover { color: var(--accent); }

/* Layout */
.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding: clamp(2.5rem, 7vh, 4.5rem) var(--gutter) clamp(3rem, 8vh, 5rem); }
.title {
  margin: 0 0 1rem; padding-top: 1.4rem; border-top: 1px solid var(--ink);
  font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 300; line-height: 1.05; letter-spacing: -0.03em;
}
.lede { margin: 0 0 2rem; font-size: 1rem; font-weight: 300; line-height: 1.65; color: var(--ink-soft); }
.note { font-size: 0.9rem; color: var(--ink-soft); }
.eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--eyebrow); }

/* Overall banner */
.overall {
  display: flex; align-items: center; gap: 1rem; margin: 0 0 clamp(2.5rem, 6vh, 3.5rem);
  padding: 1.1rem 1.25rem; border: 1px solid var(--rule); border-radius: 10px; background: #fff;
  box-shadow: 0 4px 24px rgba(27, 27, 47, 0.07), 0 1px 4px rgba(27, 27, 47, 0.04);
}
.overall__dot { flex: none; width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--mute); }
.overall__body { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; flex: 1; min-width: 0; }
.overall__title { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
.overall__meta { font-size: 0.85rem; font-weight: 300; color: var(--ink-faint); }
.overall--operational { border-color: rgba(42, 122, 80, 0.3); background: linear-gradient(var(--up-fade), var(--up-fade)), #fff; }
.overall--operational .overall__dot { background: var(--up); box-shadow: 0 0 0 4px var(--up-fade); }
.overall--degraded { border-color: var(--partial-line); background: #fffaf0; }
.overall--degraded .overall__dot { background: var(--partial); box-shadow: 0 0 0 4px var(--partial-fade); }
.overall--down { border-color: rgba(179, 38, 30, 0.35); background: linear-gradient(var(--down-fade), var(--down-fade)), #fff; }
.overall--down .overall__dot { background: var(--down); box-shadow: 0 0 0 4px var(--down-fade); }
.overall--loading .overall__dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Panels (rule-topped sections) */
.panel { padding-top: 1.4rem; margin-bottom: clamp(2.5rem, 6vh, 3.5rem); border-top: 1px solid var(--ink); }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.panel__title { margin: 0; font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }

/* Service rows */
.svc { padding: 1.25rem 0 1.1rem; border-bottom: 1px solid var(--rule); }
.svc:last-child { border-bottom: 0; }
.svc__head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.svc__name { font-size: 1rem; font-weight: 500; }
.svc__desc { font-size: 0.85rem; font-weight: 300; color: var(--ink-faint); }
.svc__titles { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem; margin-right: auto; min-width: 0; }

.tag {
  flex: none; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.15rem 0.5rem; border: 1px solid var(--rule); border-radius: 4px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
  white-space: nowrap;
}
.tag::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.tag--operational, .tag--ok { color: var(--up); border-color: rgba(42, 122, 80, 0.35); }
.tag--degraded { color: #5c3d00; background: var(--partial-fade); border-color: var(--partial-line); }
.tag--degraded::before { background: var(--partial); }
.tag--down, .tag--danger { color: var(--down); border-color: rgba(179, 38, 30, 0.35); background: var(--down-fade); }
.tag--unknown { color: var(--ink-soft); background: var(--wash); }
.tag--unknown::before { background: var(--mute); }

/* 90-day uptime bars */
.bars { display: flex; gap: 2px; height: 34px; touch-action: manipulation; }
.bar {
  flex: 1 1 0; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 2px;
  background: var(--empty); cursor: default; transition: opacity .15s ease, transform .15s ease;
}
.bar--up { background: var(--up); }
.bar--partial { background: var(--partial); }
.bar--down { background: var(--down); }
.bars:hover .bar { opacity: 0.55; }
.bars .bar:hover, .bars .bar:focus-visible, .bar.is-active { opacity: 1; transform: scaleY(1.08); }
.bar:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bars__axis {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.45rem;
  font-size: 0.78rem; font-weight: 300; color: var(--ink-faint);
}
.bars__axis .uptime { color: var(--ink-soft); font-weight: 400; }
.bars__axis .rule { flex: 1; height: 1px; background: var(--rule); }

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.25rem 0 0; padding: 0; list-style: none; font-size: 0.78rem; font-weight: 300; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.legend i { width: 0.65rem; height: 0.65rem; border-radius: 2px; background: var(--empty); }
.legend .l-up { background: var(--up); }
.legend .l-partial { background: var(--partial); }
.legend .l-down { background: var(--down); }

/* Latency small multiples */
.spark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; margin-top: 1rem; }
.spark {
  position: relative; padding: 1rem 1.1rem 0.75rem; border: 1px solid var(--rule); border-radius: 10px; background: #fff;
}
.spark__head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.6rem; }
.spark__name { font-size: 0.88rem; font-weight: 500; }
.spark__value { font-size: 1.35rem; font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.spark__value small { font-size: 0.78rem; color: var(--ink-faint); margin-left: 0.15rem; }
.spark__plot { position: relative; height: 72px; touch-action: pan-y; }
.spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.spark__line { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark__area { fill: rgba(74, 79, 87, 0.07); stroke: none; }
.spark__grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark__fail { fill: var(--down); }
.spark__cross { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark__dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px #fff; pointer-events: none; }
.spark__foot { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: 0.72rem; font-weight: 300; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.spark__empty { display: grid; place-items: center; height: 100%; font-size: 0.82rem; color: var(--ink-faint); }

/* Incidents */
.incidents { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.incident { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.incident:last-child { border-bottom: 0; }
.incident__title { font-size: 0.96rem; font-weight: 500; }
.incident__time { grid-column: 1; font-size: 0.85rem; font-weight: 300; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.incident__err { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); }
.incident .tag { grid-column: 2; grid-row: 1; align-self: start; }
.incidents__empty { padding: 1rem 0; font-size: 0.92rem; font-weight: 300; color: var(--ink-soft); }

/* Tooltip */
.tip {
  position: fixed; z-index: 10; max-width: 16rem; padding: 0.55rem 0.75rem; pointer-events: none;
  border: 1px solid var(--rule); border-radius: 6px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-size: 0.8rem; line-height: 1.45; color: var(--ink); font-variant-numeric: tabular-nums;
}
.tip strong { display: block; font-weight: 600; }
.tip span { display: block; color: var(--ink-soft); font-weight: 300; }
.tip .tip__state { display: flex; align-items: center; gap: 0.4rem; color: var(--ink); font-weight: 400; }
.tip .tip__state::before { content: ''; width: 0.55rem; height: 0.55rem; border-radius: 2px; background: var(--empty); }
.tip .s-up::before { background: var(--up); }
.tip .s-partial::before { background: var(--partial); }
.tip .s-down::before { background: var(--down); }

/* Footer */
.footer { background: var(--paper); padding: 0 var(--gutter) clamp(1.75rem, 4vh, 2.5rem); }
.footer__inner {
  max-width: 1440px; margin: 0 auto; display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem;
  padding-top: 1.25rem; border-top: 1px solid var(--rule);
}
.footer__links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.footer__links a { font-size: 0.85rem; font-weight: 300; color: var(--ink-soft); text-decoration: none; transition: color .15s ease; }
.footer__links a:hover { color: var(--accent); }
.footer__copy { margin: 0; font-size: 0.85rem; font-weight: 300; color: #9a948a; }

@media (max-width: 640px) {
  .nav { gap: 1rem; }
  .nav__back { font-size: 0.82rem; }
  .bars { height: 30px; }
  .footer__inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .bar { forced-color-adjust: none; }
}
