/* ============================================================
   TugTale — Global Styles
   Baloo 2 (headings) + Nunito (body)
   Mobile-first, single-column, max-width 720px
   ============================================================ */

/* Fonts loaded via <link> in base.html for performance */

/* ---- Reset & Base ----------------------------------------- */

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

html {
  scroll-behavior: smooth;
  font-size: 18px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  color: #2c2c2c;
  background-color: var(--color-bg, #fdfaf5);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary, #c8922a);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

a:focus-visible {
  outline: 3px solid var(--color-primary, #c8922a);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Typography ------------------------------------------- */

h1, h2, h3, h4 {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-primary, #c8922a);
}

p {
  margin-bottom: 1.25rem;
}

p:last-child {
  margin-bottom: 0;
}

/* ---- Layout Container ------------------------------------- */

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- Ad Slot ---------------------------------------------- */

.ad-slot {
  border: 1px dashed rgba(0, 0, 0, 0.15);
  padding: 1.5rem 1rem;
  text-align: center;
  color: #999;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2.5rem auto;
  max-width: 728px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.02);
}

/* ---- Story Nav -------------------------------------------- */

.story-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-primary, #c8922a);
  color: #fff;
  padding: 0.6rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.story-nav .container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.story-nav .nav-title {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.story-nav .nav-chapters {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  flex: 1;
}

.story-nav .nav-chapters a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.story-nav .nav-chapters a:hover,
.story-nav .nav-chapters a:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-decoration: none;
}

.story-nav .nav-donate {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  white-space: nowrap;
  transition: background 0.15s;
}

.story-nav .nav-donate:hover,
.story-nav .nav-donate:focus-visible {
  background: rgba(255, 255, 255, 0.35);
  text-decoration: none;
}

/* ---- Hero Section ----------------------------------------- */

.hero {
  padding: 3rem 0 2.5rem;
  text-align: center;
  background-color: var(--color-accent, #e8d5a3);
}

.hero-image {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.hero-eyebrow {
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-primary, #c8922a);
  margin-bottom: 0.6rem;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3.25rem);
  color: var(--color-primary, #c8922a);
  margin-bottom: 1rem;
}

.hero-tagline {
  font-size: 1.1rem;
  font-weight: 600;
  color: #4a4a4a;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}
.story-summary {
  font-family: 'Baloo 2', cursive;
  font-size: 0.85rem;
  color: #6a6a6a;
  max-width: 540px;
  margin: -2.75rem auto 0.5rem;
  line-height: 1.4;
}

/* ---- Chapter Sections ------------------------------------- */

.chapter {
  padding: 3rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.chapter:last-of-type {
  border-bottom: none;
}

.chapter-number {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 5rem;
  line-height: 1;
  color: var(--color-accent, #e8d5a3);
  margin-bottom: -0.75rem;
  user-select: none;
}

.chapter-title {
  font-size: 1.6rem;
  color: var(--color-primary, #c8922a);
  margin-bottom: 1.5rem;
}

.chapter-image {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ---- Field Notes ------------------------------------------ */

.field-notes {
  background-color: var(--color-accent, #e8d5a3);
  padding: 2.5rem 0;
  margin: 2rem 0;
}

.field-notes h2 {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
}

.field-notes ul {
  list-style: none;
  padding: 0;
}

.field-notes ul li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  line-height: 1.6;
}

.field-notes ul li:last-child {
  border-bottom: none;
}

.field-notes ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-primary, #c8922a);
}

/* ---- Donate CTA ------------------------------------------- */

.donate-section {
  padding: 3rem 0;
  text-align: center;
  background-color: var(--color-secondary-bg, var(--color-bg, #fdfaf5));
}

.donate-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.donate-section p {
  color: #555;
  max-width: 520px;
  margin: 0 auto 1.75rem;
}

.donate-btn {
  background-color: var(--color-primary, #c8922a);
  color: #fff;
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  border-radius: 30px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.donate-btn:hover,
.donate-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  background-color: var(--color-secondary, #c8922a);
  filter: brightness(1.08);
}

/* ---- Footer ----------------------------------------------- */

.site-footer {
  background-color: #2c2c2c;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.75);
}

.site-footer .footer-dot {
  margin: 0 0.6em;
  opacity: 0.4;
}

.site-footer .footer-links {
  margin-bottom: 0.6rem;
}

.site-footer .footer-links a {
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.15s;
}

.site-footer .footer-links a:hover {
  color: #fff;
  text-decoration: none;
}

/* ---- Back link -------------------------------------------- */

.back-link-bar {
  padding: 0.75rem 0;
  font-size: 0.85rem;
  background: var(--color-bg, #fdfaf5);
}

.back-link-bar a {
  font-weight: 700;
  color: var(--color-primary, #c8922a);
}

/* ---- Homepage Styles -------------------------------------- */

.homepage {
  background: #fdf8f2;
}

/* ---- Sticky Nav ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(253, 248, 242, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

@media (min-width: 600px) {
  .nav-inner { height: 4rem; }
}

.nav-logo {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 1.6rem;
  color: #c8732a;
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}

.nav-logo:hover {
  color: #a85d1c;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #7a6a55;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #c8732a;
  text-decoration: none;
}

/* ---- Homepage Hero ---- */
.homepage-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #c8732a 0%, #a85d1c 40%, #7a4310 100%);
}

.homepage-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.homepage-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.homepage-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(90, 50, 15, 0.55);
}

.homepage-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.5rem 4rem;
  text-align: center;
}

@media (min-width: 600px) {
  .homepage-hero-inner {
    padding: 6rem 2rem 5.5rem;
  }
}

@media (min-width: 900px) {
  .homepage-hero-inner {
    padding: 8rem 2rem 7rem;
  }
}

.hero-headline {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
}

.hero-headline span {
  display: block;
}

.hero-headline em {
  font-style: normal;
  color: #ffd6a0;
  position: relative;
}


.hero-desc {
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
  max-width: 540px;
  margin: 0 auto 0.75rem;
}

@media (min-width: 600px) {
  .hero-desc {
    font-size: 1.15rem;
  }
}

.hero-cta {
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffd6a0;
  letter-spacing: 0.01em;
}

.stories-grid {
  padding: 2rem 1.25rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.stories-grid h2 {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #b8a080;
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.story-card {
  position: relative;
  background: var(--card-color, #c8732a);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.story-card:hover {
  transform: translateY(-6px) rotate(1deg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.story-card:focus-within {
  outline: 3px solid #c8732a;
  outline-offset: 2px;
}

.story-card-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #e8ddd0;
}

.story-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.story-card-body {
  background: #fff;
  padding: 0.85rem 1rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.story-card-title {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 0.95rem;
  color: #2c2c2c;
  margin-bottom: 0.3rem;
  line-height: 1.25;
}

.story-card-tagline {
  font-size: 0.78rem;
  color: #6a5e50;
  line-height: 1.45;
  flex: 1;
  margin-bottom: 0.75rem;
}

.story-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--card-color, #c8732a);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: gap 0.15s;
}

.story-card-link:hover {
  gap: 0.5rem;
  text-decoration: none;
}

.story-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.homepage-ad {
  max-width: 728px;
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
}

/* ---- Responsive tweaks for story pages ------------------- */

@media (min-width: 720px) {
  .hero {
    padding: 4rem 0 3rem;
  }

  .chapter {
    padding: 4rem 0;
  }

  .chapter-number {
    font-size: 7rem;
  }
}

/* ---- More Stories Section --------------------------------- */

.more-stories {
  background: var(--color-bg, #fdfaf5);
  padding: 3rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.more-stories h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.more-stories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 720px;
  margin: 0 auto;
}

@media (max-width: 500px) {
  .more-stories-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.more-story-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.more-story-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  text-decoration: none;
}

.more-story-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.more-story-fallback {
  display: none;
  width: 100%;
  aspect-ratio: 3 / 4;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  background: linear-gradient(135deg, #3a3a4a 0%, #5a5a6a 100%);
}

.more-story-fallback span {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  line-height: 1.2;
  color: rgba(255, 248, 240, 0.85);
}

.more-story-name {
  display: block;
  padding: 0.65rem 0.75rem;
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 0.85rem;
  color: #2c2c2c;
  line-height: 1.25;
}

/* ---- Category Page Styles --------------------------------- */

.category-hero {
  background: linear-gradient(135deg, #c8732a 0%, #a85d1c 40%, #7a4310 100%);
  padding: 3rem 1.5rem;
}

@media (min-width: 600px) {
  .category-hero { padding: 4.5rem 2rem; }
}

.category-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.category-title {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.25rem);
  color: #fff;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.category-desc {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 540px;
}

.breadcrumb {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.15s;
}

.breadcrumb a:hover {
  color: #fff;
  text-decoration: none;
}

.breadcrumb span {
  color: rgba(255, 255, 255, 0.9);
}

@media (prefers-reduced-motion: reduce) {
  .story-card:hover,
  .more-story-card:hover { transform: none; }
}
