/* Guide (GUB) page. Editorial magazine feel, Caribbean palette. */

:root {
  --bg: #f2fafa;
  --surface: #ffffff;
  --surface-2: #f5fbfb;
  --text: #0b2540;
  --text-muted: #34526c;
  --line: #cfe8e8;
  --teal: #006d73;
  --teal-strong: #005a60;
  --aqua: #19b8b0;
  --seafoam: #8fdccf;
  --ocean: #0b5c8a;
  --link: #005f86;
  --btn-bg: #006d73;
  --btn-text: #ffffff;
  --btn-ghost-text: #005a60;
  --btn-ghost-border: #2f8f93;
  --tag-bg: #ddf4f1;
  --tag-text: #0b4a50;
  --box-bg: #f1f9f9;
  --coral: #b2361b;
  --coral-bg: #fff1ec;
  --focus: #0b5c8a;
  --hl: #fff6d6;
  --mast-a: #d9f5f2;
  --mast-b: #e8f4fb;
  --shadow: 0 0.75rem 2rem rgba(11, 37, 64, 0.08);
  --shadow-lift: 0 1rem 2.5rem rgba(11, 37, 64, 0.14);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --scrollbar: rgba(0, 109, 115, 0.45);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #061a2a;
  --surface: #0b2438;
  --surface-2: #0d2a40;
  --text: #e6f6f7;
  --text-muted: #a9c6d1;
  --line: #1d4660;
  --teal: #5fe3d9;
  --teal-strong: #7aeae2;
  --aqua: #2cc9c0;
  --seafoam: #6fd3c4;
  --ocean: #7cc4ef;
  --link: #7fd8f5;
  --btn-bg: #2cc9c0;
  --btn-text: #04222b;
  --btn-ghost-text: #7aeae2;
  --btn-ghost-border: #46b8b1;
  --tag-bg: #113b4d;
  --tag-text: #c9f2ee;
  --box-bg: #0f3048;
  --coral: #ff9f84;
  --coral-bg: #3a1d1a;
  --focus: #9fe9ff;
  --hl: #24402f;
  --mast-a: #0b3046;
  --mast-b: #0a2238;
  --shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 1rem 2.5rem rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(6, 26, 42, 0.86);
  --scrollbar: rgba(95, 227, 217, 0.5);
  color-scheme: dark;
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-font-size="md"] { font-size: 112.5%; }
html[data-font-size="lg"] { font-size: 125%; }
html[data-font-size="xl"] { font-size: 137.5%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  text-align: center;
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, "Times New Roman", "Iowan Old Style", serif;
  line-height: 1.15;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: var(--link); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 0.1875rem solid var(--focus); outline-offset: 0.125rem; border-radius: 0.375rem; }

ul, ol { text-align: left; }

.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: 1rem; top: -4rem; z-index: 100; background: var(--surface); color: var(--text); padding: 0.5rem 0.875rem; border-radius: 0.5rem; }
.skip-link:focus { top: 1rem; }

.pad { padding-inline: clamp(1rem, 4vw, 3.5rem); }

/* ---------- Nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topnav { background: var(--nav-bg); -webkit-backdrop-filter: blur(0.875rem) saturate(1.2); backdrop-filter: blur(0.875rem) saturate(1.2); }
}
.nav-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; padding-block: 0.625rem; }
.brand { display: flex; align-items: center; gap: 0.625rem; color: var(--text); text-decoration: none; min-width: 0; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #0b4f7a, #00666b 55%, #00585e); color: #ffffff; font-weight: 700; font-size: 0.8125rem;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.brand-name strong { font-family: "Fraunces", Georgia, serif; font-size: 1rem; }
.brand-name span { font-size: 0.75rem; color: var(--text-muted); }
.nav-links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; }
.nav-links a { display: inline-block; padding: 0.375rem 0.75rem; border-radius: 999px; color: var(--text); text-decoration: none; font-size: 0.875rem; font-weight: 600; }
.nav-links a[aria-current="page"] { background: var(--tag-bg); color: var(--tag-text); }
.nav-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: center; }
.size-group { display: inline-flex; align-items: flex-end; gap: 0.125rem; padding: 0.1875rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.size-group button { border: 0; background: transparent; cursor: pointer; border-radius: 999px; min-width: 2rem; height: 2rem; padding: 0 0.375rem; font-weight: 700; line-height: 1; color: var(--text); }
.size-group button[data-size="sm"] { font-size: 0.75rem; }
.size-group button[data-size="md"] { font-size: 0.875rem; }
.size-group button[data-size="lg"] { font-size: 1rem; }
.size-group button[data-size="xl"] { font-size: 1.1875rem; }
.size-group button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }
.theme-toggle { display: inline-flex; align-items: center; gap: 0.375rem; height: 2.375rem; padding: 0 0.875rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 0.875rem; cursor: pointer; }
.theme-toggle svg { width: 1rem; height: 1rem; }
@media (max-width: 30em) {
  .nav-row { gap: 0.375rem 0.5rem; }
  .nav-links a { padding: 0.375rem 0.625rem; }
  .size-group button { min-width: 1.75rem; }
  .theme-toggle { padding: 0 0.625rem; }
  .theme-toggle [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Masthead ---------- */
.masthead {
  background: linear-gradient(135deg, var(--mast-a), var(--mast-b) 60%, var(--surface));
  border-bottom: 1px solid var(--line);
  padding-block: clamp(1.75rem, 4vw, 3.5rem);
}
.mast-grid { display: grid; gap: 1.25rem; align-items: end; }
.kicker { display: inline-block; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); }
.masthead h1 { font-size: clamp(2rem, 1.2rem + 3.6vw, 4rem); margin-top: 0.5rem; overflow-wrap: anywhere; }
.deck { margin: 0; font-size: 1.125rem; color: var(--text-muted); }
.mast-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; margin-top: 1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; text-decoration: none; cursor: pointer;
  min-height: 2.75rem; padding: 0.5rem 1.125rem; border-radius: 999px; font-weight: 700; font-size: 0.9375rem;
  border: 2px solid transparent;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { box-shadow: var(--shadow-lift); }
.btn-ghost { background: transparent; color: var(--btn-ghost-text); border-color: var(--btn-ghost-border); }
.notice {
  margin: 1rem 0 0; padding: 0.625rem 0.875rem; border-radius: 0.75rem; font-size: 0.875rem;
  background: var(--coral-bg); color: var(--coral); border: 1px solid currentColor;
}
.updated { margin: 0.5rem 0 0; font-size: 0.8125rem; color: var(--text-muted); }
@media (min-width: 62em) {
  body { text-align: left; }
  .mast-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2.5rem; }
  .mast-actions { justify-content: flex-start; }
}

/* ---------- Toolbar ---------- */
.toolbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding-block: 1rem; scroll-margin-top: 5rem;
}
.search-row { display: flex; gap: 0.5rem; align-items: center; justify-content: center; }
.search-row label { flex: 1 1 auto; min-width: 0; max-width: 100%; }
.search-row input {
  width: 100%; min-height: 2.75rem; padding: 0.5rem 1rem; border-radius: 999px;
  border: 1px solid var(--btn-ghost-border); background: var(--surface-2); color: var(--text);
}
.search-row input::placeholder { color: var(--text-muted); opacity: 1; }
.mic-btn {
  flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--btn-ghost-border); background: var(--surface-2); color: var(--btn-ghost-text);
}
.mic-btn svg { width: 1.125rem; height: 1.125rem; }
.mic-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); border-color: transparent; }
.voice-status { margin: 0.375rem 0 0; font-size: 0.8125rem; color: var(--text-muted); }
.voice-error { margin: 0.375rem 0 0; font-size: 0.8125rem; color: var(--coral); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.375rem; margin-top: 0.75rem; }
.filters button {
  cursor: pointer; min-height: 2.375rem; padding: 0.375rem 0.875rem; border-radius: 999px; font-weight: 600; font-size: 0.875rem;
  border: 1px solid var(--btn-ghost-border); background: var(--surface); color: var(--btn-ghost-text);
}
.filters button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); border-color: transparent; }
.result-count { margin: 0.625rem 0 0; font-size: 0.875rem; color: var(--text-muted); }
.voice-note { margin: 0.25rem 0 0; font-size: 0.75rem; color: var(--text-muted); }
@media (min-width: 62em) {
  .search-row, .filters { justify-content: flex-start; }
}

/* ---------- Entries ---------- */
.entries { min-height: 100vh; min-height: 100svh; padding-block: 1.5rem 3rem; }
.g-section { margin-top: 1.75rem; }
.g-section:first-child { margin-top: 0.5rem; }
.g-section h2 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); }
.sec-blurb { margin: 0.375rem 0 0; color: var(--text-muted); }
.sec-rule { display: block; width: 3.5rem; height: 0.25rem; border-radius: 999px; margin: 0.75rem auto 1rem; background: linear-gradient(90deg, var(--aqua), var(--seafoam)); }
@media (min-width: 62em) { .sec-rule { margin-left: 0; } }

.grid { display: grid; gap: 1rem; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 43.75em) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 68.75em) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 106.25em) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.entry {
  min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 1.125rem;
  padding: 1.125rem; box-shadow: var(--shadow); scroll-margin-top: var(--nav-h, 5rem);
  transition: box-shadow 0.2s ease, background-color 0.3s ease;
}
.entry.is-highlight { background: var(--hl); box-shadow: 0 0 0 0.1875rem var(--aqua), var(--shadow-lift); }
.sec-tag { display: inline-block; padding: 0.1875rem 0.625rem; border-radius: 999px; background: var(--tag-bg); color: var(--tag-text); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.entry h3 { font-size: 1.3125rem; margin-top: 0.5rem; overflow-wrap: anywhere; }
.entry .summary { margin: 0.5rem 0 0; }
.facts { margin: 0.75rem 0 0; display: grid; gap: 0.375rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 30em) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact { padding: 0.5rem 0.625rem; border-radius: 0.625rem; background: var(--box-bg); border: 1px solid var(--line); min-width: 0; }
.fact dt { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.fact dd { margin: 0.125rem 0 0; font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.875rem; justify-content: center; align-items: center; }
@media (min-width: 62em) { .entry-actions { justify-content: flex-start; } }
.toggle { background: none; border: 0; cursor: pointer; color: var(--link); font-weight: 700; padding: 0.375rem 0.25rem; text-decoration: underline; text-underline-offset: 0.2em; }
.ask-pill {
  display: inline-flex; align-items: center; gap: 0.375rem; text-decoration: none; font-weight: 700; font-size: 0.875rem;
  padding: 0.4375rem 0.875rem; border-radius: 999px; border: 1px solid var(--btn-ghost-border); color: var(--btn-ghost-text); background: var(--surface-2);
}
.ask-pill:hover { background: var(--tag-bg); }
.full { margin-top: 0.75rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
.full p { margin: 0 0 0.75rem; overflow-wrap: anywhere; }
.full ol, .full ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.full h4 { margin: 0.5rem 0 0.25rem; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.sources { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.375rem; }
.sources a { overflow-wrap: anywhere; font-size: 0.875rem; }
.no-results { padding: 2rem 1rem; color: var(--text-muted); }

.foot { padding-block: 1.5rem calc(2rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); color: var(--text-muted); font-size: 0.875rem; }
.foot p { margin: 0.25rem 0; }

@media (prefers-reduced-motion: reduce) {
  .entry { transition: none; }
}
