/* Fossyl — Field Notes design system */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=JetBrains+Mono:wght@300;400;500;600&family=Geist:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0B0C0D;
  --bg-1: #111214;
  --bg-2: #16181B;
  --bg-3: #1C1E22;
  --panel: #121315;
  --line: #22252A;
  --line-2: #2C3036;
  --ink: #E8E6E1;
  --ink-dim: #B8B4AC;
  --muted: #8A8680;
  --dim: #52504B;
  --faint: #35332F;

  --bone: oklch(0.82 0.05 78);
  --bone-dim: oklch(0.62 0.04 78);
  --rust: oklch(0.64 0.14 35);
  --rust-dim: oklch(0.48 0.10 35);
  --lichen: oklch(0.72 0.08 125);
  --lichen-dim: oklch(0.55 0.06 125);
  --slate: oklch(0.70 0.05 230);
  --slate-dim: oklch(0.52 0.04 230);

  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --u: 8px;
  --r-sm: 2px;
  --r: 3px;
  --r-lg: 4px;
}

/* Light mode override */
:root[data-theme="light"] {
  --bg: #F3F0E9;
  --bg-1: #EDEAE2;
  --bg-2: #E6E3DA;
  --bg-3: #DBD8CE;
  --panel: #F8F5EE;
  --line: #D6D2C6;
  --line-2: #C4BFB0;
  --ink: #1A1915;
  --ink-dim: #3A382F;
  --muted: #6B6760;
  --dim: #8F8B82;
  --faint: #B8B4A8;
  --bone: oklch(0.42 0.06 55);
  --bone-dim: oklch(0.58 0.04 55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv11';
}

/* Density compact */
:root[data-density="compact"] { font-size: 13px; --u: 6px; }
:root[data-density="compact"] .pad { padding: 12px 16px; }

a { color: inherit; text-decoration: none; }

/* ---------- Type ---------- */
.display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.sans { font-family: var(--sans); }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 400;
}

.caps {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 400;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Layout primitives ---------- */
.hr { height: 1px; background: var(--line); border: 0; }
.vr { width: 1px; background: var(--line); align-self: stretch; }
.hairline { border: 1px solid var(--line); }

.row { display: flex; }
.col { display: flex; flex-direction: column; }
.g-8 { gap: 8px; } .g-12 { gap: 12px; } .g-16 { gap: 16px; } .g-24 { gap: 24px; } .g-32 { gap: 32px; } .g-48 { gap: 48px; }
.ai-c { align-items: center; } .ai-s { align-items: flex-start; } .ai-e { align-items: flex-end; }
.jc-b { justify-content: space-between; } .jc-c { justify-content: center; } .jc-e { justify-content: flex-end; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  letter-spacing: -0.005em;
}
.btn:hover { background: var(--bg-2); border-color: var(--muted); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--bone); border-color: var(--bone); color: #0B0C0D; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-2); border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 14px; }

/* ---------- Badge / pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--ink-dim);
  background: transparent;
  white-space: nowrap;
}
.badge.risk { color: var(--rust); border-color: var(--rust-dim); }
.badge.safe { color: var(--lichen); border-color: var(--lichen-dim); }
.badge.info { color: var(--slate); border-color: var(--slate-dim); }
.badge.warn { color: var(--bone); border-color: var(--bone-dim); }
.badge.solid { background: var(--bg-2); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.risk { background: var(--rust); }
.dot.safe { background: var(--lichen); }
.dot.info { background: var(--slate); }
.dot.warn { background: var(--bone); }

/* ---------- Card / panel ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel-h {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-b { padding: 16px; }

/* ---------- Form ---------- */
.input, .textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  border-radius: var(--r);
  outline: none;
  transition: border-color 120ms, background 120ms;
}
.input:focus, .textarea:focus { border-color: var(--bone-dim); background: var(--bg-2); }
.input.mono { font-family: var(--mono); }
.label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-dim);
  vertical-align: middle;
}
.table tr:hover td { background: var(--bg-1); }
.table tr:last-child td { border-bottom: 0; }

/* ---------- Stratigraphic bar ---------- */
.strata { display: flex; height: 6px; border-radius: 1px; overflow: hidden; background: var(--bg-2); }
.strata > span { display: block; height: 100%; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- Tick marks (measurement) ---------- */
.ticks {
  height: 10px;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: 8px 100%;
  background-position: 0 bottom;
  background-repeat: repeat-x;
  border-bottom: 1px solid var(--line);
}

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.ink-dim { color: var(--ink-dim); }
.ink { color: var(--ink); }
.bone { color: var(--bone); }
.rust { color: var(--rust); }
.lichen { color: var(--lichen); }
.slate { color: var(--slate); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.upper { text-transform: uppercase; letter-spacing: 0.1em; }

.grid-lines {
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
}
.grid-lines-faint {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* margin notes */
.marginalia {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  border-left: 1px solid var(--line-2);
  padding-left: 12px;
}

/* corner marks */
.corners { position: relative; }
.corners::before, .corners::after,
.corners > .cbl, .corners > .cbr {
  content: ''; position: absolute; width: 8px; height: 8px;
  border-color: var(--muted); pointer-events: none;
}
.corners::before { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.corners::after { top: -1px; right: -1px; border-top: 1px solid; border-right: 1px solid; }
.corners > .cbl { bottom: -1px; left: -1px; border-bottom: 1px solid var(--muted); border-left: 1px solid var(--muted); }
.corners > .cbr { bottom: -1px; right: -1px; border-bottom: 1px solid var(--muted); border-right: 1px solid var(--muted); }

/* blinker */
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
.blink { animation: blink 1.1s steps(1) infinite; }

/* fossil mark */
.fossil-mark {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  position: relative;
}
.fossil-mark::before {
  content: ''; position: absolute; inset: 2px;
  border: 1px solid currentColor; transform: rotate(45deg);
}
.fossil-mark::after {
  content: ''; position: absolute; inset: 5px;
  background: currentColor;
}

/* wordmark "F" */
.wordmark {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wordmark .glyph {
  width: 22px; height: 22px;
  border: 1px solid var(--ink);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  font-weight: 500;
  position: relative;
}
.wordmark .glyph::after {
  content: ''; position: absolute; width: 4px; height: 4px;
  background: var(--bone); border-radius: 50%;
  bottom: -2px; right: -2px;
}
