:root {
  --bg: #0a0a0a;
  --bg-raised: #131313;
  --bg-sunken: #050505;
  --ink: #e8e3d8;
  --ink-dim: #97928a;
  --ink-faint: #5a564f;
  --gold: #c4a87a;
  --gold-bright: #e0c594;
  --rule: #1f1d18;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 28px 96px;
}

/* ---------- Masthead ---------- */
.masthead {
  text-align: center;
  padding: 12px 0 32px;
  margin-bottom: 24px;
}
.masthead h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-style: normal;
  font-size: clamp(52px, 7.5vw, 92px);
  letter-spacing: 0.005em;
  margin: 0 0 14px;
  color: var(--ink);
}
.masthead .tagline {
  margin: 0 0 18px;
  font-size: clamp(17px, 1.7vw, 21px);
  font-style: italic;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.masthead .intro {
  margin: 0 auto;
  max-width: 760px;
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--ink-dim);
  line-height: 1.6;
}

/* ---------- Painting nav ---------- */
.painting-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}
.nav-btn {
  background: transparent;
  border: 1px solid rgba(196, 168, 122, 0.4);
  color: var(--ink);
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 15px;
  padding: 9px 18px;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
  letter-spacing: 0.01em;
}
.nav-btn:hover {
  border-color: rgba(196, 168, 122, 0.75);
  color: var(--gold-bright);
}
.nav-btn.active {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px var(--gold-bright);
}
.nav-btn:focus-visible {
  outline: 1px solid var(--gold-bright);
  outline-offset: 3px;
}

/* ---------- Comparison stage ---------- */
.comparison {
  margin: 12px 0 56px;
}
.stage {
  position: relative;
  margin: 0 auto;
  background: var(--bg-sunken);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: ew-resize;
  outline: none;
  border: 1px solid var(--rule);
  /* Width and height are set inline by JS once the image's natural
     dimensions are known, so the box matches the painting exactly while
     never exceeding the viewport. */
  aspect-ratio: 4 / 3;            /* fallback before JS runs */
  width: 100%;
  max-height: 85vh;
}
.stage:focus-visible { box-shadow: 0 0 0 1px var(--gold); }

.stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  background: var(--bg-sunken);
  display: block;
}
.img-today { z-index: 1; }
.img-restored {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--gold);
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(196, 168, 122, 0.5);
}
.divider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(2px);
  transform: translate(-50%, -50%);
}
.divider-handle::before,
.divider-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: translateY(-50%);
}
.divider-handle::before {
  left: 9px;
  border-right: 7px solid var(--gold);
}
.divider-handle::after {
  right: 9px;
  border-left: 7px solid var(--gold);
}

.label {
  position: absolute;
  top: 12px;
  z-index: 4;
  pointer-events: none;
  padding: 5px 9px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-style: normal;
  white-space: nowrap;
  color: rgba(232, 227, 216, 0.85);
  background: rgba(10, 10, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: color 200ms ease, background 200ms ease,
              border-color 200ms ease;
}
.label-original { left: 12px; }
.label-today    { right: 12px; }
.label.active {
  color: var(--gold-bright);
  background: rgba(10, 10, 10, 0.78);
  border-color: rgba(196, 168, 122, 0.55);
}
.hint {
  text-align: center;
  margin: 14px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ---------- Info panel ---------- */
.info-panel {
  max-width: 760px;
  margin: 24px auto 64px;
  padding: 8px 0 0;
}
.info-quote-block {
  margin: 0 0 28px;
  padding: 8px 0 8px 18px;
  border-left: 2px solid var(--gold);
}
.info-quote {
  font-style: italic;
  font-size: clamp(19px, 2.1vw, 23px);
  line-height: 1.4;
  margin: 0 0 8px;
  color: var(--ink);
}
.info-quote::before { content: ""; }
.info-quote::after  { content: ""; }
.info-source {
  display: block;
  font-style: normal;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.01em;
}

.info-title {
  font-family: Georgia, serif;
  font-style: normal;
  font-weight: 700;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.1;
  margin: 0 0 6px;
  color: var(--ink);
}
.info-artist {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}
.info-location {
  margin: 0 0 22px;
  color: var(--ink-dim);
  font-size: 14px;
}

.info-badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 24px;
}

.info-summary {
  margin: 0 0 28px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
}

.info-science-wrap {
  margin: 0;
}
.info-science-wrap > summary {
  cursor: pointer;
  font-size: 15px;
  color: var(--gold-bright);
  list-style: none;
  display: inline-block;
  border-bottom: 1px solid var(--gold-bright);
  padding-bottom: 1px;
}
.info-science-wrap > summary::-webkit-details-marker { display: none; }
.info-science-wrap > summary .toggle-open { display: none; }
.info-science-wrap[open] > summary .toggle-closed { display: none; }
.info-science-wrap[open] > summary .toggle-open { display: inline; }

.info-science-box {
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid var(--rule);
}
.info-science {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.65;
}

/* ---------- How it works ---------- */
.how {
  margin: 0 0 80px;
}
.how h2 {
  font-style: italic;
  font-weight: 400;
  font-size: 28px;
  margin: 0 0 36px;
  text-align: center;
  color: var(--ink);
}
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.steps li {
  border-top: 1px solid var(--gold);
  padding-top: 18px;
}
.step-num {
  display: block;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-bottom: 12px;
}
.steps h3 {
  font-style: italic;
  font-weight: 400;
  font-size: 19px;
  margin: 0 0 10px;
  color: var(--ink);
}
.steps p {
  margin: 0;
  font-size: 15px;
  color: var(--ink-dim);
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.footnotes {
  border-top: 1px solid var(--rule);
  padding-top: 36px;
  font-size: 13px;
  color: var(--ink-dim);
}
.footnotes h2 {
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 16px;
}
.footnotes ul {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.footnotes li {
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.5;
}
.footnotes em { color: var(--ink); font-style: italic; }
.disclaimer {
  margin: 0;
  font-size: 12px;
  font-style: italic;
  color: var(--ink-faint);
  line-height: 1.6;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .container { padding: 32px 18px 64px; }
  .steps { grid-template-columns: 1fr; gap: 24px; }
  .nav-btn { padding: 8px 14px; font-size: 14px; }
  .info-quote { font-size: 19px; }
  .label { font-size: 10px; top: 12px; letter-spacing: 0.18em; }
  .label-original { left: 10px; }
  .label-today    { right: 10px; }
}
