/* Zuzoomba Stories - shared theme for all story pages */

:root {
  --ink: #3b2b20;
  --ink-soft: #6b5545;
  --paper: #fdf6e8;
  --paper-2: #f7e9cf;
  --accent: #e2703a;
  --accent-2: #4a8fa8;
  --shadow: rgba(90, 60, 35, .18);

  /* diagram tokens */
  --good: #4a8fa8;
  --drop: #a3907f;
  --line: rgba(107, 85, 69, .38);
  --card: #fffaf0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 20% -10%, #fff9ec 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 10%, #fdeedd 0%, transparent 55%),
    var(--paper);
  line-height: 1.65;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

/* ---------- Story tabs (site nav) ---------- */
.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tabs a {
  display: block;
  text-align: center;
  padding: .5rem 1.25rem .55rem;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid rgba(107, 85, 69, .16);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.3;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.tabs a:hover,
.tabs a:focus-visible {
  background: var(--paper-2);
  color: var(--ink);
  border-color: rgba(107, 85, 69, .35);
}

.tabs a[aria-current="page"],
.tabs a.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(226, 112, 58, .28);
}

.tabs .tab-note {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  opacity: .8;
  margin-top: .1rem;
}

/* ---------- Cover ---------- */
header.cover {
  text-align: center;
  padding: 2rem 1rem 3.5rem;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 1rem;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 1.05;
  margin: 0 0 .6rem;
  color: var(--ink);
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.subtitle {
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 0 auto;
}

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  padding: 0;
  margin: 1.4rem 0 0;
}

.badges li {
  background: var(--paper-2);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: .32rem .9rem;
  font-size: .84rem;
  font-weight: 600;
}

.about {
  max-width: 62ch;
  margin: clamp(2.5rem, 5vw, 3.5rem) auto 0;
  padding-top: 2rem;
  border-top: 1px dashed rgba(107, 85, 69, .3);
}

.about h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  margin: 0 0 .6rem;
}

.about p {
  color: var(--ink-soft);
  font-size: .98rem;
  margin: 0 0 .8rem;
}

.squiggle {
  display: block;
  width: 160px;
  height: 14px;
  margin: 1.8rem auto 0;
  background:
    radial-gradient(circle at 8px 12px, var(--accent-2) 3px, transparent 4px) repeat-x 0 0 / 24px 14px;
  opacity: .7;
}

/* ---------- Featured clip ---------- */
.clip {
  margin: 0 auto clamp(3rem, 6vw, 5rem);
  max-width: 780px;
  text-align: center;
}

.clip-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #2b1d14;
  box-shadow: 0 16px 40px var(--shadow);
  line-height: 0;
}

.clip-frame video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #2b1d14;
}

.clip h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  margin: 0 0 .4rem;
}

.clip .lead {
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 auto 1.4rem;
}

.clip figcaption {
  margin-top: .9rem;
  font-size: .92rem;
  color: var(--ink-soft);
  font-style: italic;
}

.clip .fallback {
  color: var(--accent);
}

/* ---------- Panels ---------- */
.panel {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  margin: 0 0 clamp(3rem, 6vw, 5rem);
}

.panel:nth-of-type(even) .art { order: 2; }

.art {
  position: relative;
  width: 100%;
  aspect-ratio: 1408 / 768;
  border-radius: 18px;
  box-shadow: 0 14px 34px var(--shadow), 0 2px 0 rgba(255,255,255,.9) inset;
  background-repeat: no-repeat;
  background-size: 200% 200%;      /* show one quadrant of a 2x2 sheet */
  background-color: #fff;
  overflow: hidden;
  transform: rotate(-.5deg);
  transition: transform .35s ease, box-shadow .35s ease;
}

.panel:nth-of-type(even) .art { transform: rotate(.6deg); }

.art:hover {
  transform: rotate(0deg) scale(1.015);
  box-shadow: 0 20px 44px var(--shadow);
}

/* Sheet A: Zuzoomba.webp */
.a-tl { background-image: url("images/Zuzoomba.webp");   background-position:   0%   0%; }
.a-tr { background-image: url("images/Zuzoomba.webp");   background-position: 100%   0%; }
.a-bl { background-image: url("images/Zuzoomba.webp");   background-position:   0% 100%; }
.a-br { background-image: url("images/Zuzoomba.webp");   background-position: 100% 100%; }

/* Sheet B: Zuzoomba-1.webp */
.b-tl { background-image: url("images/Zuzoomba-1.webp"); background-position:   0%   0%; }
.b-tr { background-image: url("images/Zuzoomba-1.webp"); background-position: 100%   0%; }
.b-bl { background-image: url("images/Zuzoomba-1.webp"); background-position:   0% 100%; }
.b-br { background-image: url("images/Zuzoomba-1.webp"); background-position: 100% 100%; }

.story .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: .7rem;
}

.story h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3.4vw, 2rem);
  line-height: 1.2;
  margin: 0 0 .55rem;
}

.story p {
  margin: 0 0 .9rem;
  font-size: clamp(1rem, 2vw, 1.08rem);
  color: var(--ink-soft);
}

.story .beat {
  display: inline-block;
  background: var(--paper-2);
  border-left: 4px solid var(--accent-2);
  padding: .5rem .85rem;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--ink);
  font-size: .98rem;
}

/* ---------- Ending ---------- */
.ending {
  text-align: center;
  background: linear-gradient(180deg, #fff9ee, #f9ecd6);
  border-radius: 24px;
  padding: clamp(2rem, 5vw, 3.2rem);
  box-shadow: 0 12px 30px var(--shadow);
  margin-top: 1rem;
}

.ending h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  margin: 0 0 1rem;
}

.ending p {
  max-width: 56ch;
  margin: 0 auto 1rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.2vw, 1.12rem);
}

.the-end {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1.4rem;
  color: var(--accent);
  margin-top: 1.5rem;
}

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: .85rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(107, 85, 69, .16);
  opacity: .8;
}

footer p {
  margin: 0 0 .3rem;
}

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

footer .copyright {
  font-size: .8rem;
}

@media (max-width: 720px) {
  .panel { grid-template-columns: 1fr; }
  .panel:nth-of-type(even) .art { order: 0; }
  .art, .panel:nth-of-type(even) .art { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .art { transition: none; }
  .art:hover { transform: none; }
}

/* ---------- Reflective story layout (The Journey and the Passenger) ---------- */
.intro-card {
  max-width: 62ch;
  margin: clamp(1.6rem, 4vw, 2.4rem) auto clamp(3rem, 6vw, 4.5rem);
  background: var(--paper-2);
  border-left: 4px solid var(--accent);
  border-radius: 0 14px 14px 0;
  padding: clamp(1.2rem, 3vw, 1.8rem) clamp(1.2rem, 3vw, 2rem);
  box-shadow: 0 10px 26px var(--shadow);
}

.intro-card p {
  margin: 0 0 .8rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.08rem);
}

.intro-card p:last-child {
  margin-bottom: 0;
}

.intro-card em {
  color: var(--ink);
}

.lane {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  margin: 0 0 clamp(3rem, 6vw, 5rem);
}

.art-photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 14px 34px var(--shadow);
  transform: rotate(-.5deg);
  transition: transform .35s ease, box-shadow .35s ease;
}

.lane.reverse .art-photo {
  order: 2;
  transform: rotate(.6deg);
}

.art-photo:hover,
.lane.reverse .art-photo:hover {
  transform: rotate(0deg) scale(1.015);
  box-shadow: 0 20px 44px var(--shadow);
}

.story .tag {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .74rem;
  font-weight: 700;
  color: var(--accent-2);
  margin: 0 0 .35rem;
}

@media (max-width: 720px) {
  .lane { grid-template-columns: 1fr; }
  .lane.reverse .art-photo { order: 0; }
  .art-photo, .lane.reverse .art-photo { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .art-photo { transition: none; }
  .art-photo:hover, .lane.reverse .art-photo:hover { transform: none; }
}

/* ---------- Sub-nav: stories within a tab ---------- */
.story-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .2rem 1rem;
  margin: .9rem 0 0;
  font-size: .86rem;
}

.story-strip a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: .15rem 0;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}

.story-strip a:hover,
.story-strip a:focus-visible {
  color: var(--ink);
  border-bottom-color: rgba(107, 85, 69, .3);
}

.story-strip a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

/* ---------- Diagrams ---------- */
.diagram {
  margin: 0 0 clamp(3rem, 6vw, 4.5rem);
  background: var(--card);
  border: 1px solid rgba(107, 85, 69, .16);
  border-radius: 18px;
  padding: clamp(.9rem, 2.5vw, 1.6rem);
  box-shadow: 0 14px 34px var(--shadow);
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

.diagram figcaption {
  margin-top: .85rem;
  text-align: center;
  font-size: .88rem;
  font-style: italic;
  color: var(--ink-soft);
}

.lane .diagram { margin-bottom: 0; }
.lane.reverse .diagram { order: 2; }

/* ---------- Component cards ---------- */
.components {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 clamp(3rem, 6vw, 4.5rem);
}

.components li {
  background: var(--paper-2);
  border-radius: 14px;
  border-top: 3px solid var(--accent-2);
  padding: 1.05rem 1.15rem;
}

.components li.is-negative { border-top-color: var(--drop); }

.components h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.06rem;
  margin: 0 0 .3rem;
}

.components p {
  margin: 0;
  font-size: .94rem;
  color: var(--ink-soft);
}

/* ---------- Pull-quote rule ---------- */
.rule {
  max-width: 48ch;
  margin: 0 auto clamp(3rem, 6vw, 4.5rem);
  text-align: center;
  padding: clamp(1.6rem, 4vw, 2.4rem);
  background: linear-gradient(180deg, #fff9ee, #f9ecd6);
  border-radius: 24px;
  box-shadow: 0 12px 30px var(--shadow);
}

.rule .rule-label {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 .7rem;
}

.rule p {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--ink);
  margin: 0;
}

/* ---------- Code card ---------- */
.code-card {
  margin: 0 0 clamp(3rem, 6vw, 4.5rem);
  border-radius: 18px;
  overflow: hidden;
  background: #2b1d14;
  box-shadow: 0 14px 34px var(--shadow);
}

.code-card .code-head {
  padding: .7rem 1.15rem;
  background: rgba(255, 255, 255, .07);
  color: #f3e3cd;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.code-card pre {
  margin: 0;
  padding: 1.2rem;
  overflow-x: auto;
  font-family: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  font-size: .86rem;
  line-height: 1.75;
  color: #e8d8c0;
}

.code-card .c { color: #9c8571; font-style: italic; }
.code-card .k { color: #86b9cc; }
.code-card .s { color: #eda76b; }

@media (max-width: 720px) {
  .lane.reverse .diagram { order: 0; }
  .code-card pre { font-size: .78rem; }
}

/* ---------- Section headings & inline code ---------- */
.section-head {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  text-align: center;
  margin: 0 0 clamp(1.4rem, 3vw, 2rem);
}

.story code,
.intro-card code,
p code {
  font-family: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  font-size: .9em;
  background: var(--paper-2);
  color: var(--ink);
  padding: .1em .4em;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- Body links (nav has its own styles and is outside <main>) ---------- */
main a,
footer a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(226, 112, 58, .45);
  text-underline-offset: 3px;
  transition: text-decoration-color .2s ease, color .2s ease;
}

main a:hover,
main a:focus-visible,
footer a:hover,
footer a:focus-visible {
  text-decoration-color: var(--accent);
}

main a:visited,
footer a:visited {
  color: var(--accent);
}
