/* U.G.L.Y. Studio: guide and template pages. Editorial, Caribbean palette, light by default. */
:root {
  --bg: #f3fbfb;
  --surface: #ffffff;
  --surface-2: #eaf7f6;
  --wash: linear-gradient(180deg, #e6f7f7 0%, #f3fbfb 40%, #ffffff 100%);
  --text: #0b2545;
  --muted: #3a5670;
  --faint: #4f6b84;
  --line: rgba(11, 37, 69, 0.12);
  --turquoise: #0e9f9a;
  --aqua: #22b8cf;
  --seafoam: #8fe3cc;
  --ocean: #0b5f8a;
  --link: #075a83;
  --btn-bg: #0b5f8a;
  --btn-text: #ffffff;
  --btn-2-bg: #ffffff;
  --btn-2-text: #0b2545;
  --tag-bg: #d9f3f1;
  --tag-text: #0b4a4a;
  --coral: #b4302a;
  --coral-bg: #fdecea;
  --shadow: 0 0.75rem 2rem rgba(11, 37, 69, 0.08);
  --shadow-hi: 0 1rem 2.5rem rgba(11, 95, 138, 0.18);
  --font-head: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --gutter: clamp(1rem, 3vw, 3rem);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #061726;
  --surface: #0b2236;
  --surface-2: #0f2c44;
  --wash: linear-gradient(180deg, #08263a 0%, #061726 45%, #061726 100%);
  --text: #e8f6fb;
  --muted: #a8c5d6;
  --faint: #9bbccf;
  --line: rgba(143, 227, 204, 0.16);
  --turquoise: #4fd1c5;
  --aqua: #5ad4e6;
  --seafoam: #8fe3cc;
  --ocean: #7cc8ef;
  --link: #8fd6f5;
  --btn-bg: #4fd1c5;
  --btn-text: #04202a;
  --btn-2-bg: #0b2236;
  --btn-2-text: #e8f6fb;
  --tag-bg: #12384f;
  --tag-text: #bff0e4;
  --coral: #ff9c8f;
  --coral-bg: #3a1a1c;
  --shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  --shadow-hi: 0 1rem 2.5rem rgba(0, 0, 0, 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: 143.75%; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh;
  background-color: #f3fbfb; background-color: var(--bg);
  color: var(--text); font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  overflow-wrap: break-word; text-align: center;
}
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 0.1875rem solid var(--aqua); outline-offset: 0.125rem;
}
.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 { 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:focus { top: 1rem; }
.wrap { width: calc(100% - 2 * var(--gutter)); margin: 0 auto; }

/* ---------- 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: #ffffff;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
:root[data-theme="dark"] .topnav { background: #0b2236; background: color-mix(in srgb, var(--surface) 94%, transparent); }
.nav-row { width: calc(100% - 2 * var(--gutter)); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1.25rem; padding: 0.625rem 0; }
.brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; color: var(--text); min-width: 0; text-align: left; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 0.75rem; font-family: var(--font-head); font-weight: 700; color: #ffffff; background: linear-gradient(135deg, #0b5f8a, #0e9f9a); }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name strong { font-family: var(--font-head); font-size: 1.0625rem; }
.brand-name span { font-size: 0.75rem; color: var(--muted); }
.nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.875rem; padding: 0.375rem 0.75rem; border-radius: 62rem; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--tag-bg); }
.prefs { display: flex; align-items: center; gap: 0.5rem; }
.size-group { display: flex; align-items: flex-end; gap: 0.125rem; padding: 0.1875rem; border: 1px solid var(--line); border-radius: 62rem; background: var(--surface); }
.size-btn { min-width: 2rem; height: 2rem; border: 0; border-radius: 62rem; background: transparent; color: var(--muted); font-family: var(--font-head); font-weight: 700; cursor: pointer; line-height: 1; }
.size-btn.s1 { font-size: 0.75rem; } .size-btn.s2 { font-size: 0.875rem; } .size-btn.s3 { font-size: 1rem; } .size-btn.s4 { font-size: 1.1875rem; }
.size-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }
.theme-btn { width: 2.5rem; height: 2.5rem; border-radius: 62rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.theme-btn svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-btn .i-moon { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
:root[data-theme="light"] .theme-btn .i-sun { display: none; }

/* ---------- masthead ---------- */
.masthead { background: var(--wash); border-bottom: 1px solid var(--line); padding: 2.5rem 0 2rem; }
.kicker { margin: 0 0 0.75rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ocean); }
:root[data-theme="light"] .kicker { color: #0a5a83; }
.masthead h1 { font-family: var(--font-head); font-weight: 700; font-size: clamp(2rem, 1.3rem + 3vw, 3.75rem); line-height: 1.08; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
.deck { font-size: 1.125rem; color: var(--muted); margin: 0 auto 1.25rem; max-width: 62rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; margin-bottom: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.5rem 1.125rem; border-radius: 62rem; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 0.9375rem; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: var(--shadow); }
.btn.secondary { background: var(--btn-2-bg); color: var(--btn-2-text); border-color: var(--line); }
.btn.quiet { background: transparent; color: var(--link); border-color: var(--line); }
.btn.warn { background: transparent; color: var(--coral); border-color: var(--coral); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.notice { margin: 0 auto; font-size: 0.875rem; color: var(--muted); max-width: 62rem; }
.notice strong { color: var(--text); }

/* ---------- toolbar ---------- */
.toolbar { padding: 1.5rem 0 0.5rem; }
.search { display: block; width: min(100%, 36rem); margin: 0 auto 0.875rem; }
.search input { width: 100%; min-height: 2.75rem; padding: 0.5rem 1rem; border-radius: 62rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; }
.search input::placeholder { color: var(--faint); opacity: 1; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.375rem; margin-bottom: 0.625rem; }
.filter-btn { min-height: 2.25rem; padding: 0.25rem 0.875rem; border-radius: 62rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 0.875rem; cursor: pointer; }
.filter-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); border-color: transparent; }
.result-count { margin: 0; font-size: 0.875rem; color: var(--muted); }

/* ---------- entries ---------- */
#entries { min-height: 100vh; min-height: 100svh; padding: 0.5rem 0 3rem; }
.section-block { margin-top: 2rem; }
.section-head h2 { font-family: var(--font-head); font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem); margin: 0 0 0.25rem; }
.section-head p { margin: 0 auto; color: var(--muted); max-width: 52rem; }
.rule { width: 3.5rem; height: 0.25rem; border-radius: 62rem; margin: 0.75rem auto 1.25rem; background: linear-gradient(90deg, #0e9f9a, #22b8cf); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.entry {
  min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 1.125rem;
  box-shadow: var(--shadow); padding: 1.25rem; position: relative; scroll-margin-top: 6rem;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.entry.highlight { border-color: var(--aqua); box-shadow: var(--shadow-hi), 0 0 0 0.1875rem rgba(34, 184, 207, 0.35); }
.sec-tag { display: inline-block; padding: 0.125rem 0.625rem; border-radius: 62rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--tag-bg); color: var(--tag-text); }
.entry h3 { font-family: var(--font-head); font-size: 1.375rem; line-height: 1.2; margin: 0.625rem 0 0.5rem; }
.entry .summary { margin: 0 0 0.875rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 0.5rem; margin: 0 0 0.875rem; }
.facts div { min-width: 0; padding: 0.5rem 0.625rem; border-radius: 0.625rem; background: var(--surface-2); text-align: left; }
.facts dt { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: 0.9375rem; overflow-wrap: anywhere; }
.prompt-box { text-align: left; border-left: 0.25rem solid var(--turquoise); background: var(--surface-2); border-radius: 0.625rem; padding: 0.625rem 0.75rem; margin: 0 0 0.875rem; }
.prompt-box .label { display: block; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem; }
.prompt-box p { margin: 0 0 0.5rem; font-size: 0.875rem; max-height: 9rem; overflow-y: auto; scrollbar-width: thin; padding-right: 0.25rem; }
.copy-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.copy-btn { min-height: 2.25rem; padding: 0.25rem 0.875rem; border-radius: 62rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.copy-done { font-size: 0.8125rem; color: var(--muted); }
.entry-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.toggle { min-height: 2.25rem; padding: 0.25rem 0.75rem; border: 0; background: transparent; color: var(--link); font: inherit; font-weight: 700; font-size: 0.9375rem; cursor: pointer; }
.ask { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0.25rem 0.875rem; border-radius: 62rem; background: var(--btn-bg); color: var(--btn-text); font-weight: 600; font-size: 0.875rem; text-decoration: none; }
.full { text-align: left; margin-top: 0.875rem; padding-top: 0.875rem; border-top: 1px solid var(--line); }
.full p { margin: 0 0 0.75rem; }
.full h4 { margin: 0.5rem 0 0.25rem; font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.full ul { margin: 0; padding-left: 1.125rem; }
.full a { overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 2rem 0; }

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

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  body { text-align: left; }
  .masthead .wrap, .toolbar, .section-head { text-align: left; }
  .deck, .notice, .section-head p { margin-left: 0; }
  .actions, .filters, .entry-actions { justify-content: flex-start; }
  .search { margin-left: 0; }
  .rule { margin-left: 0; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1700px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .entry { transition: none; }
}
