/* ═══════════════════════════════════════════════════════════
   MOTORE RACCONTI – Foglio di stile condiviso
   Shared stylesheet for all short stories.
   Do NOT edit per-story: edit only the story data files.
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Dark theme (default) */
  --bg: #0a0a0c;
  --bg2: #121216;
  --fg: #d8d4cc;
  --fg-dim: #8a857c;
  --accent: #8b1a1a;
  --accent-glow: #b32020;
  --fog: rgba(80,90,100,0.04);
  --border: rgba(216,212,204,0.1);
  --text-shadow-mobile: none;
  --reader-scale: 1;   /* controlled by font-size buttons */
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #efe9df;
  --bg2: #e2dacb;
  --fg: #2a2622;
  --fg-dim: #6b6459;
  --accent: #8b1a1a;
  --accent-glow: #a01c1c;
  --fog: rgba(120,100,80,0.05);
  --border: rgba(42,38,34,0.14);
}

/* ═══════════════════════════════════════════════════════════
   TEMI COLORE PER RACCONTO
   Colour themes per story. Set on <body data-accent="green|blue|red">.
   Only the accent colours change; backgrounds stay the same.
   Default (no attribute) = red.
   ═══════════════════════════════════════════════════════════ */

/* Verde brillante (stesso verde del sito 2finger) */
:root body[data-accent="green"] { --accent: #2a8a1f; --accent-glow: #3aaf2e; }
:root[data-theme="light"] body[data-accent="green"] { --accent: #2a8a1f; --accent-glow: #278a1c; }

/* Azzurro */
:root body[data-accent="blue"] { --accent: #1e5f9e; --accent-glow: #3a9fd6; }
:root[data-theme="light"] body[data-accent="blue"] { --accent: #1e5f9e; --accent-glow: #1c74b0; }

/* The accent glow shadows are tuned for red; soften them for other themes */
body[data-accent="green"] .menu-title,
body[data-accent="blue"] .menu-title { text-shadow: 0 0 30px rgba(58,175,110,0.28); }
body[data-accent="blue"] .menu-title { text-shadow: 0 0 30px rgba(58,159,214,0.3); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(60,40,40,0.15), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: calc(19px * var(--reader-scale));
  line-height: 1.85;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(180,150,120,0.18), transparent 60%),
    var(--bg);
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 20% 80%, var(--fog), transparent 40%),
    radial-gradient(circle at 80% 20%, var(--fog), transparent 40%);
  pointer-events: none; z-index: 0;
}
.wrap { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }

/* ── TOP BAR (links + controls) ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.topbar-right { display: flex; gap: 0.4rem; align-items: center; }
.tb-link, .tb-btn {
  font-family: 'Cinzel', serif; font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg-dim); text-decoration: none;
  padding: 0.45rem 0.7rem; border: 1px solid var(--border);
  background: transparent; cursor: pointer; transition: all .2s;
  white-space: nowrap; line-height: 1;
}
.tb-link:hover, .tb-btn:hover { color: var(--fg); border-color: var(--accent); }
.tb-btn.icon { min-width: 2.2rem; text-align: center; font-size: 0.9rem; }

/* ── MENU / INDICE (used by racconti.html index) ── */
#menu { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 6rem 0 4rem; }
.menu-title {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(3rem, 9vw, 5.5rem);
  text-align: center; letter-spacing: 0.08em;
  color: var(--fg); text-shadow: 0 0 30px rgba(179,32,32,0.35);
  margin-bottom: 0.5rem; line-height: 1.1;
}
.menu-sub { text-align: center; font-style: italic; color: var(--fg-dim); font-size: 1.1rem; margin-bottom: 3rem; letter-spacing: 0.02em; }
.menu-sub .story-subtitle { display: block; color: var(--accent-glow); font-size: 1rem; margin-bottom: 0.4rem; line-height: 1.4; }
.menu-sub .story-note { display: inline-block; font-size: 0.82rem; opacity: 0.7; margin-top: 0.6rem; line-height: 1.5; }
.story-list { list-style: none; display: flex; flex-direction: column; gap: 1px; max-width: 620px; margin: 0 auto; width: 100%; }
.story-item {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 1.5rem 1.75rem; background: var(--bg2);
  border: 1px solid var(--border); cursor: pointer;
  transition: all .25s ease; text-align: left; width: 100%;
  font-family: inherit; color: var(--fg); text-decoration: none;
}
.story-item:hover { background: color-mix(in srgb, var(--bg2) 80%, var(--accent) 20%); border-color: var(--accent); transform: translateX(6px); }
.story-item .si-icon { font-size: 1.8rem; flex-shrink: 0; opacity: 0.85; }
.story-item .si-text { flex: 1; }
.story-item .si-name { display: block; line-height: 1.15; font-family: 'Cinzel', serif; font-size: 1.35rem; letter-spacing: 0.02em; margin-bottom: 0.15rem; }
.story-item .si-subtitle { display: block; line-height: 1.25; font-size: 0.85rem; font-style: italic; color: var(--fg); opacity: 0.6; margin-bottom: 0.3rem; }
.story-item .si-genre { display: block; line-height: 1.2; font-size: 0.82rem; font-style: italic; color: var(--accent-glow); letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.story-item .si-desc { display: block; line-height: 1.3; font-size: 0.92rem; color: var(--fg-dim); opacity: 0.75; font-style: italic; }
.story-item .si-arrow { color: var(--accent-glow); font-size: 1.3rem; opacity: 0; transition: opacity .2s, transform .2s; }
.story-item:hover .si-arrow { opacity: 1; transform: translateX(4px); }
.story-item .si-rating { position: absolute; top: 0.9rem; right: 1rem; font-family: 'Cinzel', serif; font-size: 0.8rem; color: var(--fg); white-space: nowrap; }
.story-item .si-rating .rat-star { color: #e5a83a; }
.story-item .si-rating .rat-count { color: var(--fg-dim); font-size: 0.72rem; }
.story-item { position: relative; }

/* ── CHAPTER MENU (inside a single story) ── */
#chapterMenu { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 6rem 0 4rem; }
.menu-intro { text-align: center; color: var(--fg-dim); font-size: 1.02rem; max-width: 30rem; margin: 0 auto 3rem; line-height: 1.7; font-style: italic; }
.chapter-list { list-style: none; display: flex; flex-direction: column; gap: 1px; max-width: 540px; margin: 0 auto; width: 100%; }
.chapter-item {
  display: flex; align-items: baseline; gap: 1.25rem;
  padding: 1.25rem 1.5rem; background: var(--bg2);
  border: 1px solid var(--border); cursor: pointer;
  transition: all .25s ease; text-align: left; width: 100%;
  font-family: inherit; color: var(--fg);
}
.chapter-item:hover { background: color-mix(in srgb, var(--bg2) 80%, var(--accent) 20%); border-color: var(--accent); transform: translateX(6px); }
.chapter-num { font-family: 'Cinzel', serif; font-size: 1.4rem; color: var(--accent-glow); font-weight: 600; min-width: 2ch; }
.chapter-name { font-size: 1.25rem; letter-spacing: 0.01em; }

/* ── READER (chapter text) ── */
#reader { display: none; min-height: 100vh; padding: 5rem 0 6rem; }
.ch-header { text-align: center; margin-bottom: 3rem; }
.ch-eyebrow { font-family: 'Cinzel', serif; font-size: 0.85rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent-glow); margin-bottom: 0.75rem; }
.ch-title { font-family: 'Cinzel', serif; font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: 0.03em; }
.ch-divider { width: 60px; height: 2px; background: var(--accent); margin: 1.5rem auto 0; box-shadow: 0 0 12px var(--accent-glow); }
.ch-body p { margin-bottom: 1.5rem; text-align: justify; text-shadow: var(--text-shadow-mobile); }
.ch-body p.has-dropcap::first-letter {
  font-family: 'Cinzel', serif; font-size: 3.4rem; float: left;
  line-height: 0.8; padding: 0.2rem 0.6rem 0 0; color: var(--accent-glow);
}
.ch-body em { color: color-mix(in srgb, var(--fg) 70%, var(--accent) 30%); }
.ch-body strong.meter {
  display: block; font-family: 'Cinzel', serif; font-size: 0.8rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-glow);
  margin: 2.5rem 0 0.5rem; text-align: center; font-weight: 600; text-shadow: none;
}
.ch-body strong.splat {
  display: block; font-family: 'Cinzel', serif; font-size: clamp(2.5rem,8vw,4rem);
  color: var(--accent-glow); text-align: center; letter-spacing: 0.1em;
  margin-top: 1rem; text-shadow: 0 0 25px rgba(179,32,32,0.5);
}

/* ── VOTO A STELLE ── */
.vote-box {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 2rem 1.5rem; text-align: center; background: var(--bg2);
  margin-top: 3.5rem;
}
.vote-eyebrow { font-family: 'Cinzel', serif; font-size: 0.8rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--accent-glow); margin-bottom: 0.4rem; }
.vote-heading { font-family: 'Cinzel', serif; font-size: 1.5rem; margin-bottom: 1.25rem; }
.vote-stars { display: flex; justify-content: center; gap: 0.35rem; margin-bottom: 1rem; }
.vote-star { font-size: 2.2rem; cursor: pointer; color: #3a3a3a; transition: color .15s, transform .15s; line-height: 1; }
.vote-star:hover { transform: scale(1.15); }
.vote-star.on { color: #e5a83a; }
.vote-msg { font-size: 0.95rem; color: var(--fg-dim); font-style: italic; min-height: 1.5rem; }

/* ── NAV ── */
.ch-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.nav-btn { font-family: 'Cinzel', serif; font-size: 0.85rem; letter-spacing: 0.08em; padding: 0.7rem 1.4rem; background: var(--bg2); border: 1px solid var(--border); color: var(--fg); cursor: pointer; transition: all .2s; text-transform: uppercase; }
.nav-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-glow); }
.nav-btn:disabled { opacity: 0.25; cursor: default; }
.nav-btn.center { border: none; background: none; color: var(--fg-dim); }
.nav-btn.center:hover { color: var(--fg); }

/* ── MOBILE: add subtle text border for readability ── */
@media (max-width: 600px) {
  :root { --text-shadow-mobile: 0 1px 2px rgba(0,0,0,0.55); }
  :root[data-theme="light"] { --text-shadow-mobile: 0 1px 1px rgba(255,255,255,0.6); }
  body { line-height: 1.8; }
  .wrap { padding: 0 1.5rem; }
  #reader.wrap { padding-left: 1.75rem; padding-right: 1.75rem; }
  .ch-body p { text-align: left; hyphens: auto; -webkit-hyphens: auto; }
  .chapter-item, .story-item { padding: 1.1rem 1.2rem; }
  .ch-nav { flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; }
}
