/**
 * shared.css — styles used by every word sub-page
 */

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

/* Images never overflow their container on any screen size */
img { max-width: 100%; height: auto; display: block; }

:root {
  --cream:        #f5f0e8;
  --parchment:    #ede5d0;
  --warm-tan:     #c9a87c;
  --terracotta:   #c4714a;
  --sage:         #7a9e7e;
  --deep-brown:   #3d2b1f;
  --pink:       #990099;
  --ink:          #2c2016;
  --accent:       var(--terracotta);
  --shadow:       rgba(61, 43, 31, 0.18);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Lora', Georgia, serif;
}

html, body {
  min-height: 100vh;
  /* Prevent any element from causing horizontal scroll */
  overflow-x: hidden;
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  font-family: var(--font-body);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
      blockquote {
        font-style: italic;
        border-left: 4px solid #ccc;
        padding-left: 15px;
        margin: 20px 0;
      }
      b {
         color: var(--pink);
      }

.page {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Back link ────────────────────────────────────────────────────── */
.back-link {
  align-self: flex-start;
  font-size: 0.85rem;
  color: var(--warm-tan);
  text-decoration: none;
  letter-spacing: 0.06em;
  margin-bottom: 1.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
  font-style: italic;
  /* Ensure tap target is big enough */
  min-height: 44px;
  padding: 0.4rem 0;
}
.back-link:hover { color: var(--accent); }

/* ── Title ────────────────────────────────────────────────────────── */
.word-title {
  font-family: var(--font-display);
  /* clamp: min 2rem on tiny phones, fluid, max 5rem on desktop */
  font-size: clamp(2rem, 10vw, 5rem);
  font-weight: 900;
  color: var(--deep-brown);
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.5rem;
  position: relative;
  /* Prevent long words from causing overflow */
  word-break: break-word;
}

.word-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin: 0.9rem auto 0;
}

/* ── Image ────────────────────────────────────────────────────────── */
.word-image {
  width: 100%;          /* actively scales down to fit its container   */
  max-width: 500px;     /* caps the size on larger screens              */
  height: auto;         /* scales height proportionally with width      */
  /* Cap height so it never fills a portrait phone screen.
     56vw ≈ 16:9 ratio — on a 375px phone this is ~210px tall.
     On desktop max-width:560px takes over and limits height naturally. */
  max-height: 56vw;
  object-fit: cover;
  border-radius: 2px;
  border: 4px solid var(--parchment);
  box-shadow: 0 4px 24px var(--shadow);
  display: block;
  margin: 1.5rem auto;
  filter: sepia(10%) saturate(90%);
}

/* ── Body text ────────────────────────────────────────────────────── */
.word-body {
  width: 100%;
  max-width: 580px;
  margin: 0 auto 2rem;
  /* Prevent text from ever causing horizontal scroll */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.word-body p {
  /* clamp: readable on phones (1rem), fluid, max 1.15rem on desktop */
  font-size: clamp(1rem, 3vw, 1.15rem);
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 1.1rem;
}

.word-body blockquote {
  font-style: italic;
  /* Slightly smaller on mobile so it doesn't crowd */
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  color: var(--deep-brown);
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.2rem 0;
  text-align: left;
}

/* ── Legacy player wrap (kept for any pages that still use it) ────── */
.player-wrap {
  background: var(--parchment);
  border: 1px solid var(--warm-tan);
  border-radius: 3px;
  padding: 1.2rem 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 2px 10px var(--shadow);
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.player-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm-tan);
}

.player-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--deep-brown);
}

audio {
  width: 100%;
  accent-color: var(--accent);
}

/* ── Fade-in ──────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.word-title  { animation: fadeUp 0.7s ease both; }
.word-image  { animation: fadeUp 0.7s ease 0.15s both; }
.word-body   { animation: fadeUp 0.7s ease 0.25s both; }
.player-wrap { animation: fadeUp 0.7s ease 0.35s both; }

/* ── Tablet (≤ 768px) ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page { padding: 2rem 1.2rem 3rem; }
  .word-image { border-width: 3px; }
}

/* ── Mobile (≤ 600px) ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page        { padding: 1.5rem 1rem 3rem; }
  .back-link   { margin-bottom: 1.2rem; }
  .word-image  { margin: 1.2rem auto; border-width: 3px; }
  .word-body   { margin-bottom: 1.5rem; }
  .word-body blockquote { padding: 0.4rem 0.8rem; }
}

/* ── Small phones (≤ 400px) ───────────────────────────────────────── */
@media (max-width: 400px) {
  .page      { padding: 1rem 0.75rem 2.5rem; }
  .word-title::after { width: 36px; }
}
