/* ============================================================
   Rapid Resource for Families — Public Document Library
   Brand: navy #323c5a · teal #00b3aa · coral #dc5a64 · gold #e6aa28
   ============================================================ */

:root {
  --navy: #323c5a;
  --navy-700: #262e46;
  --navy-900: #1a2033;
  --teal: #00b3aa;
  --teal-600: #008f89;
  --coral: #dc5a64;
  --gold: #e6aa28;
  --gold-on-dark: #f5d183;   /* the brand gold is too dim for small text on navy */

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3ea;
  --text: #22283a;
  --text-soft: #4e566b;
  --text-faint: #646c81;
  --accent: var(--teal);
  /* text colours, kept separate from the brand swatches so they can flip safely */
  --heading: var(--navy);
  --link: #00736e;
  --on-navy: #ffffff;
  --on-navy-soft: #ccd5ea;
  --shadow-sm: 0 1px 2px rgba(26, 32, 51, .06), 0 1px 3px rgba(26, 32, 51, .08);
  --shadow-md: 0 4px 12px rgba(26, 32, 51, .08), 0 2px 4px rgba(26, 32, 51, .05);
  --shadow-lg: 0 18px 40px rgba(26, 32, 51, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --read: "Source Serif 4", Georgia, "Times New Roman", serif;
  --maxw: 1180px;
}

:root[data-theme="dark"] {
  --bg: #121621;
  --surface: #1b2030;
  --surface-2: #232a3d;
  --border: #39415c;
  --text: #e9ecf5;
  --text-soft: #b6bdd2;
  --text-faint: #9aa2b9;
  --heading: #e9ecf5;
  --link: #4fd8d0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.22; color: var(--heading); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ----------------------------------------------------- site header ---- */
.site-header {
  background: var(--navy-700);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
:root[data-theme="dark"] .site-header { background: #0e121c; }

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand img, .brand svg { height: 36px; width: auto; display: block; }
.brand-name { font-family: var(--display); font-size: 1.05rem; font-weight: 600; letter-spacing: .01em; }
.brand-sub { display: block; font-family: var(--ui); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #a9ece8; font-weight: 600; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  appearance: none; border: 1px solid transparent; background: rgba(255, 255, 255, .1);
  color: inherit; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: inline-grid; place-items: center; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .2); }
.icon-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------ hero ---- */
.hero {
  background:
    radial-gradient(1200px 400px at 8% -30%, rgba(0, 179, 170, .32), transparent 60%),
    radial-gradient(900px 380px at 96% -10%, rgba(230, 170, 40, .20), transparent 55%),
    var(--navy);
  color: #fff;
  padding: 56px 0 64px;
}
.hero h1 { color: #fff; font-size: clamp(2rem, 4.4vw, 3rem); margin: 0 0 12px; letter-spacing: -.015em; }
.hero p { margin: 0; max-width: 62ch; color: #e2e8f6; font-size: 1.06rem; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px;
  font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600;
  color: var(--gold-on-dark);
}
.hero .eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--gold); border-radius: 2px; }

/* --------------------------------------------------------- toolbar ---- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: -28px auto 0; position: relative; z-index: 5;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-md);
}
.search-field { position: relative; flex: 1 1 320px; min-width: 240px; }
.search-field svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); }
input[type="search"], input[type="text"], input[type="password"], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
}
.search-field input { padding-left: 42px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(0, 179, 170, .45); outline-offset: 2px;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  padding: 8px 14px; border-radius: 999px; transition: .15s;
}
.chip:hover { border-color: var(--teal); color: var(--link); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ----------------------------------------------------------- cards ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; margin: 32px 0 64px; }

.doc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.doc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #c8cede; }

.doc-cover {
  position: relative; aspect-ratio: 16 / 9; display: grid; align-content: end; gap: 6px;
  padding: 20px; color: #fff;
  background: linear-gradient(140deg, var(--navy) 0%, #46527a 55%, var(--teal-600) 140%);
  text-decoration: none;
}
.doc-cover::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px 180px at 85% 0%, rgba(230, 170, 40, .35), transparent 65%);
}
.doc-cover > * { position: relative; z-index: 1; }
.doc-cover .kicker { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-on-dark); font-weight: 700; }
.doc-cover h3 { color: #fff; margin: 0; font-size: 1.32rem; }
.doc-cover .cover-sub { font-size: .85rem; color: #dde3f2; }

.doc-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.doc-body p { margin: 0; color: var(--text-soft); font-size: .93rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .8rem; color: var(--text-soft); }
.meta-row span { display: inline-flex; align-items: center; gap: 5px; }
.card-actions { margin-top: auto; display: flex; gap: 10px; padding-top: 4px; }

.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: .92rem;
  border-radius: var(--radius-sm); padding: 10px 16px; border: 1px solid transparent;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: #00736e; color: #fff; }
.btn-primary:hover { background: var(--teal-600); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--heading); color: var(--heading); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-700); }

.empty-state { text-align: center; padding: 72px 20px; color: var(--text-soft); }
.empty-state h3 { margin: 0 0 6px; }

/* ---------------------------------------------------------- footer ---- */
.site-footer {
  background: var(--navy-900); color: #ccd3e6; padding: 34px 0; margin-top: auto;
  font-size: .9rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.site-footer a { color: #8fe7e1; }

body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--gold);
  color: var(--navy-900); padding: 10px 16px; border-radius: 0 0 8px 8px; font-weight: 600;
  text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 0; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0 52px; }
  .brand-name { font-size: .95rem; }
}
