@font-face {
  font-family: "Fredoka";
  src: url("../assets/fonts/Fredoka/Fredoka-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../assets/fonts/Fredoka/Fredoka-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../assets/fonts/Fredoka/Fredoka-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../assets/fonts/Fredoka/Fredoka-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

/* Same pastel palette + vibrant accents cover_builder_universal.py picks
   randomly for cover themes -- reused here so the site and the covers feel
   like the same studio made them. */
:root {
  --paper: #FFFBF0;
  --paper-panel: #FFFFFF;
  --ink: #1F2937;
  --ink-muted: #6B7280;
  --border: #F0E4C8;

  --sun: #F8B84E;
  --sun-soft: #F7D67A;
  --violet: #6D5EF6;
  --violet-soft: #A78BFA;
  --sky: #0284C7;
  --mint: #10B981;
  --berry: #EC4899;
  --amber: #D97706;

  --theme-yellow: #FEF3C7;
  --theme-blue: #DBEAFE;
  --theme-green: #DCFCE7;
  --theme-pink: #FFE4E6;
  --theme-lilac: #EDE9FE;

  --radius: 22px;
  --max-width: 1120px;
  font-size: 16px;
}

/* Toggled by the "Launch Emojis!" button (js/emoji-launcher.js) -- every
   click alternates every gold accent (buttons, badges, nav underline, etc.)
   between gold and platinum, since they all already read from these same
   three variables. */
body.platinum-mode {
  --sun: #C8C9CC;
  --sun-soft: #E8E9EB;
  --amber: #8B8D91;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  --page-bg: #FFFFFF;
  --page-accent: var(--violet);
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Fredoka", "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Each page has its own plain, flat background color (not a gradient) --
   pure white / light pink / light blue / light turquoise-grey -- and its
   nav tab's accent color matches, so the whole page reads as one theme. */
body[data-theme="home"] { --page-bg: #FFFFFF; --page-accent: var(--violet); }
body[data-theme="books"] { --page-bg: #FDE7EC; --page-accent: var(--berry); }
body[data-theme="about"] { --page-bg: #E3F0FC; --page-accent: var(--sky); }
body[data-theme="contact"] { --page-bg: #E1EEEC; --page-accent: var(--mint); }

h1, h2, h3, .brand, .btn {
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent; /* kills the default red/gray flash browsers show on tap */
}

button {
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
}

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--page-bg) 70%, white);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.brand img {
  height: 38px;
  width: 38px;
  transition: transform 0.6s ease;
}

.brand--spun img {
  transform: rotate(360deg);
}

.brand span.accent {
  background: linear-gradient(120deg, var(--amber), var(--sun));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

/* Each nav tab gets its own color (like each book card does) instead of one
   shared underline color -- keyed by href so it works identically across
   every page without touching each page's markup. */
.nav-links a {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 6px 2px;
  border-bottom: 3px solid transparent;
  border-radius: 3px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a[href="index.html"]:hover,
.nav-links a[href="index.html"][aria-current="page"] {
  color: var(--violet);
  border-bottom-color: var(--violet);
}

.nav-links a[href="books.html"]:hover,
.nav-links a[href="books.html"][aria-current="page"] {
  color: var(--berry);
  border-bottom-color: var(--berry);
}

.nav-links a[href="about.html"]:hover,
.nav-links a[href="about.html"][aria-current="page"] {
  color: var(--sky);
  border-bottom-color: var(--sky);
}

.nav-links a[href="contact.html"]:hover,
.nav-links a[href="contact.html"][aria-current="page"] {
  color: var(--mint);
  border-bottom-color: var(--mint);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--violet-soft);
  outline-offset: 3px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  font-size: 1.3rem;
  padding: 6px 10px;
  cursor: pointer;
}

/* ---------- "Pick your color" nav control (js/theme-picker.js) ---------- */
.color-picker {
  position: relative;
}

.color-picker-trigger {
  background: none;
  border: 2px solid var(--border);
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
  padding: 7px 12px;
  cursor: pointer;
  color: var(--ink);
}

.color-picker-trigger:hover {
  border-color: var(--page-accent, var(--violet-soft));
}

.color-picker-panel {
  display: none;
  position: absolute;
  top: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper-panel);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  box-shadow: 0 16px 30px -14px rgba(31, 41, 55, 0.35);
  z-index: 25;
}

.color-picker-panel.open {
  display: grid;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.color-swatch:hover {
  border-color: var(--violet-soft);
}

.color-swatch--reset {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  font-size: 1rem;
}

/* ---------- Margin confetti (js/confetti-extra.js) ---------- */
.confetti-margin {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Gamified "launch emojis" button + flight (js/emoji-launcher.js) ---------- */
.emoji-launch-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  background: linear-gradient(120deg, var(--violet-soft), var(--violet));
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 14px 28px -12px rgba(109, 94, 246, 0.65);
}

.emoji-launch-btn:hover {
  transform: translateY(-2px);
}

.flying-emoji {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  z-index: 9999;
  transform: translate(0, 0) rotate(0deg) scale(1);
  opacity: 1;
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.9s ease;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--paper-panel);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 24px 16px;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 0.98rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px) rotate(-0.5deg);
}

.btn-primary {
  background: linear-gradient(120deg, var(--sun-soft), var(--sun));
  color: #4A2E05;
  box-shadow: 0 10px 24px -10px rgba(216, 148, 34, 0.7);
}

.btn-primary::before {
  content: "\2728";
}

.btn-secondary {
  background: var(--paper-panel);
  border-color: var(--border);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--violet-soft);
}

/* "Buy on Amazon" -- a darker shade of whatever page color is active
   (--page-bg, including the nav color-picker override), so the button
   always matches the current theme instead of a fixed brand color. Falls
   back to a fixed dark slate for older browsers without color-mix(). */
.btn-buy {
  background: #1F2937;
  color: #FFFFFF;
  border-color: transparent;
}

@supports (background: color-mix(in srgb, red, blue)) {
  .btn-buy {
    background: color-mix(in srgb, var(--page-bg) 55%, #1F2937 45%);
  }

  .btn-buy:hover {
    background: color-mix(in srgb, var(--page-bg) 40%, #1F2937 60%);
  }
}

.btn-buy .btn-icon {
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  border-color: var(--border);
}

/* ---------- Hero ---------- */
.hero {
  padding: 84px 0 64px;
  text-align: center;
  overflow: hidden;
}

.confetti {
  position: absolute;
  pointer-events: none;
  opacity: 0.85;
  font-size: 1.6rem;
}

.hero .eyebrow {
  display: inline-block;
  padding: 7px 18px;
  border-radius: 999px;
  border: 2px dashed var(--violet-soft);
  background: var(--theme-lilac);
  color: var(--violet);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  margin: 0 0 18px;
  line-height: 1.18;
}

.hero h1 .accent {
  background: linear-gradient(120deg, var(--violet), var(--berry), var(--sun));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  max-width: 640px;
  margin: 0 auto 32px;
  color: var(--ink-muted);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Sections ---------- */
section {
  padding: 56px 0;
}

.section-heading {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

.section-heading .eyebrow {
  color: var(--berry);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 12px;
}

.section-heading p {
  color: var(--ink-muted);
  margin: 0;
}

/* ---------- Grids / cards ---------- */
.grid {
  display: grid;
  gap: 24px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Book catalog: fixed 3-per-row (not auto-fit) so 5 books read as a clean
   3+2 grid instead of an uneven 4+1 depending on viewport width. */
#book-grid {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 860px) {
  #book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  #book-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--paper-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.card p {
  color: var(--ink-muted);
  margin: 0;
  font-size: 0.95rem;
}

.card .icon {
  font-size: 1.8rem;
  margin-bottom: 14px;
  display: inline-block;
}

/* ---------- "Why The Rama Creations" flip tiles (homepage) ---------- */
.why-tiles {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .why-tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .why-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tile {
  aspect-ratio: 1;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.tile-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
}

.tile-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  background: var(--tile-color, var(--ink));
  color: #FFFFFF;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.tile-front {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.35;
}

.tile-back {
  opacity: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  font-weight: 500;
}

.tile.is-flipped .tile-front {
  opacity: 0;
}

.tile.is-flipped .tile-back {
  opacity: 1;
}

.tile:focus-visible .tile-inner {
  outline: 3px solid var(--violet-soft);
  outline-offset: 2px;
}

/* ---------- Book cards ---------- */
.book-card {
  background: var(--paper-panel);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* .book-card's own `display: flex` above out-ranks the browser's built-in
   `[hidden] { display: none }` rule (author styles beat user-agent styles at
   equal specificity) -- without this, JS setting `.hidden = true` for
   search/filter updates the attribute but never actually hides the card. */
.book-card[hidden] {
  display: none;
}

.book-cover {
  aspect-ratio: 8.5 / 11;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-weight: 700;
  font-size: 1.2rem;
  color: #2b1c05;
  position: relative;
}

.book-cover::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: 14px;
}

/* Real cover photo instead of a solid-color placeholder -- same frame,
   image fills it via object-fit so different cover aspect ratios don't distort. */
.book-cover--photo {
  padding: 0;
  overflow: hidden;
}

.book-cover--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover--photo::after {
  border-color: rgba(255, 255, 255, 0.75);
}

.book-card .book-body {
  padding: 20px 22px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
}

.book-card p {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.show-more-btn {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--violet);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.show-more-btn:hover {
  color: var(--violet-soft);
}

/* Show more sits above the buy/coming-soon action, which is centered on its
   own row below it. Pinned to the bottom of the card (margin-top: auto)
   so the buttons line up at the same height across cards, no matter how
   long each book's description is. */
.book-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: auto;
}

.book-card-buy-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.book-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--theme-lilac);
  color: var(--violet);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.badge::before {
  content: "\2B50 ";
}

/* ---------- Catalog toolbar (search / filter / sort) ---------- */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.catalog-toolbar input[type="search"] {
  flex: 1 1 240px;
}

.catalog-toolbar select {
  flex: 0 1 180px;
}

.catalog-toolbar input,
.catalog-toolbar select {
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--paper-panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
}

.catalog-toolbar input:focus,
.catalog-toolbar select:focus {
  outline: 3px solid var(--violet-soft);
  outline-offset: 1px;
}

.no-results {
  text-align: center;
  color: var(--ink-muted);
  padding: 24px;
}

/* Clickable "flyer" cover -- opens the quick-view dialog */
.book-cover[role="button"] {
  cursor: pointer;
}

.book-cover[role="button"]:focus-visible {
  outline: 3px solid var(--violet-soft);
  outline-offset: -3px;
}

/* ---------- Quick view dialog ---------- */
.book-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 560px;
  width: 90vw;
  background: var(--paper-panel);
}

.book-modal::backdrop {
  background: rgba(31, 41, 55, 0.45);
}

.book-modal .modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
}

.book-modal .modal-close:hover {
  color: var(--ink);
}

#book-modal-content {
  display: flex;
  flex-direction: column;
}

.book-modal-media {
  aspect-ratio: 8.5 / 11;
  max-height: 50vh;
  background-size: cover;
  background-position: center;
}

.book-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Quick-view carousel (front/back/reviews) ---------- */
.book-carousel {
  position: relative;
  aspect-ratio: 8.5 / 11;
  max-height: 50vh;
  overflow: hidden;
}

.book-carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
}

.book-carousel-slide {
  flex: 0 0 100%;
  position: relative;
  height: 100%;
}

.book-carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

/* Top-right "expand to full size" button on the quick-view modal's carousel */
.book-carousel-expand {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.book-carousel-expand:hover {
  background: #FFFFFF;
}

/* ---------- Full-size image lightbox (opens from a carousel slide) ---------- */
/* Hosts the SAME navigable carousel, just larger and uncropped, so browsing
   full/back/social images doesn't require closing and reopening. */
.image-lightbox {
  border: none;
  padding: 0;
  max-width: 95vw;
  max-height: 95vh;
  width: min(92vw, 900px);
  background: #000;
  border-radius: var(--radius);
}

.image-lightbox::backdrop {
  background: rgba(15, 23, 42, 0.85);
}

.image-lightbox:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
}

.lightbox-toolbar {
  position: fixed;
  top: 18px;
  right: 24px;
  display: flex;
  gap: 10px;
  z-index: 3;
}

.modal-icon-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.modal-icon-btn:hover {
  background: #FFFFFF;
}

#lightbox-content {
  width: 100%;
  height: 100%;
}

#lightbox-content .book-carousel {
  aspect-ratio: unset;
  width: min(92vw, 900px);
  height: 85vh;
  max-height: 85vh;
}

.image-lightbox:fullscreen #lightbox-content .book-carousel {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
}

#lightbox-content .book-carousel-slide img {
  object-fit: contain;
  cursor: default;
  background: #000;
}

#lightbox-content .book-carousel-btn {
  width: 48px;
  height: 48px;
  font-size: 1.7rem;
}

.book-carousel-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(31, 41, 55, 0.65);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.book-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.book-carousel-btn:hover {
  background: #FFFFFF;
}

.book-carousel-btn--prev {
  left: 10px;
}

.book-carousel-btn--next {
  right: 10px;
}

.book-carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.book-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
}

.book-carousel-dot.active {
  background: #FFFFFF;
}

.book-modal-body {
  padding: 24px 28px 28px;
}

.book-modal-body h3 {
  margin: 8px 0 10px;
}

.book-modal-body p {
  color: var(--ink-muted);
  margin: 0 0 18px;
}

/* ---------- Forms ---------- */
.form-card {
  background: var(--paper-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 560px;
  margin: 0 auto;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 16px 0 6px;
}

label:first-of-type {
  margin-top: 0;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
}

input:focus,
textarea:focus {
  outline: 3px solid var(--violet-soft);
  outline-offset: 1px;
}

input.invalid,
textarea.invalid {
  border-color: var(--berry);
  outline: none;
}

.field-error {
  color: var(--berry);
  font-size: 0.8rem;
  font-weight: 600;
  margin: 4px 0 0;
  min-height: 1.1em;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.form-actions {
  margin-top: 22px;
}

.form-note {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 14px;
}

.form-note.status-success {
  color: var(--mint);
  font-weight: 700;
}

.form-note.status-error {
  color: var(--berry);
  font-weight: 700;
}

.form-note.status-sending {
  color: var(--violet);
  font-weight: 700;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 40px 0;
  background: var(--paper-panel);
}

.footer-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--ink);
}

.footer-copy {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

/* ---------- About page: audience donut chart ---------- */
.audience-donut-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin-top: 8px;
}

@media (min-width: 700px) {
  .audience-donut-wrap {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 48px;
  }
}

.audience-donut svg {
  display: block;
  max-width: 220px;
  height: auto;
}

.donut-segment {
  cursor: pointer;
  stroke-width: 38px;
  transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

.donut-segment:hover,
.donut-segment:focus-visible {
  opacity: 0.85;
}

.donut-segment.is-active {
  stroke-width: 44px;
}

/* Suppress the browser's default focus box on click/tap -- our own
   stroke-width change above (and the legend highlight) already show what's
   selected, and the UA default can paint as a stray black/yellow square
   (especially under Windows high-contrast / forced-colors mode). */
.donut-segment {
  outline: none;
  forced-color-adjust: none;
}

.donut-segment:focus,
.donut-segment:focus-visible {
  outline: none;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  font-family: inherit;
}

.legend-item:hover {
  background: var(--paper-panel);
}

.legend-item.is-active {
  background: var(--paper-panel);
  box-shadow: 0 0 0 2px var(--legend-color) inset;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--legend-color);
  flex: 0 0 auto;
}

/* Popup card is positioned in normal flow next to the chart (not floating
   over it), since audience count/screen width already forces a column vs.
   row layout -- see the media query above. */
.donut-popup {
  position: relative;
  max-width: 320px;
  background: var(--paper-panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 26px 20px 20px;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.12);
}

.donut-popup[hidden] {
  display: none;
}

.donut-popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
}

.donut-popup-close:hover {
  color: var(--ink);
}

.donut-popup h3 {
  margin: 0 0 8px;
}

.donut-popup p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}
