/* Guide: editorial magazine look, Caribbean palette. Mobile-first. */

:root {
  --bg: #ffffff;
  --bg-soft: #f2fbfa;
  --surface: #ffffff;
  --surface-2: #f4fafc;
  --line: #d3e7ec;
  --text: #0b2545;
  --muted: #3c566e;
  --accent: #0b7285;          /* deep turquoise: text-safe on white */
  --accent-strong: #075e6e;
  --accent-soft: #d8f3f1;
  --aqua: #14b8c4;
  --seafoam: #7ad9c6;
  --ocean: #1d4e89;
  --coral: #c2413a;
  --coral-soft: #fdeceb;
  --btn-bg: #0b5f73;
  --btn-text: #ffffff;
  --nav-bg: #ffffff;
  --nav-bg-glass: rgba(255, 255, 255, 0.82);
  --shadow: 0 0.0625rem 0.125rem rgba(11, 37, 69, 0.06), 0 0.5rem 1.5rem rgba(11, 37, 69, 0.07);
  --shadow-lift: 0 0.125rem 0.25rem rgba(11, 37, 69, 0.08), 0 1rem 2rem rgba(11, 37, 69, 0.12);
  --mast-grad: linear-gradient(160deg, #e3f8f5 0%, #eaf5fd 55%, #ffffff 100%);
  --focus: #0b7285;
  --highlight: #e2f6f2;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --gutter: clamp(1rem, 4vw, 4rem);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #061a2b;
  --bg-soft: #082236;
  --surface: #0b2740;
  --surface-2: #0e2f4c;
  --line: #1b4563;
  --text: #e8f6f7;
  --muted: #a8c5d1;
  --accent: #5fe0d2;
  --accent-strong: #8cefe3;
  --accent-soft: #0f3b4a;
  --aqua: #22d3e0;
  --seafoam: #7ad9c6;
  --ocean: #7fb3f0;
  --coral: #ff8f85;
  --coral-soft: #10304a;
  --btn-bg: #5fe0d2;
  --btn-text: #062033;
  --nav-bg: #061a2b;
  --nav-bg-glass: rgba(6, 26, 43, 0.82);
  --shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.3), 0 0.5rem 1.5rem rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.35), 0 1rem 2rem rgba(0, 0, 0, 0.4);
  --mast-grad: linear-gradient(160deg, #0a3346 0%, #0a2741 55%, #061a2b 100%);
  --focus: #5fe0d2;
  --highlight: #173f4f;
  color-scheme: dark;
}

/* Text size: sm is the default; each step up is bigger. Everything is in rem. */
html { font-size: 93.75%; }
html[data-font-size="md"] { font-size: 103.125%; }
html[data-font-size="lg"] { font-size: 112.5%; }
html[data-font-size="xl"] { font-size: 125%; }

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 6rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }

:focus-visible { outline: 0.1875rem solid var(--focus); outline-offset: 0.1875rem; border-radius: 0.25rem; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: 0.5rem;
}
.skip-link:focus { top: calc(0.5rem + env(safe-area-inset-top)); }

.wrap { width: 100%; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  border-bottom: 0.0625rem solid var(--line);
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav {
    background: var(--nav-bg-glass);
    -webkit-backdrop-filter: saturate(1.4) blur(0.75rem);
    backdrop-filter: saturate(1.4) blur(0.75rem);
  }
}
.nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem var(--gutter);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.7rem;
  color: #ffffff;
  background: #0b7285;
  background: linear-gradient(135deg, #0b7285, #1d4e89);
  flex: none;
}
.brand-mark svg { width: 1.3rem; height: 1.3rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.brand-text strong { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; }
.brand-text span { font-size: 0.78rem; color: var(--muted); }

.nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999rem;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--text); }
.nav-links a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }

.nav-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.size-picker {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.125rem;
  padding: 0.2rem;
  border: 0.0625rem solid var(--line);
  border-radius: 999rem;
  background: var(--surface);
}
.size-btn {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 999rem;
  width: 2.1rem;
  height: 2.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.size-btn.s1 { font-size: 0.8rem; }
.size-btn.s2 { font-size: 0.95rem; }
.size-btn.s3 { font-size: 1.1rem; }
.size-btn.s4 { font-size: 1.25rem; }
.size-btn:hover { background: var(--accent-soft); }
.size-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }

.theme-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999rem;
  border: 0.0625rem solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.theme-btn:hover { background: var(--accent-soft); }
.theme-btn svg { width: 1.15rem; height: 1.15rem; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Masthead ---------- */
.masthead {
  background: var(--bg-soft);
  background: var(--mast-grad);
  padding: 2.5rem 0 2.25rem;
  border-bottom: 0.0625rem solid var(--line);
}
.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}
.deck {
  font-size: 1.12rem;
  color: var(--muted);
  margin: 0 auto 1.5rem;
  max-width: 62ch;
}
.mast-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-bottom: 1.25rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.25rem;
  border-radius: 999rem;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 0.125rem solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  font-family: inherit;
}
.btn:not(.quiet):hover { color: var(--btn-text); filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.quiet:hover { background: var(--accent-soft); color: var(--accent-strong); }
.notice {
  margin: 0 auto;
  max-width: 70ch;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--coral-soft);
  border-left: 0.25rem solid var(--coral);
  border-radius: 0.5rem;
  padding: 0.7rem 0.9rem;
  text-align: left;
}

/* ---------- Toolbar ---------- */
.toolbar { padding: 1.5rem 0 0.5rem; background: var(--bg); }
.search { display: flex; flex-direction: column; align-items: stretch; gap: 0.35rem; margin: 0 auto 1rem; max-width: 40rem; text-align: left; }
.search label { font-weight: 600; font-size: 0.9rem; }
.search input {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 0.0625rem solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  min-height: 2.75rem;
  width: 100%;
  min-width: 0;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.filter-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 0.0625rem solid var(--line);
  border-radius: 999rem;
  padding: 0.45rem 0.95rem;
  min-height: 2.5rem;
  cursor: pointer;
}
.filter-btn:hover { border-color: var(--accent); }
.filter-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.count { margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--muted); }

/* ---------- Entries ---------- */
.entries { padding: 1rem 0 3rem; min-height: 100vh; min-height: 100svh; }
.entries:focus { outline: none; }
.loading, .empty { color: var(--muted); padding: 2rem 0; }
.section-block { margin-top: 2.25rem; }
.section-block:first-child { margin-top: 1rem; }
.section-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.2;
  margin: 0 0 0.35rem;
}
.section-head p { margin: 0 auto; color: var(--muted); max-width: 60ch; }
.rule {
  display: block;
  width: 3.5rem;
  height: 0.25rem;
  border-radius: 999rem;
  margin: 0.8rem auto 1.25rem;
  background: var(--aqua);
  background: linear-gradient(90deg, var(--aqua), var(--seafoam));
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  min-width: 0;
  background: var(--surface);
  border: 0.0625rem solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  text-align: left;
  transition: box-shadow 0.25s ease, background-color 0.4s ease;
  scroll-margin-top: 6rem;
}
.card.is-highlight { background: var(--highlight); box-shadow: var(--shadow-lift), 0 0 0 0.1875rem var(--accent); }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.card .summary { margin: 0 0 0.9rem; color: var(--text); }
.card-photo {
  margin: 0 0 1rem;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 0.0625rem solid var(--line);
  box-shadow: var(--shadow);
}
.card-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.card-photo figcaption { font-size: 0.82rem; color: var(--muted); padding: 0.5rem 0.75rem; background: var(--surface-2); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
}
.fact {
  min-width: 0;
  background: var(--surface-2);
  border: 0.0625rem solid var(--line);
  border-radius: 0.6rem;
  padding: 0.5rem 0.65rem;
}
.fact dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fact dd { margin: 0.1rem 0 0; font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }

.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.toggle {
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
  background: transparent;
  border: 0;
  padding: 0.4rem 0;
  cursor: pointer;
  min-height: 2.5rem;
}
.toggle:hover { color: var(--accent-strong); text-decoration: underline; }
.ask {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--accent-soft);
  color: var(--text);
  border: 0.0625rem solid var(--line);
}
.ask:hover { color: var(--text); border-color: var(--accent); }

.full { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 0.0625rem solid var(--line); }
.full[hidden] { display: none; }
.full p { margin: 0 0 0.75rem; }
.full ul { margin: 0 0 0.75rem; padding-left: 1.2rem; }
.full li { margin-bottom: 0.35rem; }
.sources h4 { font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 1rem 0 0.4rem; }
.sources ul { padding-left: 1.2rem; margin: 0; }
.sources a { overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.footer {
  border-top: 0.0625rem solid var(--line);
  padding: 1.5rem 0 calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--bg-soft);
}
.footer p { margin: 0.25rem 0; }

/* ---------- Larger screens: normal editorial alignment ---------- */
@media (min-width: 700px) {
  body { text-align: left; }
  .nav-row { justify-content: space-between; }
  .nav-links { margin-left: auto; }
  .mast-actions { justify-content: flex-start; }
  .deck { margin-left: 0; }
  .notice { margin-left: 0; }
  .search { margin-left: 0; }
  .filters { justify-content: flex-start; }
  .section-head p { margin-left: 0; }
  .rule { margin-left: 0; }
  .masthead { padding: 3.5rem 0 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
}
