/* Books & Keys — shared styles */
:root {
  --ink: #1c2230;
  --ink-soft: #4a5468;
  --paper: #fbfaf6;
  --card: #ffffff;
  --line: #e4e0d6;
  --brand: #1f3a5f;
  --brand-dark: #152a46;
  --accent: #b8741a;
  --good: #1e6b45;
  --good-bg: #e8f4ed;
  --warn: #8a5a00;
  --warn-bg: #fdf3e1;
  --bad: #9b2c2c;
  --bad-bg: #fbeaea;
  --radius: 12px;
  --max: 1040px;
  --read: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

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

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 6px;
}
.skip-link:focus { left: 8px; z-index: 10; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap;
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.logo img { width: 32px; height: 32px; }
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; color: var(--ink-soft); font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.read { max-width: var(--read); }

main { padding: 32px 0 56px; }

h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 12px; }
h2 { font-size: 1.45rem; margin: 40px 0 12px; }
h3 { font-size: 1.15rem; margin: 24px 0 8px; }
p { margin: 0 0 14px; }

.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: var(--read); }
.meta { font-size: 0.9rem; color: var(--ink-soft); }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin: 20px 0;
}
.card h2, .card h3 { margin-top: 0; }
.card-feature { border-left: 5px solid var(--accent); }

.grid .card { margin: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.badge {
  display: inline-block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}

/* Buttons and forms */
.button, button {
  display: inline-block; background: var(--brand); color: #fff; border: 0;
  padding: 12px 20px; border-radius: 8px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.button:hover, button:hover { background: var(--brand-dark); color: #fff; }
.button-secondary { background: transparent; color: var(--brand); border: 2px solid var(--brand); padding: 10px 18px; }
.button-secondary:hover { background: var(--brand); color: #fff; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { display: block; font-weight: 400; color: var(--ink-soft); font-size: 0.92rem; }
input[type="text"], input[type="number"], input[type="date"], select {
  font: inherit; padding: 11px 12px; border: 2px solid #b9b4a8; border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%; max-width: 320px;
}
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(31,58,95,0.2); }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row .field { margin-bottom: 0; }

.or { color: var(--ink-soft); margin: 14px 0; font-size: 0.95rem; }

/* Results */
.result { margin-top: 20px; }
.status {
  border-radius: 10px; padding: 16px 18px; margin: 12px 0; font-weight: 600;
}
.status-open { background: var(--good-bg); color: var(--good); }
.status-soon { background: var(--warn-bg); color: var(--warn); }
.status-late { background: var(--bad-bg); color: var(--bad); }
.status-info { background: #eef2f8; color: var(--brand-dark); }
.status p { margin: 0; font-weight: 400; color: var(--ink); }
.status strong { display: block; font-size: 1.1rem; margin-bottom: 4px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.fact { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.fact span { display: block; font-size: 0.85rem; color: var(--ink-soft); }
.fact b { font-size: 1.1rem; }

.error { color: var(--bad); font-weight: 600; margin-top: 10px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f3f1eb; font-size: 0.95rem; }
tr:last-child td { border-bottom: 0; }
tr.is-highlight td { background: #fff8ea; font-weight: 600; }

ul.check { list-style: none; padding-left: 0; }
ul.check li { padding-left: 28px; position: relative; margin-bottom: 8px; }
ul.check li::before { content: "✓"; position: absolute; left: 4px; color: var(--good); font-weight: 700; }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 22px; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); }
.timeline time { display: block; font-weight: 700; }

.note { background: #f3f1eb; border-radius: 10px; padding: 14px 16px; font-size: 0.95rem; }

details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 10px 0; }
summary { font-weight: 600; cursor: pointer; }
details p { margin-top: 10px; }

/* Footer */
.site-footer { background: #f1eee6; border-top: 1px solid var(--line); padding: 28px 0; font-size: 0.92rem; color: var(--ink-soft); }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.site-footer p { margin: 6px 0; }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .card { padding: 18px; }
  .site-nav { gap: 14px; }
}

@media print {
  .site-header, .site-footer, .no-print { display: none; }
}
