/* Zerno design system v2.
   Matches support.zerno.co and zerno.co: Barlow headlines, Inter text, square
   corners, white pages with soft gray panels, hairline rules. Borrows a few
   technical cues from fragment.ai: monospace labels, structural grid lines,
   chamfered panels. Bronze (the burr / wood tone) marks "you are here". */

@font-face { font-family: 'Barlow'; src: url('/assets/shared/fonts/barlow-latin-300-normal.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/shared/fonts/barlow-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/shared/fonts/barlow-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/shared/fonts/barlow-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/assets/shared/fonts/inter-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/shared/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/shared/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  /* ink */
  --ink: #121212;
  --ink-2: #1c1c1c;
  --ink-3: #2b2b2b;
  --ink-4: #3d3d3d;
  /* surfaces */
  --white: #ffffff;
  --paper: #f2f2f2;          /* help center tile gray */
  --paper-2: #e9e9e7;
  --paper-3: #dcdcd9;
  --line: #d9d9d9;           /* hairline */
  --line-strong: #121212;    /* tile borders like the help center */
  --line-dark: #2e2e2e;
  /* text */
  --text: #2b2b2b;
  --muted: #8a8a8a;
  --muted-dark: #a3a3a3;
  /* accent + status */
  --bronze: #957760;
  --bronze-ink: #6e5543;
  --bronze-soft: #efe8e1;
  --ok: #3d6b4f;
  --ok-soft: #e4ede7;
  --bad: #9b3c30;
  --bad-soft: #f5e4e0;
  --warn: #8a6a2d;
  --warn-soft: #f4ecdc;
  /* shape */
  --radius: 0px;
  --radius-sm: 0px;
  --shadow: 0 1px 0 rgba(18, 18, 18, 0.04), 0 12px 32px rgba(18, 18, 18, 0.08);
  --chamfer: 14px;
  /* type */
  --display: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --track: 0.03em;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: var(--track);
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}
body.theme-dark { background: var(--ink); color: rgba(255, 255, 255, .78); }

h1, h2, h3, h4 { margin: 0 0 .4em; font-family: var(--display); color: var(--ink); line-height: 1.08; letter-spacing: 0.01em; }
.theme-dark h1, .theme-dark h2, .theme-dark h3, .theme-dark h4 { color: #fff; }
h1 { font-size: clamp(34px, 5.2vw, 57px); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 400; }
h3 { font-size: 20px; font-weight: 500; }
h4 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.theme-dark .muted { color: var(--muted-dark); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.display { font-family: var(--display); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Eyebrows: help-center caps, set in mono like fragment's labels */
.eyebrow { font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 400; color: var(--muted); margin-bottom: 12px; }
.theme-dark .eyebrow { color: var(--muted-dark); }

/* Wordmark */
.wordmark { display: inline-block; height: 20px; width: auto; vertical-align: middle; }
.wordmark.lg { height: 30px; }

/* Section label with hairline, as on the help center ("CHOOSE YOUR GRINDER") */
.rule-title { display: block; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.rule-title > span { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.theme-dark .rule-title { border-color: var(--line-dark); }

/* Buttons: square, quiet, letter-spaced like zerno.co */
.btn {
  appearance: none; border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 500; font-size: 14px; letter-spacing: .06em;
  padding: 11px 20px; border-radius: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-4); border-color: var(--ink-4); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn-block { width: 100%; }
.btn .arrow::after, .btn-arrow::after { content: '\2192'; font-family: var(--font); }
.theme-dark .btn { border-color: #fff; color: #fff; }
.theme-dark .btn:hover { background: #fff; color: var(--ink); }
.theme-dark .btn-primary { background: #fff; color: var(--ink); }
.theme-dark .btn-primary:hover { background: var(--paper); }

/* Forms: square fields, dark focus like the help center search */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 12px; font-weight: 500; letter-spacing: .04em; margin-bottom: 7px; color: var(--ink-3); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff; letter-spacing: .02em;
  border: 1px solid #c8c8c8; border-radius: 0; padding: 11px 14px; min-height: 46px;
  transition: border-color .15s;
}
input:hover, select:hover, textarea:hover { border-color: #9a9a9a; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 104px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a6a6a6; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--ink); width: 16px; height: 16px; }

/* Panels and tiles */
.card { background: #fff; border: 1px solid var(--line); border-radius: 0; padding: 24px; }
.card + .card { margin-top: 16px; }
.tile { background: var(--paper); padding: 24px; }
.tile-outline { border: 1px solid var(--line-strong); padding: 24px; background: #fff; }
.chamfer { clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%); }
.chamfer-bl { clip-path: polygon(0 0, 100% 0, 100% 100%, var(--chamfer) 100%, 0 calc(100% - var(--chamfer))); }

/* Structural frame: hairline gutters left and right, like fragment.ai */
.frame { position: relative; }
.frame::before, .frame::after { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); pointer-events: none; }
.frame::before { left: 0; }
.frame::after { right: 0; }
.theme-dark .frame::before, .theme-dark .frame::after { background: var(--line-dark); }

/* Chips: square tags in mono caps */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 0;
  background: var(--paper); color: var(--ink-3); white-space: nowrap; line-height: 1.5;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ink { background: var(--ink); color: #fff; }
.chip.bronze { background: var(--bronze-soft); color: var(--bronze-ink); }
.chip.outline { background: transparent; border: 1px solid currentColor; }

/* Dial: tick-mark progress from the grind adjustment ring */
.dial { position: relative; padding: 26px 0 0; }
.dial-scale {
  height: 24px; position: relative; border-bottom: 1px solid currentColor;
  background-image:
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 100%);
  background-size: calc(100% / var(--n, 6)) 16px, calc(100% / (var(--n, 6) * 5)) 7px;
  background-repeat: repeat-x; background-position: left bottom, left bottom;
  opacity: .85;
}
.dial-fill { position: absolute; left: 0; bottom: 0; height: 24px; background: linear-gradient(90deg, transparent, rgba(149, 119, 96, .2)); pointer-events: none; }
.dial-pointer { position: absolute; top: 0; width: 10px; height: 22px; transform: translateX(-50%); }
.dial-pointer::before { content: ''; position: absolute; left: 50%; top: 0; transform: translateX(-50%); border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 22px solid var(--bronze); }
.dial-labels { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); margin-top: 10px; }
.dial-labels span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-right: 4px; }
.dial-labels span.done { color: inherit; }
.dial-labels span.current { color: var(--bronze); font-weight: 500; }
.theme-dark .dial-labels span { color: var(--muted-dark); }
.theme-dark .dial-labels span.done { color: #fff; }
.theme-dark .dial-labels span.current { color: var(--bronze); }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); }
.toast { background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 0; box-shadow: var(--shadow); font-size: 14px; border-left: 3px solid var(--bronze); }
.toast.bad { border-left-color: #e0806f; }

/* Utility */
.stack > * + * { margin-top: 12px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 20px 0; }
.spinner { width: 15px; height: 15px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.demo-banner { background: var(--bronze); color: #fff; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; text-align: center; padding: 8px 12px; }
.demo-banner a { color: #fff; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
