/* Light (default) — cool ink / teal library, not cream or purple */
:root,
html[data-theme="light"] {
  --ink: #12202c;
  --ink-soft: #4a5c6a;
  --paper: #f2f5f7;
  --paper-elevated: #ffffff;
  --accent: #0f6e66;
  --accent-deep: #0a4f4a;
  --accent-soft: #d5efeb;
  --warn: #9a3f2e;
  --warn-soft: #f6e4df;
  --ok-soft: #d5efeb;
  --line: rgba(18, 32, 44, 0.12);
  --shadow: 0 12px 32px rgba(18, 32, 44, 0.08);
  --focus-ring: rgba(15, 110, 102, 0.22);
  --wash-a: rgba(15, 110, 102, 0.14);
  --wash-b: rgba(45, 90, 130, 0.1);
  --wash-base: linear-gradient(165deg, #f7fafb 0%, #eef3f6 42%, #e8eef2 100%);
  --input-bg: rgba(255, 255, 255, 0.88);
  --surface: rgba(255, 255, 255, 0.72);
  --btn-fg: #f4fbfa;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #e8eef3;
  --ink-soft: #9aafc0;
  --paper: #0c1319;
  --paper-elevated: #151e28;
  --accent: #4db8ad;
  --accent-deep: #6dccc3;
  --accent-soft: rgba(77, 184, 173, 0.16);
  --warn: #e8a090;
  --warn-soft: rgba(232, 160, 144, 0.16);
  --ok-soft: rgba(77, 184, 173, 0.16);
  --line: rgba(232, 238, 243, 0.12);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  --focus-ring: rgba(77, 184, 173, 0.28);
  --wash-a: rgba(77, 184, 173, 0.12);
  --wash-b: rgba(90, 130, 180, 0.1);
  --wash-base: linear-gradient(165deg, #0e161e 0%, #0c1319 45%, #0a1016 100%);
  --input-bg: rgba(21, 30, 40, 0.92);
  --surface: rgba(21, 30, 40, 0.78);
  --btn-fg: #061412;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.bg-wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 8% -5%, var(--wash-a), transparent 58%),
    radial-gradient(ellipse 55% 45% at 100% 5%, var(--wash-b), transparent 52%),
    var(--wash-base);
  animation: wash-shift 18s ease-in-out infinite alternate;
}
.bg-wash::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image: repeating-linear-gradient(
    -18deg,
    transparent,
    transparent 11px,
    rgba(18, 32, 44, 0.025) 11px,
    rgba(18, 32, 44, 0.025) 12px
  );
  pointer-events: none;
}
html[data-theme="dark"] .bg-wash::before {
  background-image: repeating-linear-gradient(
    -18deg,
    transparent,
    transparent 11px,
    rgba(232, 238, 243, 0.03) 11px,
    rgba(232, 238, 243, 0.03) 12px
  );
}
.bg-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: multiply;
}
html[data-theme="dark"] .bg-wash::after {
  mix-blend-mode: soft-light;
  opacity: 0.55;
}

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

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem clamp(1rem, 3vw, 1.75rem) 0.35rem;
  max-width: 1040px;
  margin: 0 auto;
  animation: rise 0.55s ease both;
}
.brand {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
}
.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.public-body.page-home .brand-name {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  opacity: 0.88;
}
.admin-body .brand-logo {
  width: 32px;
  height: 32px;
}
.brand-tag {
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.95rem;
  align-items: center;
  font-size: 0.92rem;
}
.site-nav a { text-decoration: none; color: var(--ink-soft); }
.site-nav a:hover,
.site-nav a[aria-current="true"] {
  color: var(--accent-deep);
  font-weight: 600;
}
.lang-switch { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.lang-link { font-size: 0.82rem; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.theme-toggle-icon {
  width: 1rem;
  height: 1rem;
  display: block;
}
html[data-theme="light"] .theme-toggle-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle-icon-moon { display: none; }

.site-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 3.5rem;
}
.site-footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 2.5rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
}
.footer-links { margin-top: 0.25rem; }

/* Home: brand-led first viewport */
.hero {
  padding: clamp(2rem, 8vh, 3.75rem) 0 1rem;
  animation: rise 0.7s ease both;
}
.hero-home {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: min(72vh, 640px);
  padding: clamp(2.5rem, 10vh, 5rem) 0 2.5rem;
  text-align: center;
}
.hero-home-inner {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-kicker {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  animation: rise 0.55s ease both;
}
.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.45rem, 8vw, 3.65rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 0.85rem;
  max-width: 12ch;
}
.hero-home .hero-brand {
  max-width: none;
  margin: 0;
  background: linear-gradient(120deg, var(--ink) 0%, var(--accent-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.65s ease 0.04s both;
}
html[data-theme="dark"] .hero-home .hero-brand {
  background: linear-gradient(120deg, var(--ink) 20%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.hero-rule {
  display: block;
  width: 3rem;
  height: 3px;
  margin: 1.1rem 0 1.25rem;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: rise 0.7s ease 0.08s both;
}
.hero .lead {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin: 0 0 1.85rem;
  max-width: 32rem;
}
.hero-home .lead {
  margin: 0 0 1.5rem;
  max-width: 24rem;
  font-size: 1.05rem;
  line-height: 1.5;
  animation: rise 0.75s ease 0.1s both;
}
.hero-home .error {
  width: 100%;
  text-align: left;
  margin: 0 0 1rem;
  animation: rise 0.4s ease both;
}
.hero-title-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.redeem-form {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
  animation: rise 0.85s ease 0.1s both;
}
.redeem-panel {
  width: 100%;
  max-width: none;
  text-align: left;
  padding: 1.35rem 1.35rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise 0.85s ease 0.14s both;
}
.redeem-panel .btn-primary {
  width: 100%;
  justify-self: stretch;
  margin-top: 0.15rem;
}
.cf-turnstile {
  margin: 0.15rem 0;
  justify-self: center;
}
.redeem-panel .hint {
  text-align: center;
  margin-top: 0.35rem;
}
.page-home .site-main {
  max-width: 560px;
}
.page-home .site-footer {
  text-align: center;
}
.redeem-form label,
.newsletter label {
  font-weight: 600;
  font-size: 0.92rem;
}
.redeem-form input[type="text"],
.redeem-form input[type="email"],
.newsletter input[type="text"],
.newsletter input[type="email"],
.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font: inherit;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.redeem-form input[type="text"]:focus,
.newsletter input:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
  transform: translateY(-1px);
}
.hint { color: var(--ink-soft); font-size: 0.92rem; margin: 0.15rem 0 0; }
.error {
  background: var(--warn-soft);
  color: var(--warn);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  animation: rise 0.4s ease both;
}
.success {
  background: var(--ok-soft);
  color: var(--accent-deep);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
}
.flash {
  max-width: 720px;
  margin: 0.75rem auto 0;
  padding: 0.75rem 1rem;
  background: var(--ok-soft);
  border-radius: var(--radius-sm);
  color: var(--accent-deep);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.35rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.btn-primary {
  background: var(--accent-deep);
  color: var(--btn-fg);
  box-shadow: var(--shadow);
  justify-self: start;
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--line);
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.bonus-hero {
  display: grid;
  gap: 1.5rem;
  animation: rise 0.65s ease both;
}
@media (min-width: 640px) {
  .bonus-hero {
    grid-template-columns: 168px 1fr;
    align-items: start;
  }
}
.cover {
  width: 100%;
  max-width: 168px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  background: var(--paper-elevated);
  border: 1px solid var(--line);
}
.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.45rem;
  font-weight: 700;
}
.bonus-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 2.45rem);
  margin: 0 0 0.35rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.author { color: var(--ink-soft); margin: 0 0 0.5rem; }
.author-link { margin: 0 0 1rem; font-size: 0.95rem; }
.download-block {
  margin: 1.35rem 0 0;
  padding: 1.35rem 0 0;
  border-top: 1px solid var(--line);
  animation: rise 0.75s ease 0.06s both;
}
.download-block .btn { margin-top: 0.65rem; }
.notice {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.newsletter {
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  animation: rise 0.8s ease 0.12s both;
}
.newsletter h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.newsletter > p { color: var(--ink-soft); margin: 0; max-width: 36rem; }
.newsletter form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.15rem;
  max-width: 28rem;
}
.newsletter form > .btn-primary {
  justify-self: center;
}
.checkbox-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.95rem;
}
.checkbox-row input { margin-top: 0.3rem; accent-color: var(--accent); }
.spam-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.spam-note strong { font-weight: 600; color: var(--ink); }

.prose { font-size: 1.02rem; }
.prose h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.25rem);
  letter-spacing: -0.02em;
}
.prose h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-top: 1.75rem;
}
.prose ul { padding-left: 1.2rem; }

.inline-form { display: inline; }
.linkish {
  background: none;
  border: none;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes wash-shift {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bg-wash { animation: none; }
}

.suggestions {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  animation: rise 0.7s ease 0.08s both;
}
.suggestions h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.suggest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 560px) {
  .suggest-list {
    grid-template-columns: 1fr 1fr;
  }
}
.suggest-card a {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.suggest-card a:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.suggest-cover {
  width: 56px;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--paper-elevated);
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.suggest-cover-empty {
  background: var(--accent-soft);
}
.suggest-card strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.25;
}
.suggest-card .muted {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .site-header { flex-direction: column; }
  .site-nav { width: 100%; }
  .btn-primary { width: 100%; justify-self: stretch; }
}
