/* ============================================================
   fuelbook — petrol teal + sand/shell. The E-to-F gauge motif.
   Light scheme default; dark via prefers-color-scheme.
   ============================================================ */

:root {
  --bg:        #FAF5EC;  /* shell white */
  --ink:       #0B3C49;  /* deep petrol teal */
  --muted:     #3F5B66;
  --card:      #EFE3CE;  /* shell */
  --card2:     #F5EDDD;
  --line:      #D9CBAA;
  --primary:   #0F4C5C;  /* teal */
  --primary-ink: #FAF5EC;
  --needle:    #B0742B;  /* sand, darkened for AA strokes on light */
  --sand:      #D9A05B;
  --accent-text: #8A5716;
  --danger:    #9B2C1B;
  --flag-bg:   #F3E2C0;
  --focus:     #0F4C5C;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --wrap: 1040px;
  --shadow: 0 14px 34px -22px rgba(11, 60, 73, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #062E38;  /* deep sea */
    --ink:       #F2E9D8;  /* shell */
    --muted:     #A9C4C7;
    --card:      #10505F;  /* teal tint */
    --card2:     #0B4250;
    --line:      #1E667A;
    --primary:   #E0B26E;  /* sand */
    --primary-ink: #062E38;
    --needle:    #E0B26E;
    --sand:      #E0B26E;
    --accent-text: #E8C68F;
    --danger:    #F5A48F;
    --flag-bg:   #0B4250;
    --focus:     #E0B26E;
    --shadow: 0 14px 34px -22px rgba(0, 0, 0, 0.6);
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0 0 0.5rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.12; }
h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.6rem; }
em { font-style: normal; color: var(--accent-text); font-weight: 600; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
main.wrap { padding-bottom: 3rem; }
section { margin: 2.2rem 0; }

[hidden] { display: none !important; }

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

/* ---------- skip link + focus ---------- */

.skip-link {
  position: absolute; left: 8px; top: -48px;
  background: var(--primary); color: var(--primary-ink);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none; font-weight: 600; z-index: 20;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

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

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

.site-header {
  border-bottom: 2px solid var(--line);
  background: var(--card2);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 14px; padding-bottom: 12px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; }
.brand-dial { width: 52px; height: 36px; }
.dial-arc  { stroke: var(--primary); stroke-width: 3.4; stroke-linecap: round; }
.dial-tick { stroke: var(--primary); stroke-width: 2.4; stroke-linecap: round; }
.dial-needle { stroke: var(--needle); stroke-width: 3.2; stroke-linecap: round; }
.dial-hub  { fill: var(--needle); }
.header-note { color: var(--muted); font-size: 0.9rem; }

/* ---------- sample banner ---------- */

.sample-banner {
  background: var(--sand);
  color: #2A1B04;
  border-bottom: 2px solid rgba(0,0,0,0.25);
}
.sample-row {
  display: flex; align-items: center; gap: 14px;
  padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap;
}
.sample-row strong { letter-spacing: 0.06em; }
.sample-banner .btn { background: #2A1B04; color: #F5E9CF; border-color: #2A1B04; }

/* ---------- hero ---------- */

.hero { margin-top: 2.4rem; }
.lede { max-width: 62ch; font-size: 1.06rem; }
.privacy-line { color: var(--muted); max-width: 62ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- arc divider (gauge ticks motif) ---------- */

.arc-divider { display: flex; justify-content: center; margin: 2rem 0 0; }
.arc-divider svg { width: 64px; height: 16px; }
.arc-divider path { stroke: var(--line); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 6 7; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font: inherit; font-weight: 650;
  padding: 10px 18px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--card2);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { background: var(--card); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-ghost { border-color: var(--line); }
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-small { padding: 6px 12px; font-size: 0.9rem; }

/* ---------- stat cards ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 0.86rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value {
  font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
  overflow-wrap: anywhere;
}
.stat-sub { font-size: 0.84rem; color: var(--muted); }
.stat-window { font-size: 0.8rem; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 6px; }

/* ---------- notes / errors / trend ---------- */

.note { color: var(--muted); font-size: 0.92rem; max-width: 70ch; }
.error { color: var(--danger); font-weight: 650; }
.trend-note {
  background: var(--flag-bg);
  border: 1px solid var(--line);
  border-left: 5px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  max-width: 70ch;
}

/* ---------- chart ---------- */

.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}
.chart-box svg { display: block; width: 100%; height: auto; }
.c-line { fill: none; stroke: var(--primary); stroke-width: 2.6; stroke-linejoin: round; }
.c-avg { fill: none; stroke: var(--needle); stroke-width: 2; stroke-dasharray: 7 6; }
.c-claimed { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 2 5; }
.c-dot { fill: var(--primary); stroke: var(--bg); stroke-width: 1.5; }
.c-dot-partial { fill: var(--needle); stroke: var(--ink); stroke-width: 1.5; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-text { fill: var(--muted); font-family: var(--sans); font-size: 11px; font-variant-numeric: tabular-nums; }
.c-text-strong { fill: var(--ink); font-family: var(--sans); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.c-empty-arc { stroke: var(--primary); stroke-width: 4; fill: none; stroke-linecap: round; }
.c-empty-needle { stroke: var(--needle); stroke-width: 4; stroke-linecap: round; }
.c-empty-hub { fill: var(--needle); }
.chart-legend-partial { color: var(--accent-text); }

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

.entry-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0.8rem 0 1.2rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
}
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-weight: 650; font-size: 0.92rem; }
.form-grid .span2 { grid-column: 1 / -1; }
input, select {
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-width: 0;
}
input::placeholder { color: var(--muted); opacity: 1; }
fieldset.fill-kind {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px 10px;
  margin: 0;
  grid-column: 1 / -1;
  display: flex; gap: 20px; flex-wrap: wrap;
}
fieldset.fill-kind legend { font-weight: 650; font-size: 0.92rem; padding: 0 6px; }
label.radio { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; }
.form-actions { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

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

.table-scroll { overflow-x: auto; }
.log-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-variant-numeric: tabular-nums;
}
.log-table th, .log-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
  vertical-align: top;
}
.log-table th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.num { text-align: right !important; }
.badge {
  display: inline-block;
  font-size: 0.76rem; font-weight: 750; letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1.5px solid var(--primary);
}
.badge-full { background: var(--primary); color: var(--primary-ink); }
.badge-partial { background: transparent; color: var(--ink); border-style: dashed; }
.badge-flag {
  border-color: var(--needle); color: var(--accent-text);
  background: var(--flag-bg); border-style: solid;
  font-weight: 650; letter-spacing: 0; text-transform: none;
}
.row-actions { white-space: nowrap; }
.link-btn {
  font: inherit; font-size: 0.88rem; font-weight: 650;
  background: none; border: none; cursor: pointer;
  color: var(--accent-text); text-decoration: underline;
  padding: 2px 4px;
}
.link-btn.danger { color: var(--danger); }

/* ---------- method card ---------- */

.method-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.limits { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.limits li { margin-bottom: 0.45rem; max-width: 72ch; }

/* ---------- export ---------- */

.export-actions { display: flex; gap: 12px; flex-wrap: wrap; }

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

.site-footer {
  border-top: 2px solid var(--line);
  background: var(--card2);
  padding: 1.6rem 0 2rem;
  margin-top: 2rem;
}
.site-footer p { color: var(--muted); font-size: 0.88rem; max-width: 90ch; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- print: the one-page summary ---------- */

.print-only { display: none; }

@media print {
  body * { visibility: hidden; }
  #print-summary, #print-summary * { visibility: visible; }
  .print-only { display: block; }
  #print-summary {
    position: absolute; inset: 0;
    padding: 24px;
    background: #fff; color: #000;
    font-size: 12px;
  }
  #print-summary h2 { font-size: 18px; }
  #print-summary .log-table { min-width: 0; }
  #print-summary .log-table th, #print-summary .log-table td { border-bottom: 1px solid #999; padding: 4px 8px; }
  #print-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 18px; margin: 10px 0 14px; }
  #print-stats .pstat { border: 1px solid #999; border-radius: 6px; padding: 6px 10px; }
  #print-stats .pstat b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
}
