/* ==========================================================================
   Pet Stories in Color — Version 1 stylesheet
   Mobile-first. Plain CSS, no build step. Brand tokens live in :root below.
   Base styles below target ~375-430px phones; @media (min-width) blocks
   progressively enhance for tablet (640px+) and desktop (1024px+).
   ========================================================================== */

:root {
  /* Brand colors — rebuilt around the Pet Stories in Color logo
     (turquoise + golden yellow). Coral is intentionally no longer
     referenced by any rule below.
     --coral / --coral-dark / --turquoise-dark / --ink are kept defined
     with their ORIGINAL values, unchanged, because dashboard/index.html
     (frozen, out of scope for this pass) reads them directly from this
     file for its own styling — changing their values would silently
     change the dashboard's appearance without ever touching that file.
     --turquoise-text is new: a deeper, text-contrast-safe teal used only
     by public-site text/links (plain turquoise doesn't pass 4.5:1
     against white for text). */
  --coral: #FF3F5F;
  --coral-dark: #E22A48;
  --turquoise: #25C8D5;
  --turquoise-dark: #1AA5B0;
  --turquoise-text: #0E7A82;
  --yellow: #F7C948;
  --ink: #171717;
  --bg: #FFFDF8;
  --gray-light: #F4F4F2;
  --white: #FFFFFF;

  /* Type */
  --font-display: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(23, 23, 23, 0.06);
  --shadow-md: 0 6px 20px rgba(23, 23, 23, 0.08);
  --container-w: 1180px;
  --gutter: 16px;
}

/* -------------------------------------------------------------------------
   Reset & base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}
p { margin: 0 0 0.9em; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 3px solid var(--turquoise);
  outline-offset: 2px;
}
@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

/* -------------------------------------------------------------------------
   Site header / logo placeholder — compact on every breakpoint
   ------------------------------------------------------------------------- */
.site-header {
  padding: 10px 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-light);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* The real logo (images/logo.png) — a circular mark, so it just needs
   rounding + a soft shadow to sit cleanly at any size. */
.logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  object-fit: cover;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.95rem, 3.6vw, 1.2rem);
  color: var(--ink);
  white-space: nowrap;
}
.brand-name-accent { color: var(--turquoise-text); }

/* Simple text nav next to the brand — three links, no dropdown/menu
   button. Wraps to its own centered row on narrow phones rather than
   ever causing horizontal overflow. */
.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}
.site-nav a {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  padding: 4px 2px;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--turquoise-text); }

@media (min-width: 640px) {
  .site-header { padding: 14px 0; }
  .logo { width: 44px; height: 44px; }
}

/* -------------------------------------------------------------------------
   Hero / intro — short, compact, gets straight to search + library
   ------------------------------------------------------------------------- */
.hero {
  padding: 18px 0 14px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.3rem, 5.5vw, 2.2rem);
  max-width: 20ch;
  margin: 0 auto 6px;
}
.hero-sub {
  max-width: 40ch;
  margin: 0 auto 14px;
  color: #4a4a4a;
  font-size: clamp(0.85rem, 2.6vw, 0.98rem);
}

.search-wrap {
  max-width: 560px;
  margin: 0 auto 12px;
  position: relative;
}
.search-wrap::before {
  content: "🔍";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.6;
  pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 14px 16px 14px 42px;
  font-size: 16px; /* keeps iOS from zooming in on focus */
  border: 2px solid var(--gray-light);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
#search-input::placeholder { color: #9a9a97; font-size: 0.92rem; }
#search-input:focus {
  border-color: var(--turquoise);
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 200, 213, 0.15);
}

/* Filter chips: single horizontally-scrolling row on mobile (bleeds to
   the screen edge for a natural swipe), wraps centered from tablet up. */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 6px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  border: 2px solid var(--gray-light);
  background: var(--white);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 40px;
}
.chip:hover { border-color: var(--turquoise); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

@media (min-width: 640px) {
  .hero { padding: 28px 0 20px; }
  .filter-chips {
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
    margin: 0 auto;
    padding: 0;
    max-width: 680px;
  }
}

/* -------------------------------------------------------------------------
   Email signup strip — live Systeme.io form, fully restyled to match the
   site (see js/data.js renderSignupHtml() for the actual markup/action).
   ------------------------------------------------------------------------- */
.signup-strip {
  margin: 28px 0;
  padding: 18px;
  background: linear-gradient(120deg, rgba(37,200,213,0.10), rgba(247,201,72,0.16));
  border: 1px solid rgba(23,23,23,0.06);
  border-radius: var(--radius-lg);
}
.signup-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.signup-text h2 {
  font-size: clamp(1rem, 3.2vw, 1.15rem);
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.signup-text p {
  margin: 0;
  font-size: 0.88rem;
  color: #4a4a4a;
}
.signup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}
.signup-form input[type="email"] {
  padding: 12px 16px;
  border: 2px solid var(--gray-light);
  border-radius: 999px;
  font-size: 16px;
  min-width: 0;
  width: 100%;
  background: var(--white);
}
.signup-form input[type="email"]:focus {
  border-color: var(--turquoise);
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 200, 213, 0.15);
}
.signup-form .btn {
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.signup-note {
  width: 100%;
  font-size: 0.78rem;
  color: #767674;
  margin-top: 4px;
}
@media (min-width: 560px) {
  .signup-form { flex-wrap: nowrap; width: auto; }
  .signup-form input[type="email"] { width: 260px; }
  .signup-form .btn { width: auto; }
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid transparent;
  min-height: 46px;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
/* Dark charcoal text on turquoise (not white) is deliberate: plain
   white text on this turquoise only reaches ~2:1 contrast, well short
   of the 4.5:1 a button label needs -- ink on turquoise reaches ~7:1. */
.btn-primary {
  background: var(--turquoise);
  color: var(--ink);
}
.btn-primary:hover { background: var(--turquoise-text); color: var(--white); }
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border-color: var(--gray-light);
}
.btn-secondary:hover { border-color: var(--turquoise); }

/* -------------------------------------------------------------------------
   Library / results
   ------------------------------------------------------------------------- */
.library { padding: 4px 0 40px; }
.results-count {
  font-size: 0.82rem;
  color: #6a6a68;
  margin-bottom: 12px;
  font-weight: 600;
}
/* Empty by default (see js/main.js) so the grid starts right after the
   filter chips with no leftover gap when there's no search query. */
.results-count:empty {
  margin: 0;
  display: none;
}
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #6a6a68;
  font-size: 1rem;
}

/* "Load More" sits centered under the library grid so pagination never
   requires rendering every record up front (see js/main.js). */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.load-more-wrap .btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Two columns from the smallest supported phone width up — this is the
   visual star of the homepage, so it appears immediately. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}
@media (min-width: 1024px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Thumbnail — dominant, colorful, illustrated. A real photo (once set in
   pages.json) fills the same box via object-fit: cover; the generated
   placeholder SVG (js/illustrations.js) crop-fills it the same way. */
.card-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: var(--gray-light);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-thumb svg { width: 100%; height: 100%; display: block; }

.card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-coloring, .badge-coloring { background: var(--turquoise); }
.dot-puzzle, .badge-puzzle { background: var(--turquoise-dark); }
.dot-activity, .badge-activity { background: var(--ink); }
.dot-pet-tips, .badge-pet-tips { background: var(--yellow); }
.dot-maze, .badge-maze { background: var(--coral); }
.meta-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: #8a8a87;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  margin: 1px 0 0;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Standalone badge (used on the individual page + related section) */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--white);
}
.badge-pet-tips { color: var(--ink); }

@media (min-width: 640px) {
  .card-body { padding: 12px 14px 14px; gap: 4px; }
  .card-title { font-size: 1.02rem; }
}

/* -------------------------------------------------------------------------
   Featured Pet Find — the homepage's one reusable ad/product slot
   (js/data.js renderFeaturedHtml(), data driven by /data/featured.json).
   Deliberately NOT styled like .card: a bordered, labeled "advertising"
   treatment so it always reads as the commerce layer, never as one of
   the free editorial Pet Stories. Stacks on mobile, sits side-by-side
   from tablet width up.
   ------------------------------------------------------------------------- */
.featured-find { margin: 18px 0; }
.featured-find-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #EAFBFC; /* pale turquoise wash — sparing use, per the new palette */
  border: 1px solid var(--gray-light);
  border-top: 4px solid var(--yellow);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.featured-label {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: var(--yellow);
  padding: 5px 10px;
  border-radius: 999px;
}
.featured-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-light);
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* object-fit: contain (not cover) is deliberate here: a product shot is
   a single object that needs to be shown in FULL, never cropped, and
   this needs to look right for a transparent PNG/WEBP product cutout
   just as well as a plain photo -- the padded, centered background box
   works as a clean "product card" backdrop in either case. */
.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.featured-media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: #b3b3af;
  border: 2px dashed #cfcfcb;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}
.featured-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.featured-headline {
  font-size: 1.05rem;
  margin: 0;
}
.featured-desc {
  font-size: 0.9rem;
  color: #4a4a48;
  margin: 0;
}
.featured-body .btn {
  width: 100%;
  margin-top: 4px;
}
.featured-story-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--turquoise-text);
  margin-top: 2px;
}

@media (min-width: 640px) {
  .featured-find { margin: 24px 0; }
  .featured-find-inner {
    flex-direction: row;
    align-items: center;
    padding: 20px;
    gap: 20px;
  }
  .featured-media {
    width: 240px;
    aspect-ratio: 1 / 1;
  }
  .featured-body .btn { width: auto; }
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: var(--white);
  padding: 36px 0 24px;
  margin-top: 20px;
}
.footer-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.footer-tag {
  color: #b8b8b6;
  font-size: 0.9rem;
  margin-bottom: 20px;
  max-width: 40ch;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}
.footer-links a {
  color: #e6e6e4;
  font-size: 0.88rem;
}
.footer-links a:hover { color: var(--turquoise); }
.footer-copy {
  color: #8a8a88;
  font-size: 0.78rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
}

/* -------------------------------------------------------------------------
   Disclosure note (reusable — see includes on individual page + footer)
   ------------------------------------------------------------------------- */
.disclosure-note {
  font-size: 0.78rem;
  color: #8a8a88;
  line-height: 1.5;
}
.site-footer .disclosure-note { color: #8a8a88; }
main .disclosure-note {
  background: var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #6a6a68;
}

/* -------------------------------------------------------------------------
   Individual page view
   ------------------------------------------------------------------------- */
.page-view { padding: 18px 0 48px; }
.breadcrumb {
  font-size: 0.85rem;
  color: #9a9a97;
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--turquoise-text); font-weight: 600; }

.page-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
@media (min-width: 760px) {
  .page-hero { grid-template-columns: minmax(0, 460px) 1fr; align-items: start; gap: 32px; }
}

.page-preview {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 1 / 1;
  position: relative;
}
.page-preview img { width: 100%; height: 100%; object-fit: cover; }
.page-preview svg { width: 100%; height: 100%; display: block; }
@media (min-width: 760px) {
  .page-preview { aspect-ratio: 4 / 3; }
}

.page-info .badge { margin-bottom: 10px; }
.page-info h1 {
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  margin-bottom: 6px;
}
.page-info .psic-id {
  font-size: 0.8rem;
  font-weight: 700;
  color: #9a9a97;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  display: block;
}
.page-info .pet-line {
  font-size: 0.92rem;
  color: #5a5a58;
  margin-bottom: 10px;
}
.page-info .page-desc {
  font-size: 1rem;
  color: #3a3a38;
  margin-bottom: 18px;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}
.page-actions .btn { width: 100%; }
@media (min-width: 480px) {
  .page-actions .btn { width: auto; }
}

.section-heading {
  font-size: 1.05rem;
  margin: 32px 0 12px;
}

/* Destination block ("Continue the Story") — data-driven from a
   record's "destination" field; replaces a single hardcoded product
   section, since not every story points somewhere commercial. */
.destination-block {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  background: var(--gray-light);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.destination-qr {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  object-fit: contain;
  background: var(--white);
}
.destination-qr-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #cfcfcb;
  color: #b3b3af;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.destination-body { flex: 1; min-width: 200px; }
.destination-prompt { font-size: 0.92rem; color: #4a4a48; margin-bottom: 10px; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .related-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}

/* -------------------------------------------------------------------------
   Simple content pages (about / privacy / contact / etc.)
   ------------------------------------------------------------------------- */
.simple-page { padding: 32px 0 56px; max-width: 720px; }
.simple-page h1 { font-size: clamp(1.4rem, 5vw, 1.8rem); margin-bottom: 14px; }
.simple-page p { color: #3a3a38; }

/* -------------------------------------------------------------------------
   Submit Your Pet form (see submit-your-pet.html / js/submit-form.js)
   ------------------------------------------------------------------------- */
.submit-pet-form { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; max-width: 480px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="file"],
.form-field textarea {
  padding: 12px 14px;
  border: 2px solid var(--gray-light);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  color: var(--ink);
}
.form-field textarea { resize: vertical; min-height: 110px; }
.form-field input:focus, .form-field textarea:focus {
  border-color: var(--turquoise);
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 200, 213, 0.15);
}
.form-field-checkbox label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  font-size: 0.88rem;
  color: #3a3a38;
}
.form-field-checkbox input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.form-error {
  background: #FFF1F2;
  border: 2px solid var(--coral);
  color: var(--coral-dark);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
}
.submit-pet-success { margin-top: 22px; }
.submit-pet-success h2 { font-size: 1.3rem; margin-bottom: 8px; }

/* -------------------------------------------------------------------------
   Thank-you / success state (see thank-you.html)
   ------------------------------------------------------------------------- */
.thank-you { text-align: center; margin: 0 auto; }
.thank-you-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--turquoise), var(--yellow));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  margin: 8px auto 18px;
  box-shadow: var(--shadow-md);
}
.thank-you p {
  max-width: 44ch;
  margin-left: auto;
  margin-right: auto;
}
.thank-you .btn { margin-top: 6px; }
