/* Mona-Verse: shared styles. Desktop layout only for now. */

:root {
  /* Surfaces */
  --bg: #06070B;
  --surface: #0D0F15;
  --option-bg: #0F1118;
  --option-selected-bg: #17140A;
  --placeholder-bg: #15171F;
  --still-bg: #12141B;
  --progress-track: #232733;

  /* Lines */
  --rule: #1E212A;
  --rule-2: #2A2D36;
  --card-border: #262A35;
  --option-border: #2E3340;
  --ghost-border: #3A3F4C;
  --badge-border: #4A5060;

  /* Text */
  --text: #F3EFE4;
  --text-2: #C9C4B8;
  --text-3: #B5B0A5;
  --muted: #A9A59B;
  --muted-2: #8F8B82;
  --score-dim: #6E6A62;
  --on-accent: #0A0A0A;

  /* Accents */
  --accent: #FCCA05;
  --accent-hover: #FFD83D;
  --link-hover: #FFE27A;
  --miss: #FF8A5B;

  /* Museum cream (placeholder text) */
  --placard: #EFE6CF;

  /* Painting window before the beam-in reveals it */
  --window-bg: #0B0D12;

  /* Type */
  --font-body: 'Barlow', system-ui, sans-serif;
  --font-display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
}

/* ---------- Base ---------- */

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

[hidden] { display: none !important; }

html {
  min-width: 1100px; /* desktop only: narrow windows scroll instead of reflowing */
  scroll-behavior: smooth;
}
html:has(dialog[open]) { overflow: hidden; } /* no page scrolling behind a dialog */

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: url(../assets/brand/stars.png);
  background-size: 1200px 1200px;
  color: var(--text);
  font-family: var(--font-body);
}

main { flex-grow: 1; }

h1, h2, h3, p { margin: 0; }

img { display: block; }

button { font: inherit; }

a { color: var(--accent); }
a:hover { color: var(--link-hover); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.container {
  width: 100%; /* needed when a container is itself a flex item, e.g. <main> in body */
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------- Type ---------- */

.kicker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker--sm { font-size: 15px; }

.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  text-transform: uppercase;
}
.display--xl { font-size: 56px; letter-spacing: 0.01em; }
.display--lg { font-size: 48px; letter-spacing: 0.02em; }
.display--md { font-size: 40px; }
.display--sm { font-size: 36px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.btn-cta {
  min-height: 56px;
  padding: 0 28px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-style: italic;
  font-size: 22px;
}
.btn-cta:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-cta--lg { min-height: 60px; padding: 0 36px; font-size: 24px; }
.btn-cta--sm { min-height: 52px; padding: 0 24px; font-size: 20px; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--ghost-border);
  color: var(--text);
  font-weight: 700;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost--sm { gap: 8px; min-height: 44px; padding: 0 18px; font-size: 16px; letter-spacing: 0.08em; }
.btn-ghost--md { min-height: 52px; padding: 0 22px; font-size: 20px; }
.btn-ghost--lg { min-height: 56px; padding: 0 24px; font-size: 20px; }

/* ---------- Header & footer ---------- */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding-top: 24px;
  padding-bottom: 24px;
}
.site-header__inner--end {
  justify-content: flex-end;
  padding-top: 28px;
  padding-bottom: 28px;
}

.logo-link {
  display: block;
  line-height: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.logo-link img { height: 22px; width: auto; }

.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--rule);
}
.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding-top: 28px;
  padding-bottom: 28px;
}
.site-footer__inner img { height: 16px; width: auto; }
.site-footer__inner p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-2);
}

/* ---------- Framed portrait ---------- */

.framed {
  position: relative;
  aspect-ratio: 1156 / 1456;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.framed--thumb {
  flex: 0 0 260px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* The painting sits in the frame's window; frame.webp is laid on top. */
.framed__art {
  position: absolute;
  left: 10.81%;
  top: 8.59%;
  width: 78.37%;
  height: 82.83%;
  object-fit: cover;
}
.framed__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.portrait-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--placeholder-bg);
  text-align: center;
}
.portrait-placeholder__text {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  color: var(--placard);
}
.portrait-placeholder--sm { padding: 12px; }
.portrait-placeholder--sm .portrait-placeholder__text { font-size: 20px; }

/* Invisible button over a framed painting that opens the zoomed view. */
.framed__zoom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: zoom-in;
}
.framed__zoom:focus-visible { outline-offset: 4px; }

/* ---------- Quiz: painting beams in ----------
   The frame's window holds the painting plus effect layers. Their resting
   styles are the final, fully revealed state; adding .is-beaming to .framed
   plays the sequence (about 3s): grid flashes, a glowing line scans down
   revealing the painting through a yellow tint and scanlines, a flicker,
   then full color. */

.framed__window {
  overflow: hidden;
  background: var(--window-bg);
}
.beam-grid,
.beam-reveal,
.beam-reveal > * {
  position: absolute;
  inset: 0;
}
.beam-reveal > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.beam-grid {
  background-image:
    linear-gradient(rgba(252, 202, 5, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(252, 202, 5, 0.2) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0;
}
.beam-tint {
  background: var(--accent);
  mix-blend-mode: color;
  opacity: 0;
}
.beam-lines {
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 4px);
  opacity: 0;
}
.beam-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 16px 4px rgba(252, 202, 5, 0.7), 0 0 60px 12px rgba(252, 202, 5, 0.25);
  opacity: 0;
}

.framed.is-loading { opacity: 0; } /* hidden while the next painting loads */
.framed.is-beaming { animation: mv-fade-in 0.5s ease both; }
.framed.is-beaming .beam-grid { animation: mv-grid 2.8s ease 0.2s both; }
.framed.is-beaming .beam-reveal { animation: mv-reveal 1.6s linear 0.6s both, mv-flicker 0.5s steps(1) 2.25s; }
.framed.is-beaming .beam-tint { animation: mv-tint-out 0.7s ease 2.3s both; }
.framed.is-beaming .beam-lines { animation: mv-lines-out 0.7s ease 2.5s both; }
.framed.is-beaming .beam-line { animation: mv-beam 1.6s linear 0.6s forwards; }

@keyframes mv-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes mv-grid {
  0% { opacity: 0; }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes mv-reveal {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0); }
}
@keyframes mv-flicker {
  0% { opacity: 1; }
  20% { opacity: 0.5; }
  40% { opacity: 1; }
  60% { opacity: 0.75; }
  80% { opacity: 1; }
}
@keyframes mv-tint-out {
  from { opacity: 0.6; }
  to { opacity: 0; }
}
@keyframes mv-lines-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes mv-beam {
  0% { top: 0; opacity: 1; }
  94% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ---------- Landing ---------- */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 48px;
  padding-top: 24px;
}
.hero__copy {
  flex: 1 1 460px;
  min-width: 0;
  max-width: 560px;
  align-self: center;
  padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
}
.hero__title { width: 100%; line-height: 0; }
.hero__title img { width: 100%; height: auto; }
.hero__lede {
  max-width: 500px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--text-2);
}
.hero__art {
  flex: 1 1 440px;
  min-width: 0;
  max-width: 580px;
}
.hero__art img { width: 100%; height: auto; }

.how {
  border-top: 1px solid var(--rule-2);
  background: var(--bg);
}
.how__inner {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding-top: 88px;
  padding-bottom: 88px;
}

.steps {
  display: flex;
  gap: 32px;
}
.step {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--surface);
}
.step__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 40px;
  line-height: 1;
  color: var(--accent);
}
.step__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.step__text {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-3);
}

/* Choices in the "How many portraits?" dialog. The dialog itself
   (.dialog--start) sits with the other dialog styles under Quiz. */
.round-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.round-choice {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 88px;
  padding: 14px 22px;
  border-radius: 6px;
  text-decoration: none;
}
.round-choice--quick { background: var(--accent); color: var(--on-accent); }
.round-choice--quick:hover { background: var(--accent-hover); color: var(--on-accent); }
.round-choice--full { border: 1px solid var(--badge-border); color: var(--text); }
.round-choice--full:hover { border-color: var(--accent); color: var(--accent); }
.round-choice__count {
  flex: none;
  width: 64px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 54px;
  line-height: 1;
}
.round-choice__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.round-choice__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.round-choice__detail { font-size: 15px; font-weight: 500; }
.round-choice--full .round-choice__detail { color: var(--muted); }

/* ---------- Quiz ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 14px;
}
.progress__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.progress__track {
  width: 200px;
  height: 6px;
  border-radius: 3px;
  background: var(--progress-track);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.quiz-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 72px;
  padding-top: 24px;
  padding-bottom: 72px;
}
.quiz-figure {
  margin: 0;
  flex: 1 1 380px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.quiz-panel {
  flex: 999 1 440px;
  min-width: 0;
  max-width: 620px;
}

.question {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.question__head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--option-border);
  border-radius: 6px;
  background: var(--option-bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 20px;
  transition: opacity 0.2s ease, transform 0.25s ease, border-color 0.2s ease;
}
.option:not(:disabled):hover { border-color: var(--accent); }
.option:disabled { cursor: default; }
/* Not typed in yet: invisible, nudged down, and not clickable (disabled). */
.option.is-hidden {
  opacity: 0;
  transform: translateY(6px);
}
.option.is-selected {
  background: var(--option-selected-bg);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.option__badge {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--badge-border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.option.is-selected .option__badge {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.option__label {
  flex-grow: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 19px;
  white-space: nowrap;
}
.option__caret {
  display: inline-block;
  width: 10px;
  height: 21px;
  background: var(--accent);
  animation: mv-blink 0.6s steps(1) infinite;
}
@keyframes mv-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* Shown alone (the painting is hidden) once the last answer is in. */
.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 96px 0;
  text-align: center;
}
.done__heading:focus { outline: none; }
.done__text {
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-2);
}

.dialog {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  margin: auto; /* centred in the window, both ways */
  padding: 32px;
  border: 1px solid var(--option-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dialog::backdrop { background: rgba(6, 7, 11, 0.82); }
.dialog__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 48px; /* clear of the close button */
}
.dialog__title { font-size: 42px; }
.dialog__clear { padding-right: 52px; } /* a heading clear of the close button */
.dialog__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--ghost-border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.dialog__close:hover { border-color: var(--accent); color: var(--accent); }

/* Landing's "How many portraits?" dialog: a little larger. */
.dialog--start {
  max-width: 520px;
  padding: 36px;
  border-radius: 10px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65);
}
.dialog--start[open] { gap: 22px; }
.dialog--start:focus { outline: none; } /* the dialog itself takes focus on open */
.dialog__text {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-2);
}
.dialog__actions {
  margin-top: 10px;
  display: flex;
  gap: 12px;
}

/* ---------- Results ---------- */

.score-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 40px;
  padding-bottom: 72px;
}
.score-section__kicker { letter-spacing: 0.16em; }
.score {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  line-height: 0.9;
}
.score__value { font-size: 168px; color: var(--accent); }
.score__total { font-size: 88px; color: var(--score-dim); }
.score-message {
  margin-top: 20px;
  max-width: 520px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-2);
}
.score-actions {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.answers {
  border-top: 1px solid var(--rule);
  background: rgba(6, 7, 11, 0.85);
}
.answers__inner {
  display: flex;
  flex-direction: column;
  padding-top: 64px;
  padding-bottom: 88px;
}
.answers__heading { margin-bottom: 16px; }

.answer {
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}
.answer__info {
  flex: 1 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.answer__source {
  font-size: 16px;
  line-height: 1.4;
  color: var(--muted);
}

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.verdict--hit { color: var(--accent); }
.verdict--miss { color: var(--miss); }
.verdict--hit .verdict__icon--miss,
.verdict--miss .verdict__icon--hit { display: none; }

.stills {
  align-self: stretch;
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.still {
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
}
.still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.still--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px dashed var(--ghost-border);
  background: var(--still-bg);
  font-size: 14px;
  color: var(--muted-2);
}

/* ---------- Zoomed painting (Quiz + Results) ---------- */

.zoom {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 76px 24px 56px;
  border: none;
  background: rgba(6, 7, 11, 0.94);
  color: var(--text);
}
.zoom[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.zoom::backdrop { background: transparent; }
.zoom:focus { outline: none; } /* the view itself takes focus on open */

.zoom__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--ghost-border);
  border-radius: 50%;
  background: rgba(6, 7, 11, 0.7);
  color: var(--text);
  cursor: pointer;
}
.zoom__close:hover { border-color: var(--accent); color: var(--accent); }

.zoom__frame {
  max-width: 100%;
  overflow: hidden;
  line-height: 0;
  border-radius: 2px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
/* Sized by the viewport, not the file, so swapping the thumbnail for the
   full-size image never changes its size. Paintings are 3:4. */
.zoom__img {
  height: min(calc(100vh - 170px), calc(min(900px, 100vw - 48px) * 4 / 3));
  width: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}
.zoom__img.is-zoomed {
  transform: scale(2.4);
  cursor: zoom-out;
  touch-action: none;
}

/* ---------- Reduced motion: no beam-in, typing, blinking or zoom easing ---------- */

@media (prefers-reduced-motion: reduce) {
  .framed.is-beaming,
  .framed.is-beaming * { animation: none !important; }
  .option,
  .progress__fill,
  .zoom__img { transition: none; }
  .option__caret { animation: none; }
}
