:root {
  --pink:    #e8a4b0;
  --pink-lt: #f7e8ec;
  --pink-dk: #c47a8a;
  --white:   #ffffff;
  --ink:     #111111;
  --muted:   #9a8085;
  --rule:    #f0d8dd;
  --nav-h:   54px;
}

/* ACCESSIBLE HIGH-CONTRAST THEME */
body.accessible-theme {
  --pink:    #222222;
  --pink-lt: #f5f5f5;
  --pink-dk: #111111;
  --white:   #ffffff;
  --ink:     #111111;
  --muted:   #666666;
  --rule:    #cccccc;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--white);
  color: var(--ink);
  font-family: 'Jost', sans-serif;
  font-size: 19px;
  line-height: 1.85;
  transition: background 0.35s, color 0.35s;
}

/* NAV */
nav { position: sticky; top: 0; z-index: 100; background: var(--white); height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; border-bottom: 1px solid var(--rule); transition: border-color 0.35s; }
.nav-wordmark { font-family: 'Cormorant Garamond', serif; font-size: 1rem; font-style: italic; color: var(--pink-dk); letter-spacing: 0.04em; transition: color 0.35s; }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--pink-dk); transition: transform 0.25s, opacity 0.25s, width 0.25s, background 0.35s; transform-origin: center; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#nav-links { list-style: none; display: flex; gap: 4px; }
#nav-links li a { display: block; color: var(--muted); text-decoration: none; font-size: 1rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 14px; border-radius: 2px; transition: color 0.2s, background 0.2s; white-space: nowrap; }
#nav-links li a:hover { color: var(--pink-dk); background: var(--pink-lt); }

@media (max-width: 900px) {
  nav { padding: 0 24px; }
  .hamburger { display: flex; }
  #nav-links { display: none; flex-direction: column; gap: 0; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--white); border-bottom: 2px solid var(--pink); padding: 8px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
  #nav-links.show { display: flex; }
  #nav-links li a { padding: 14px 32px; border-radius: 0; font-size: 0.85rem; }
}

/* HERO */
.hero { background: var(--pink-lt); padding: 52px 64px 44px; border-bottom: 2px solid var(--pink); transition: background 0.35s, border-color 0.35s; }
.hero-back { margin-bottom: 18px; }
.hero-back a { font-size: 0.90rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pink-dk); text-decoration: none; transition: color 0.2s; }
.hero-back a:hover { color: var(--ink); }
.hero-label { font-size: 1rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--pink-dk); margin-bottom: 6px; transition: color 0.35s; }
.hero-name { font-family: 'Shippori Mincho', 'Cormorant Garamond', serif; font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 600; line-height: 1.5; letter-spacing: 0.06em; color: var(--ink); margin-bottom: 4px; }
.hero-name rt { font-size: 0.32em; color: var(--pink-dk); letter-spacing: 0.1em; transition: color 0.35s; }
.hero-tagline { font-size: 1.3rem; font-weight: 400; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 14px; font-style: italic; transition: color 0.35s; }
.hero-intro { font-size: 1.1rem; line-height: 1.85; color: var(--ink); max-width: 680px; transition: color 0.35s; }
@media (max-width: 900px) { .hero { padding: 44px 28px 38px; } }
@media (max-width: 480px) { .hero { padding: 36px 20px 32px; } }

/* MAIN */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 48px 120px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
@media (max-width: 900px) { main { padding: 48px 28px 100px; } }
@media (max-width: 480px) { main { padding: 32px 18px 80px; } }

/* READING OPTIONS BOX */
.story-controls {
  background: var(--pink-lt);
  border-top: 2px solid var(--pink);
  padding: 22px 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: background 0.35s, border-color 0.35s;
}

/* STORY PICKER (tabs) */
.story-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 560px) { .story-tabs { grid-template-columns: 1fr; } }

.story-tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--pink);
  border-radius: 2px;
  padding: 12px 18px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s, border-color 0.35s, color 0.2s;
}
.story-tab:hover { border-color: var(--pink-dk); }
.story-tab[aria-selected="true"] { background: var(--pink-dk); border-color: var(--pink-dk); color: var(--white); }

.tab-ja { font-family: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif; font-size: 1.2rem; font-weight: 600; letter-spacing: 0.05em; line-height: 1.4; }
.tab-en { font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; font-style: italic; line-height: 1.3; color: var(--muted); transition: color 0.2s; }
.story-tab[aria-selected="true"] .tab-en { color: var(--pink-lt); }

/* SWITCHES */
.story-switches {
  display: flex; flex-wrap: wrap; gap: 12px 40px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  transition: border-color 0.35s;
}

.story-switch {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; cursor: pointer;
  font-family: 'Jost', sans-serif;
  font-size: 0.90rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--pink-dk);
  transition: color 0.35s;
}

.switch-track {
  position: relative; flex-shrink: 0;
  width: 42px; height: 22px; border-radius: 11px;
  background: var(--white); border: 1px solid var(--pink);
  transition: background 0.25s, border-color 0.35s;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--pink);
  transition: transform 0.25s, background 0.25s;
}
.story-switch[aria-checked="true"] .switch-track { background: var(--pink-dk); border-color: var(--pink-dk); }
.story-switch[aria-checked="true"] .switch-thumb { transform: translateX(20px); background: var(--white); }

.story-tab:focus-visible,
.story-switch:focus-visible,
.theme-toggle:focus-visible { outline: 2px solid var(--pink-dk); outline-offset: 4px; }

/* STORY HEADING */
.story-head { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); transition: border-color 0.35s; }
.story-tag { font-size: 0.9rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pink-dk); transition: color 0.35s; }
.story-title { font-family: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif; font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 600; line-height: 1.6; letter-spacing: 0.05em; color: var(--ink); }
.story-title rt { font-size: 0.36em; color: var(--pink-dk); letter-spacing: 0.08em; transition: color 0.35s; }
.story-subtitle { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; font-style: italic; color: var(--muted); line-height: 1.3; transition: color 0.35s; }

/* STORY BODY */
.story[hidden] { display: none; }
.story-body { display: flex; flex-direction: column; gap: 28px; }

.line .ja {
  display: block;
  font-family: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  font-size: 1.3rem;
  line-height: 2.4;          /* room for furigana */
  color: var(--ink);
  transition: color 0.35s;
}

.line rt {
  font-size: 0.5em;
  color: var(--pink-dk);
  letter-spacing: 0.05em;
  transition: color 0.35s;
}

.line .en {
  display: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.8;
  color: var(--muted);
  border-left: 3px solid var(--pink);
  padding-left: 18px;
  margin-top: 6px;
  transition: color 0.35s, border-color 0.35s;
}

/* STORY IMAGES */
.story-figure {
  margin: 8px auto 12px;
  width: 100%;
  max-width: 560px;
}
.story-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 3px solid var(--pink);
  box-shadow: 6px 6px 0px var(--pink);
  transition: border-color 0.35s, box-shadow 0.35s;
}
/* Placeholder if an image file is missing */
.story-figure.no-img {
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  background: var(--pink-lt);
  border: 3px solid var(--pink);
  border-radius: 4px;
}
.story-figure.no-img img { display: none; }
.story-figure.no-img::after { content: '✦'; font-size: 2rem; color: var(--pink); }
@media (max-width: 480px) {
  .story-figure img { box-shadow: 4px 4px 0px var(--pink); }
}

/* Switch states */
body.show-english .line .en { display: block; }
body:not(.show-furigana) .line rt { visibility: hidden; }

@media (max-width: 480px) {
  .line .ja { font-size: 1.15rem; }
  .story-controls { padding: 18px 20px; }
}

/* THEME TOGGLE */
.theme-toggle {
  position: fixed; bottom: 26px; left: 26px;
  background: var(--white); color: var(--pink-dk);
  border: 1px solid var(--pink); cursor: pointer;
  font-family: 'Jost', sans-serif;
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 12px 18px; border-radius: 2px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
  transition: background 0.2s, color 0.35s, border-color 0.35s;
  z-index: 50; display: flex; align-items: center; gap: 8px;
}
.theme-toggle:hover { background: var(--pink-lt); }
.toggle-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--pink);
  transition: background 0.35s;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .switch-track, .switch-thumb { transition: none; }
}

/* Print: show both stories with translations */
@media print {
  nav, .theme-toggle, .story-controls { display: none !important; }
  .hero { background: #fff; border-bottom: 1px solid #ccc; }
  .story[hidden] { display: block; }
  .story + .story { margin-top: 48px; }
  .line .en { display: block; }
  .story-figure { break-inside: avoid; max-width: 380px; }
  .story-figure img { box-shadow: none; }
}