:root {
  --wall: #e9e3d8;
  --wall-deep: #ddd5c6;
  --mat: #f7f3ec;
  --ink: #1f1d1a;
  --ink-soft: #6a6258;
  --line: rgba(31, 29, 26, .14);
  --oxide: #a5482e;
  --oxide-deep: #7f331f;
  --sage: #55634f;
  --frame: #2a2622;
  --display: "Prata", "Times New Roman", serif;
  --body: "Onest", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --card-ratio: 2 / 3;
  --radius: 3px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { overflow-x: hidden; }

body {
  min-height: 100vh;
  background: var(--wall);
  color: var(--ink);
  font: 400 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* gallery wall: soft spotlight from above + plaster grain */
.wall {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 45% at 50% -5%, rgba(255, 250, 238, .95), transparent 70%),
    radial-gradient(120% 70% at 50% 120%, rgba(120, 100, 75, .14), transparent 70%);
}
.wall::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42  0 0 0 0 .38  0 0 0 0 .32  0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
}

/* ---- screens -------------------------------------------------------------- */
.screen { display: none; }
.screen.is-active { display: block; animation: enter .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.title {
  font: 400 clamp(34px, 9vw, 52px)/1.08 var(--display);
  margin: 0 0 20px;
  letter-spacing: -.01em;
}
.title em { font-style: normal; color: var(--oxide); }
.h2 { font: 400 clamp(26px, 6.5vw, 34px)/1.15 var(--display); margin: 0 0 18px; }
.lead { font-size: 17px; color: #3b3630; margin: 0 0 26px; max-width: 34em; }
.lead.small { font-size: 15px; color: var(--ink-soft); }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  font: 500 16px/1 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: var(--mat); width: 100%; }
.btn.primary:hover { background: var(--oxide-deep); border-color: var(--oxide-deep); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: rgba(31, 29, 26, .06); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.back-link {
  appearance: none; border: 0; background: none; padding: 0; margin: 0 0 22px;
  font: 500 14px var(--body); color: var(--ink-soft); cursor: pointer;
}
.back-link:hover { color: var(--ink); }
.stack { display: grid; gap: 14px; }

/* ---- frames: mat + thin dark frame + wall shadow --------------------------- */
.frame {
  position: relative;
  background: var(--mat);
  padding: 9%;
  border: 1px solid rgba(0, 0, 0, .08);
  outline: 5px solid var(--frame);
  outline-offset: -1px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 18px 30px -16px rgba(40, 30, 20, .55), 0 3px 6px rgba(40, 30, 20, .18);
}
.frame img, .frame .back {
  display: block;
  width: 100%;
  aspect-ratio: var(--card-ratio);
  object-fit: cover;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.back {
  background:
    radial-gradient(circle at 50% 50%, var(--oxide) 0 9%, transparent 9.5%),
    radial-gradient(circle at 50% 50%, transparent 0 17%, rgba(247, 243, 236, .55) 17.5% 18.5%, transparent 19%),
    repeating-linear-gradient(45deg, rgba(247, 243, 236, .07) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, rgba(247, 243, 236, .07) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #3c4a3a, #26302a);
}

/* intro: three hung frames */
.hang {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7%;
  margin: 8px 6% 38px;
  align-items: end;
}
.hang .frame { padding: 7%; }
.tilt-l { transform: rotate(-3deg) translateY(10px); animation: sway 7s ease-in-out infinite; }
.tilt-0 { transform: translateY(-6px); }
.tilt-r { transform: rotate(2.5deg) translateY(14px); animation: sway 8s ease-in-out infinite reverse; }
@keyframes sway { 50% { rotate: .8deg; } }

/* first-time guide */
.guide {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.guide summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 0;
  font: 500 15px var(--body);
  display: flex;
  justify-content: space-between;
}
.guide summary::after { content: "+"; font: 400 22px/1 var(--display); color: var(--oxide); }
.guide[open] summary::after { content: "−"; }
.steps { margin: 0; padding: 0 0 6px 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; color: #3b3630; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--oxide); color: var(--oxide);
  display: grid; place-items: center;
  font: 500 12px var(--mono);
}
.note { font-size: 14px; color: var(--ink-soft); margin: 0 0 18px; }
.guide + .guide { border-top: 0; }
.tips { margin: 0 0 14px; padding-left: 18px; color: #3b3630; font-size: 15px; }
.tips li { margin-bottom: 8px; }
.swap { margin: -12px 0 18px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* ---- techniques as gallery rooms ---------------------------------------------- */
.rooms { display: grid; gap: 12px; }
.room {
  appearance: none;
  text-align: left;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: rgba(247, 243, 236, .6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
  animation: enter .5s both;
}
.room:hover { background: var(--mat); border-color: rgba(31, 29, 26, .35); transform: translateX(3px); }
.room-mini { display: flex; gap: 3px; justify-content: center; }
.room-mini i {
  display: block; width: 15px; aspect-ratio: 2 / 3;
  background: linear-gradient(160deg, #3c4a3a, #26302a);
  outline: 2px solid var(--frame); outline-offset: 1px;
}
.room-mini.one i { width: 26px; }
.room-mini.two i { width: 19px; }
.room-no { font: 500 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--oxide); }
.room-title { display: block; font: 400 20px/1.25 var(--display); margin: 4px 0 2px; }
.room-sub { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.4; }

/* ---- request form ------------------------------------------------------------- */
.field { display: grid; gap: 8px; }
textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 29, 26, .25);
  border-radius: var(--radius);
  background: var(--mat);
  color: var(--ink);
  font: 400 17px/1.5 var(--body);
}
textarea:focus { outline: 2px solid var(--oxide); outline-offset: 1px; border-color: transparent; }
.hint { font-size: 13px; color: var(--ink-soft); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: grid; gap: 2px; height: 100%;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(247, 243, 236, .5);
}
.choice small { color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.choice input:checked + span { border-color: var(--ink); background: var(--mat); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input:focus-visible + span { outline: 2px solid var(--oxide); }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--ink); }
.error { color: var(--oxide-deep); font-size: 14px; margin: 0; }

/* ---- picking ------------------------------------------------------------------- */
.pick { display: grid; gap: 14px; margin-top: 8px; }
.pick.open { grid-template-columns: repeat(3, 1fr); gap: 16px 14px; }
.pick.closed { grid-template-columns: repeat(4, 1fr); gap: 14px 10px; }
.pick button {
  appearance: none; border: 0; padding: 0; background: none; cursor: pointer;
  animation: deal .5s cubic-bezier(.2, .7, .2, 1) both;
}
.pick .frame { padding: 7%; outline-width: 3px; transition: transform .25s ease, box-shadow .25s ease; }
.pick button:hover .frame, .pick button:focus-visible .frame { transform: translateY(-5px); }
.pick button:focus-visible { outline: none; }
.pick button:focus-visible .frame { box-shadow: 0 0 0 3px var(--oxide), 0 18px 30px -16px rgba(40, 30, 20, .55); }
.pick.is-chosen button:not(.chosen) { opacity: .15; transform: scale(.96); transition: opacity .4s, transform .4s; }
@keyframes deal { from { opacity: 0; transform: translateY(18px) rotate(-2deg); } to { opacity: 1; transform: none; } }

/* ---- the exhibit: chosen card + museum label --------------------------------- */
.exhibit {
  display: grid;
  grid-template-columns: minmax(0, 46%) 1fr;
  gap: 18px;
  align-items: end;
  margin-bottom: 26px;
}
.exhibit .frame { animation: reveal .9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes reveal { from { opacity: 0; transform: perspective(900px) rotateY(80deg); } to { opacity: 1; transform: none; } }
.label {
  font: 400 12px/1.5 var(--mono);
  color: var(--ink-soft);
  border-left: 2px solid var(--oxide);
  padding: 2px 0 2px 12px;
}
.label b { display: block; font: 400 17px/1.25 var(--display); color: var(--ink); margin-bottom: 6px; }
.label a { color: inherit; }
.thumbs { display: flex; gap: 8px; margin-top: 12px; }
.thumbs .frame { width: 44px; padding: 5%; outline-width: 2px; }

/* ---- dialog ---------------------------------------------------------------------- */
.dialog { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 16px; }
.dialog li { animation: enter .45s both; }
.dialog .guide-line {
  font: 400 20px/1.4 var(--display);
  color: var(--ink);
  padding-right: 8%;
}
.dialog .guide-line .mirror { display: block; font: 400 15px/1.5 var(--body); font-style: italic; color: var(--ink-soft); margin-bottom: 4px; }
.dialog .me-line {
  justify-self: end;
  max-width: 88%;
  background: var(--mat);
  border: 1px solid var(--line);
  border-radius: 14px 14px 3px 14px;
  padding: 10px 14px;
  font-size: 16px;
  color: #3b3630;
  white-space: pre-wrap;
}
.dialog .divider {
  font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--oxide); text-align: center; padding: 6px 0;
  display: flex; align-items: center; gap: 12px;
}
.dialog .divider::before, .dialog .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.thinking { display: inline-flex; gap: 6px; padding: 8px 0; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; }
.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 40% { opacity: 1; } }

.reply { position: sticky; bottom: 0; padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--wall) 22%); }
.reply textarea { min-height: 84px; }
.reply-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.reply-actions .primary { grid-column: 1 / -1; }
.reply-actions .ghost { min-height: 44px; font-size: 14px; padding: 0 12px; }

/* ---- summary -------------------------------------------------------------------- */
.gallery-row { display: flex; gap: 16px; justify-content: center; margin: 6px 0 30px; flex-wrap: wrap; }
.gallery-row figure { margin: 0; width: min(150px, 40vw); }
.gallery-row figcaption { font: 400 11px/1.4 var(--mono); color: var(--ink-soft); margin-top: 12px; text-align: center; letter-spacing: .04em; }
.summary { margin: 0 0 30px; display: grid; gap: 18px; }
.summary dt { font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--oxide); margin-bottom: 6px; }
.summary dd { margin: 0; font-size: 17px; color: #2f2b26; }
.summary .step dd { font: 400 20px/1.4 var(--display); }

.rate { text-align: center; padding: 22px 0 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.rate-q { font: 400 21px/1.3 var(--display); margin: 0 0 14px; }
.stars { display: flex; gap: 8px; justify-content: center; }
.stars button {
  appearance: none; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(31, 29, 26, .3); background: var(--mat); color: var(--ink);
  font: 500 16px var(--mono); cursor: pointer; transition: background .2s, color .2s, transform .15s;
}
.stars button:hover { transform: translateY(-2px); }
.stars button.on { background: var(--oxide); border-color: var(--oxide); color: var(--mat); }
.rate-scale { display: flex; justify-content: space-between; max-width: 290px; margin: 8px auto 0; font-size: 12px; color: var(--ink-soft); }
.rate-thanks { font-size: 14px; color: var(--sage); margin: 12px 0 0; }

.credits { list-style: none; padding: 0; margin: 0 0 32px; display: grid; gap: 12px; }
.credits li { display: grid; grid-template-columns: 60px 1fr; gap: 14px; align-items: center; font-size: 13px; color: var(--ink-soft); }
.credits img { width: 60px; height: 90px; object-fit: cover; outline: 2px solid var(--frame); }
.credits a { color: var(--ink); }

.foot { margin-top: 56px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.foot a { color: inherit; }

@media (max-width: 380px) {
  .pick.closed { grid-template-columns: repeat(3, 1fr); }
  .exhibit { grid-template-columns: 52% 1fr; gap: 14px; }
}
@media (min-width: 560px) {
  .page { padding-top: 56px; }
  .btn.primary { width: auto; min-width: 240px; }
  .stack .btn.primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
