/* AI&I Stride: guide styles. Editorial, Caribbean palette, serif headings. All sizes in rem. */

:root {
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(1rem, 4vw, 3.5rem);
  --radius: 1rem;
}

html { font-size: 93.75%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 6rem; }
html[data-font-size="md"] { font-size: 106.25%; }
html[data-font-size="lg"] { font-size: 118.75%; }
html[data-font-size="xl"] { font-size: 131.25%; }

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --text: #0c2a44;
  --muted: #3c5a72;
  --wash-1: #d9f6f2;
  --wash-2: #eefbfa;
  --card: #ffffff;
  --card-line: #cfe8ea;
  --shadow: 0 0.9rem 2.2rem rgb(14 90 138 / 0.09), 0 0.15rem 0.4rem rgb(14 90 138 / 0.06);
  --accent: #0b6e70;
  --accent-strong: #0e5a8a;
  --rule: linear-gradient(90deg, #14b8b8, #0e5a8a);
  --tag-bg: #dff5f1;
  --tag-text: #0a5c5e;
  --box-bg: #effaf8;
  --box-line: #cbebe6;
  --btn-bg: #0e5a8a;
  --btn-text: #ffffff;
  --ghost-text: #0e5a8a;
  --ghost-line: #0e5a8a;
  --chip-bg: #ffffff;
  --chip-text: #0c2a44;
  --chip-line: #9ccfd3;
  --chip-on-bg: #0e5a8a;
  --chip-on-text: #ffffff;
  --field-bg: #ffffff;
  --field-line: #8fc5ca;
  --nav-bg: rgb(255 255 255 / 0.97);
  --nav-glass: rgb(255 255 255 / 0.82);
  --nav-line: #d5ecee;
  --link: #0e5a8a;
  --coral: #b8361f;
  --highlight: #f4fffd;
  --highlight-line: #14b8b8;
  --focus: #e4572e;
  --ask-bg: #e8f8f5;
  --ask-text: #0a4f6e;
  --ask-line: #79cfd0;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061a2b;
  --text: #e5f5f6;
  --muted: #a9c6d3;
  --wash-1: #0a3140;
  --wash-2: #082234;
  --card: #0b2539;
  --card-line: #1d4558;
  --shadow: 0 0.9rem 2.2rem rgb(0 0 0 / 0.35);
  --accent: #6fdcdc;
  --accent-strong: #8ee6e6;
  --rule: linear-gradient(90deg, #5fd4d6, #4aa8e0);
  --tag-bg: #0f3a48;
  --tag-text: #9ff0ea;
  --box-bg: #0e2f45;
  --box-line: #1f4c62;
  --btn-bg: #6fdcdc;
  --btn-text: #04202e;
  --ghost-text: #9ff0ea;
  --ghost-line: #6fdcdc;
  --chip-bg: #0b2539;
  --chip-text: #e5f5f6;
  --chip-line: #2f6378;
  --chip-on-bg: #6fdcdc;
  --chip-on-text: #04202e;
  --field-bg: #0b2539;
  --field-line: #3b7489;
  --nav-bg: rgb(6 26 43 / 0.97);
  --nav-glass: rgb(6 26 43 / 0.8);
  --nav-line: #15384b;
  --link: #8ee6e6;
  --coral: #ff9a85;
  --highlight: #0e3346;
  --highlight-line: #6fdcdc;
  --focus: #ff9a85;
  --ask-bg: #0f3a48;
  --ask-text: #b5f3ee;
  --ask-line: #3f8f9c;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 0.15rem solid var(--focus); outline-offset: 0.15rem; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: 0.6rem 1rem; border-radius: 0.6rem; background: var(--card); color: var(--text); box-shadow: var(--shadow);
}
.skip-link:focus { top: calc(0.75rem + env(safe-area-inset-top, 0px)); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-line);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav {
    background: var(--nav-glass);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }
}
.nav-row {
  padding: 0.55rem var(--pad);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1.25rem;
}
.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; flex: none; width: 2.3rem; height: 2.3rem; border-radius: 0.75rem;
  background: linear-gradient(135deg, #14b8b8, #0e7c86 50%, #0e5a8a); color: #ffffff;
}
.brand-mark svg { width: 1.4rem; height: 1.4rem; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name strong { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; }
.brand-name span { font-size: 0.78rem; color: var(--muted); }
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a { padding: 0.4rem 0.75rem; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.nav-links a:hover { background: var(--box-bg); }
.nav-links a[aria-current="page"] { background: var(--tag-bg); color: var(--tag-text); }
.prefs { display: flex; align-items: center; gap: 0.5rem; }
.size-group { display: flex; align-items: flex-end; gap: 0.15rem; padding: 0.2rem; border-radius: 999px; background: var(--box-bg); border: 1px solid var(--chip-line); }
.size-btn {
  min-width: 2rem; height: 2rem; padding: 0 0.3rem; border: 0; border-radius: 999px; background: transparent;
  color: var(--text); font-family: var(--font-serif); font-weight: 700; cursor: pointer; line-height: 1;
}
.size-btn.s1 { font-size: 0.78rem; }
.size-btn.s2 { font-size: 0.92rem; }
.size-btn.s3 { font-size: 1.06rem; }
.size-btn.s4 { font-size: 1.2rem; }
.size-btn[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-text); }
.theme-btn {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 999px;
  border: 1px solid var(--chip-line); background: var(--box-bg); color: var(--text); cursor: pointer;
}
.theme-btn svg { width: 1.15rem; height: 1.15rem; }
html[data-theme="dark"] .icon-moon, html[data-theme="light"] .icon-sun { display: none; }

/* ---------- Masthead ---------- */
.masthead {
  background: radial-gradient(60rem 28rem at 10% 0%, var(--wash-1), transparent 70%), linear-gradient(180deg, var(--wash-2), var(--bg));
  padding: 2.4rem var(--pad) 2rem;
  text-align: center;
}
.masthead-inner { display: grid; gap: 0.9rem; justify-items: center; }
.kicker { color: var(--accent); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.02em; }
.masthead h1 { font-size: clamp(2rem, 1.2rem + 3.6vw, 4rem); font-weight: 600; max-width: 22ch; text-wrap: balance; }
.deck { font-size: 1.08rem; color: var(--muted); max-width: 46rem; }
.mast-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 0.2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem;
  padding: 0.55rem 1.15rem; border-radius: 999px; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; line-height: 1.2;
}
.btn.primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: 0 0.6rem 1.4rem rgb(14 90 138 / 0.18); }
.btn.ghost { background: transparent; color: var(--ghost-text); border-color: var(--ghost-line); }
.notice { font-size: 0.86rem; color: var(--muted); }

/* ---------- Toolbar ---------- */
.toolbar { padding: 1.2rem var(--pad) 0.6rem; }
.toolbar-inner { display: grid; gap: 0.8rem; justify-items: center; text-align: center; }
.search { display: grid; gap: 0.3rem; width: min(100%, 34rem); }
.search label { font-weight: 700; font-size: 0.9rem; }
.search input {
  width: 100%; min-height: 2.9rem; padding: 0.5rem 1rem; border-radius: 999px;
  border: 1px solid var(--field-line); background: var(--field-bg); color: var(--text);
  font-size: max(1rem, 16px);
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; }
.filter-btn {
  min-height: 2.5rem; padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--chip-text); font-weight: 600; font-size: 0.9rem;
}
.filter-btn[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-text); border-color: var(--chip-on-bg); }
.count { color: var(--muted); font-size: 0.88rem; }

/* ---------- Sections and cards ---------- */
.entries { padding: 0.8rem var(--pad) 3rem; min-height: 100vh; min-height: 100svh; outline: none; }
.loading, .empty { color: var(--muted); text-align: center; padding: 2rem 0; }
.section { padding-top: 1.6rem; }
.section-head { display: grid; gap: 0.35rem; justify-items: center; text-align: center; margin-bottom: 1.1rem; }
.section-head h2 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem); }
.section-head p { color: var(--muted); max-width: 46rem; }
.rule { width: 3rem; height: 0.22rem; border-radius: 999px; background: var(--rule); margin-top: 0.25rem; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.entry {
  min-width: 0;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.15rem 1.1rem;
  display: grid; gap: 0.7rem; text-align: center; justify-items: center;
  scroll-margin-top: 6rem;
}
.entry.is-highlight { background: var(--highlight); border-color: var(--highlight-line); box-shadow: 0 0 0 0.2rem var(--highlight-line), var(--shadow); }
.tag { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--tag-bg); color: var(--tag-text); font-size: 0.78rem; font-weight: 700; }
.entry h3 { font-size: 1.32rem; overflow-wrap: anywhere; }
.entry .summary { color: var(--text); }
.facts { width: 100%; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 0.45rem; text-align: left; }
.fact { min-width: 0; padding: 0.45rem 0.65rem; border-radius: 0.7rem; background: var(--box-bg); border: 1px solid var(--box-line); }
.fact dt { font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.fact dd { margin: 0; font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.toggle {
  background: none; border: 0; padding: 0.3rem 0.2rem; cursor: pointer;
  color: var(--link); font-weight: 700; font-size: 0.92rem; min-height: 2.25rem;
}
.toggle:hover { text-decoration: underline; }
.full { width: 100%; display: grid; gap: 0.7rem; text-align: left; }
.full[hidden] { display: none; }
.full p { color: var(--text); }
.sources-title { font-family: var(--font-body); font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-top: 0.2rem; }
.sources { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.sources a { overflow-wrap: anywhere; }
.ask {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.5rem;
  padding: 0.45rem 0.95rem; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 0.9rem;
  background: var(--ask-bg); color: var(--ask-text); border: 1px solid var(--ask-line);
}
.ask svg { width: 1rem; height: 1rem; flex: none; }

/* ---------- Footer ---------- */
.foot {
  padding: 1.5rem var(--pad) calc(2rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--nav-line);
  color: var(--muted); font-size: 0.85rem; text-align: center; display: grid; gap: 0.4rem;
}
.foot a { font-weight: 600; }

/* ---------- Larger screens: editorial alignment ---------- */
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .masthead { text-align: left; padding-top: 3rem; padding-bottom: 2.4rem; }
  .masthead-inner { justify-items: start; }
  .mast-actions { justify-content: flex-start; }
  .toolbar-inner { justify-items: start; text-align: left; }
  .filters { justify-content: flex-start; }
  .section-head { justify-items: start; text-align: left; }
  .entry { text-align: left; justify-items: start; }
  .nav-row { justify-content: space-between; }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar-inner { grid-template-columns: minmax(16rem, 26rem) minmax(0, 1fr); align-items: end; column-gap: 1.5rem; }
  .count { grid-column: 1 / -1; }
}
@media (min-width: 1700px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
