/* ==========================================================================
   claudelimits.com

   Nods to n450s.com rather than copying it: JetBrains Mono for every number,
   label and datum; square-ish cards; one flat accent. Prose is set in a normal
   sans so the page stays readable at length. No gradients anywhere.
   ========================================================================== */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
}

:root {
  color-scheme: light dark;

  --bg: #fdfcf9;
  --surface: #ffffff;
  --surface-2: #f6f4ef;
  --ink: #1f1e1c;
  --ink-2: #4a4744;
  --muted: #7c7770;
  --line: #e5e1d8;
  --line-2: #cfc9bd;

  --accent: #c2603a;
  --accent-2: #d97757;
  --accent-wash: #fbf0ea;

  --good: #2f7d55;
  --warn: #a8761b;
  --bad: #b8452f;

  --r: 8px;
  --r-sm: 5px;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --maxw: 960px;
}

:root[data-theme='dark'] {
  --bg: #191817;
  --surface: #211f1e;
  --surface-2: #2a2725;
  --ink: #f2efe9;
  --ink-2: #cbc6bf;
  --muted: #928c84;
  --line: #33302d;
  --line-2: #46423e;
  --accent: #e08a6a;
  --accent-2: #d97757;
  --accent-wash: #2c2320;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #191817;
    --surface: #211f1e;
    --surface-2: #2a2725;
    --ink: #f2efe9;
    --ink-2: #cbc6bf;
    --muted: #928c84;
    --line: #33302d;
    --line-2: #46423e;
    --accent: #e08a6a;
    --accent-2: #d97757;
    --accent-wash: #2c2320;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5em; font-weight: 600; line-height: 1.22; letter-spacing: -.02em; }
h1 { font-size: clamp(1.55rem, 3.6vw, 2.15rem); }
h2 { font-size: clamp(1.15rem, 2.4vw, 1.45rem); }
h3 { font-size: .96rem; font-weight: 600; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Anything that is a number, a label, or a datum is mono. That is the n450s nod. */
.mono, .num, .k, .eyebrow, .tag, .field-label, .hint,
.facts .n, .score-big, .card-slot, .card-domain,
.tbl td.num, .tbl th, .ev-date, .wordmark { font-family: var(--mono); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 1.75rem); }

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

/* ---------------------------------------------------------------- surfaces */

.box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1rem, 2.6vw, 1.4rem);
}
.box.tint { background: var(--surface-2); }

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.site-header .wrap { display: flex; align-items: center; gap: .85rem; min-height: 56px; }

.wordmark {
  font-weight: 700; font-size: .95rem; letter-spacing: -.04em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.wordmark .tld { color: var(--accent); }

.header-note {
  font-family: var(--mono);
  font-size: .68rem; color: var(--muted);
  padding-left: .85rem; border-left: 1px solid var(--line-2);
  letter-spacing: .02em;
}
@media (max-width: 600px) { .header-note { display: none; } }

.site-header nav { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.site-header nav a {
  font-size: .82rem; color: var(--muted); text-decoration: none;
  padding: .35rem .6rem; border-radius: var(--r-sm);
}
.site-header nav a:hover { color: var(--ink); background: var(--surface-2); }
@media (max-width: 460px) { .site-header nav a { display: none; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }
:root[data-theme='dark'] .icon-btn .sun { display: none; }
:root[data-theme='light'] .icon-btn .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .icon-btn .sun { display: none; } }
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) .icon-btn .moon { display: none; } }

/* ---------------------------------------------------------------- sections */

.band { padding: clamp(1.8rem, 4.5vw, 3rem) 0; }
.band + .band { border-top: 1px solid var(--line); }

.section-head { margin-bottom: 1.2rem; max-width: 66ch; }
.section-head p { color: var(--muted); font-size: .89rem; margin-bottom: 0; }

.eyebrow {
  display: block; font-size: .67rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .55rem;
}

/* ---------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > * { min-width: 0; max-width: 100%; }
.field label, .field-label {
  font-size: .69rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted);
}
.hint { font-size: .71rem; color: var(--muted); line-height: 1.45; }

input[type='text'], input[type='password'], input[type='number'],
input[type='time'], input[type='datetime-local'], input[type='url'],
select, textarea {
  width: 100%; min-width: 0;
  font-family: var(--mono); font-size: .84rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: .5rem .6rem;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
textarea { resize: vertical; min-height: 70px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: var(--sans); font-size: .85rem; font-weight: 550;
  padding: .5rem 1rem; border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: .32rem .65rem; font-size: .78rem; }

.honeypot { position: absolute !important; left: -9999px !important; opacity: 0; height: 0; pointer-events: none; }

.seg {
  display: grid; grid-auto-flow: column;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden;
}
.seg button {
  font-family: var(--mono); font-size: .75rem; font-weight: 500;
  padding: .42rem .3rem; border: 0; cursor: pointer;
  background: var(--surface); color: var(--muted);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--accent); color: #fff; }
.seg button:hover:not([aria-pressed='true']) { background: var(--surface-2); color: var(--ink); }

/* ---------------------------------------------------------------- calculator */

.calc { display: grid; grid-template-columns: minmax(0, 258px) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
@media (max-width: 800px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.calc-controls { display: grid; gap: .85rem; }
.calc-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .6rem; }

/* ---------------------------------------------------------------- share card */

/* The one element that carries a heavier frame: it is the thing people screenshot. */
.card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  position: relative;
}

.card-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
  padding-bottom: .65rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.card-domain { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: -.02em; }
.card-domain b { color: var(--accent); }
.card-slot { font-size: .76rem; font-weight: 500; text-align: right; color: var(--ink-2); }

.score-row { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.score-big {
  font-size: clamp(3.2rem, 11vw, 4.4rem); font-weight: 700; line-height: .88;
  letter-spacing: -.06em; font-variant-numeric: tabular-nums; color: var(--accent);
}
.score-side { flex: 1 1 200px; min-width: 0; }
.score-label {
  display: inline-block; font-size: .8rem; font-weight: 600;
  background: var(--accent); color: #fff;
  padding: .12rem .5rem; border-radius: 3px; margin-bottom: .4rem;
}
.score-sub { font-size: .82rem; color: var(--muted); }

.card[data-tone='great'] .score-big, .card[data-tone='good'] .score-big { color: var(--good); }
.card[data-tone='great'] .score-label, .card[data-tone='good'] .score-label { background: var(--good); }
.card[data-tone='bad'] .score-big { color: var(--bad); }
.card[data-tone='bad'] .score-label { background: var(--bad); }
.card[data-tone='poor'] .score-big { color: var(--warn); }
.card[data-tone='poor'] .score-label { background: var(--warn); }

.meter {
  height: 10px; margin-top: 1rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); overflow: hidden;
}
.meter i { display: block; height: 100%; background: var(--accent); }
.card[data-tone='great'] .meter i, .card[data-tone='good'] .meter i { background: var(--good); }
.card[data-tone='bad'] .meter i { background: var(--bad); }
.card[data-tone='poor'] .meter i { background: var(--warn); }
.meter-scale {
  display: flex; justify-content: space-between; font-family: var(--mono);
  font-size: .66rem; color: var(--muted); margin-top: .3rem;
}

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 1px; margin-top: 1.1rem;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden;
}
.facts div { background: var(--surface); padding: .6rem .7rem; }
.facts .n { display: block; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.facts .k {
  display: block; font-size: .62rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; margin-top: .15rem;
}

.card-foot {
  margin-top: 1rem; padding-top: .7rem; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .68rem; color: var(--muted);
}

.share-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .85rem; }

/* ---------------------------------------------------------------- charts */

.chart { display: block; width: 100%; }
.chart text { font-family: var(--mono); fill: var(--muted); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .axis-strong { stroke: var(--line-2); stroke-width: 1; }
.chart .band-fill { fill: var(--accent-wash); }
.chart .curve { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .you-line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .you-dot { fill: var(--ink); }

.scroll-x { overflow-x: auto; }

.legend {
  display: flex; gap: 1rem; flex-wrap: wrap; font-family: var(--mono);
  font-size: .7rem; color: var(--muted); margin-top: .7rem;
}
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 10px; height: 10px; display: block; border-radius: 2px; }

/* ---------------------------------------------------------------- year dial */

.dial-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 250px); gap: 1.4rem; align-items: center; }
@media (max-width: 740px) { .dial-wrap { grid-template-columns: minmax(0,1fr); } }

.dial { display: block; width: 100%; max-width: 420px; margin-inline: auto; }
.dial .ring { fill: none; stroke: var(--line-2); stroke-width: 1; }
.dial .month-line { stroke: var(--line); stroke-width: 1; }
.dial .month-label { font-family: var(--mono); font-size: 9px; fill: var(--muted); letter-spacing: .05em; }
.dial .spoke { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.dial .spoke.weak { stroke: var(--line-2); stroke-width: 2; }
.dial .spoke-cap { fill: var(--accent); }
.dial .center-n { font-family: var(--mono); font-weight: 700; fill: var(--ink); text-anchor: middle; }
.dial .center-k {
  font-family: var(--mono); font-size: 8px; fill: var(--muted);
  text-anchor: middle; letter-spacing: .1em;
}

/* ---------------------------------------------------------------- reset activity bars */

/* Bars are direct grid children with an explicit pixel height set in JS.
   A nested flex wrapper here fought the height and stretched empty buckets. */
.dd {
  display: grid; grid-template-columns: repeat(var(--dd-cols, 20), minmax(14px, 1fr));
  align-items: end; gap: 4px; height: 120px;
  border-bottom: 1px solid var(--line-2); min-width: 540px;
}
.dd-bar { width: 100%; align-self: end; background: var(--accent); border-radius: 2px 2px 0 0; }
/* Deliberately not ".empty": that is the global no-data placeholder, whose
   1.4rem padding silently floored these bars at 45px under border-box. */
.dd-bar.is-quiet { background: var(--line); }
.dd-axis {
  display: grid; grid-template-columns: repeat(var(--dd-cols, 20), minmax(14px, 1fr));
  gap: 4px; margin-top: .45rem; min-width: 540px;
}
.dd-axis span {
  font-family: var(--mono); font-size: .58rem; color: var(--muted);
  text-align: center; white-space: nowrap; overflow: visible;
}

/* ---------------------------------------------------------------- tables */

.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tbl th, .tbl td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.tbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }

.gain-bar { height: 7px; background: var(--accent); border-radius: 2px; min-width: 2px; }

/* ---------------------------------------------------------------- record list */

.events { display: grid; gap: .55rem; }
.ev {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: .9rem;
  border: 1px solid var(--line); border-radius: var(--r); padding: .75rem .9rem;
  background: var(--surface);
}
.ev > * { min-width: 0; }
.ev:hover { border-color: var(--line-2); }
.ev.reset { border-left: 3px solid var(--accent); }
@media (max-width: 620px) { .ev { grid-template-columns: minmax(0,1fr); gap: .35rem; } }
.ev-date { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.45; }
.ev-date b { display: block; color: var(--ink); font-weight: 500; }
.ev-title { font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.ev-quote {
  font-size: .82rem; color: var(--ink-2); border-left: 2px solid var(--line-2);
  padding-left: .65rem; margin: .45rem 0; font-style: italic;
}
.ev-sum { font-size: .82rem; color: var(--muted); }
.ev-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; align-items: center; }

.tag {
  font-size: .63rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  padding: .1rem .4rem; border-radius: 3px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  max-width: 100%; overflow-wrap: anywhere;
}
.tag.on { background: var(--accent-wash); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

.filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.filters button[aria-pressed='true'] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------------------------------------------------------------- pulse */

.pulse {
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: .75rem .95rem; background: var(--surface);
}
.pulse.hot { border-color: var(--accent); background: var(--accent-wash); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.pulse.hot .pulse-dot { background: var(--accent); }
.pulse-txt { flex: 1 1 220px; font-size: .83rem; color: var(--muted); }
.pulse-txt b { color: var(--ink); font-weight: 600; }

.msg { font-size: .8rem; padding: .4rem .6rem; border-radius: var(--r-sm); margin-top: .6rem; }
.msg.ok  { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.msg.err { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.msg:empty { display: none; }

.note {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: .6rem .8rem;
  font-size: .79rem; color: var(--muted); background: var(--surface-2);
}
.note b { color: var(--ink); font-family: var(--mono); font-weight: 500; }

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

.site-footer {
  border-top: 1px solid var(--line); padding: 2rem 0 2.8rem;
  font-size: .8rem; color: var(--muted); background: var(--surface-2);
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 1.6rem; justify-content: space-between; align-items: flex-start; }
.site-footer a { color: var(--ink-2); }

.by { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.by-link {
  display: inline-flex; align-items: center; gap: .4rem;
  text-decoration: none; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: .35rem .6rem; background: var(--surface);
}
.by-link:hover { border-color: var(--accent); background: var(--accent-wash); }

/* Both marks are <img>-loaded SVGs. Their fill="currentColor" resolves against
   the SVG's own document, not this page, so they render black whatever the
   theme is. On the dark canvas that is black-on-black — give them an orange
   plate to sit on instead of trying to recolour something we cannot reach. */
:root[data-theme='dark'] .by-link {
  background: var(--accent);
  border-color: var(--accent);
}
:root[data-theme='dark'] .by-link:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .by-link {
    background: var(--accent);
    border-color: var(--accent);
  }
  :root:not([data-theme='light']) .by-link:hover {
    background: var(--accent-2);
    border-color: var(--accent-2);
  }
}
.by-label {
  font-family: var(--mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); margin-bottom: .45rem;
}
.logo-450 { height: 12px; width: auto; display: block; color: var(--ink); }
.logo-n450s { height: 14px; width: auto; display: block; color: var(--ink); }

/* ---------------------------------------------------------------- admin */

.admin-shell { max-width: 1080px; margin-inline: auto; padding: 1.6rem clamp(1rem,4vw,1.75rem) 3rem; }
.login-card { max-width: 360px; margin: 11vh auto; }
.admin-tabs { display: flex; gap: .3rem; margin-bottom: 1.4rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.admin-tabs button {
  font-family: var(--sans); font-size: .84rem; font-weight: 550;
  background: none; color: var(--muted); cursor: pointer;
  border: 0; border-bottom: 2px solid transparent; padding: .5rem .8rem;
}
.admin-tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--accent); }

.admin-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.admin-table th, .admin-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { font-family: var(--mono); font-size: .64rem; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.admin-table tr:hover td { background: var(--surface-2); }
.admin-table .actions { white-space: nowrap; text-align: right; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px,100%), 1fr)); gap: .75rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.checks label { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--muted); }
input[type='checkbox'] { accent-color: var(--accent); width: 14px; height: 14px; }

.empty { color: var(--muted); font-size: .84rem; padding: 1.4rem; text-align: center; }
