/* Tarihte Bir Yüz
   Konsept: sergi salonunun lake kırmızısı duvarı, üzerinde yaldız çerçeveli portreler
   ve yanlarında müze künye kartları. Tek güçlü öğe yaldız çerçeve, gerisi sakin. */

:root {
  --wall: #5a1a1e;
  --wall-deep: #3a0f12;
  --wall-lift: #74262b;
  --gilt: #c9a158;
  --gilt-hi: #efd99f;
  --gilt-lo: #86662c;
  --parchment: #f3e9d4;
  --parchment-edge: #dfcfac;
  --ink: #2b1b15;
  --ink-soft: #6a5244;
  --focus: #ffe7a6;

  --serif: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --sans: 'Alegreya Sans', 'Gill Sans', 'Segoe UI', system-ui, sans-serif;

  --step--1: clamp(0.84rem, 0.8rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-4: clamp(2.8rem, 1.8rem + 5vw, 6.2rem);

  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--wall-deep);
  color: var(--parchment);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---- Duvar: lake kırmızısı, üstten sergi ışığı, çok silik desen ---- */
.wall {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 214, 160, 0.16), transparent 60%),
    radial-gradient(90% 60% at 50% 120%, rgba(0, 0, 0, 0.35), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffd9a0' stroke-opacity='.035' stroke-width='1.2'%3E%3Cpath d='M60 18c10 14 10 30 0 42-10-12-10-28 0-42z'/%3E%3Cpath d='M60 60c14-6 28-2 36 10-14 6-28 2-36-10zM60 60c-14-6-28-2-36 10 14 6 28 2 36-10z'/%3E%3Ccircle cx='0' cy='0' r='9'/%3E%3Ccircle cx='120' cy='0' r='9'/%3E%3Ccircle cx='0' cy='120' r='9'/%3E%3Ccircle cx='120' cy='120' r='9'/%3E%3C/g%3E%3C/svg%3E"),
    var(--wall);
}

/* ---- Üst bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) var(--gutter) 12px;
}
.topbar__home {
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  font-size: var(--step--1); letter-spacing: 0.02em; color: var(--gilt-hi); opacity: 0.85;
}
.lang { display: inline-flex; border: 1px solid rgba(239, 217, 159, 0.35); border-radius: 999px; overflow: hidden; }
.lang button {
  background: none; border: 0; padding: 6px 12px; min-width: 44px; min-height: 36px; cursor: pointer;
  font-size: var(--step--1); color: var(--gilt-hi);
}
.lang button[aria-pressed="true"] { background: var(--gilt); color: var(--ink); }

#app { padding: 0 var(--gutter) max(32px, env(safe-area-inset-bottom)); }
.screen { max-width: 1240px; margin: 0 auto; }

/* ---- Yaldız çerçeve (sayfanın tek gösterişli öğesi) ---- */
.frame {
  margin: 0;
  position: relative;
  padding: var(--fw, 12px);
  background:
    linear-gradient(135deg, var(--gilt-hi) 0%, var(--gilt) 18%, var(--gilt-lo) 42%, var(--gilt) 58%, var(--gilt-hi) 74%, var(--gilt-lo) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 210, 0.7),
    inset 0 0 0 calc(var(--fw, 12px) * 0.38) rgba(0, 0, 0, 0),
    inset 0 0 0 calc(var(--fw, 12px) * 0.42) rgba(90, 60, 15, 0.55),
    0 2px 0 rgba(255, 230, 170, 0.15),
    0 22px 44px -12px rgba(15, 0, 0, 0.7);
}
.frame::before {
  /* iç pervaz: ince koyu yiv + yaldız sırt */
  content: ''; position: absolute; inset: calc(var(--fw, 12px) * 0.55);
  border: 1px solid rgba(255, 240, 200, 0.55);
  box-shadow: 0 0 0 1px rgba(60, 35, 5, 0.5);
  pointer-events: none;
}
.frame__inner {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden;
  background: #1b0c0a;
  box-shadow: inset 0 0 0 2px #5c4318, inset 0 0 24px rgba(0, 0, 0, 0.65);
}
.frame__inner > img { width: 100%; height: 100%; object-fit: cover; }
.frame--md { --fw: clamp(12px, 1.8vw, 20px); }
.frame--lg { --fw: clamp(14px, 2.2vw, 26px); }

/* ---- Açılış: tek portre ---- */
.hero {
  display: grid; gap: 20px;
  grid-template-areas: "head" "art" "cta" "label" "fine";
  padding: clamp(6px, 3vh, 40px) 0 0;
}
.hero__head { grid-area: head; }
.hero__art { grid-area: art; justify-self: center; width: min(100%, 420px, calc(54dvh * 0.75 + 28px)); }
.hero__cta { grid-area: cta; display: flex; justify-content: center; }
.hero__label { grid-area: label; }
.hero__fine { grid-area: fine; margin: 4px 0 0; }
@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "art head" "art cta" "art label" "art fine";
    column-gap: clamp(36px, 5vw, 88px); row-gap: 24px; align-items: start;
    padding-top: clamp(16px, 5vh, 56px);
  }
  .hero__art { align-self: center; justify-self: end; width: min(100%, 520px, calc(76dvh * 0.75 + 36px)); }
  .hero__cta { justify-content: flex-start; }
  .hero__label { max-width: 36rem; }
}
.intro__title {
  margin: 0;
  font-family: var(--serif); font-weight: 500; font-size: var(--step-4);
  line-height: 0.95; letter-spacing: -0.015em;
  color: var(--gilt-hi);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.intro__lead { margin: 18px 0 0; font-size: var(--step-1); line-height: 1.45; max-width: 34ch; color: var(--parchment); }


.fineprint { max-width: 60ch; font-size: var(--step--1); color: rgba(243, 233, 212, 0.62); }

.btn--lg { min-height: 58px; padding: 0 34px; font-size: var(--step-1); }

/* ---- Künye kartı (müze etiketi) ---- */
.label {
  background: var(--parchment); color: var(--ink);
  padding: clamp(18px, 2.4vw, 28px);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--parchment-edge), 0 14px 30px -14px rgba(0, 0, 0, 0.6);
  max-width: 30rem;
}
.label--flat { box-shadow: inset 0 0 0 1px var(--parchment-edge); }
.label__name { margin: 0; font-family: var(--serif); font-weight: 600; font-size: var(--step-2); line-height: 1.1; }
.label__meta { margin: 6px 0 0; color: var(--ink-soft); }
.label__story { margin: 16px 0 0; font-size: var(--step-0); line-height: 1.6; }
.label__credit { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--parchment-edge); font-size: var(--step--1); color: var(--ink-soft); line-height: 1.45; }
.label__credit > span:first-child { color: var(--ink); font-weight: 700; }
.label__tip { margin: 14px 0 0; font-size: var(--step--1); color: var(--ink-soft); }
.label__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.label__more { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; }

/* ---- Düğmeler ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-size: var(--step-0); font-weight: 700; text-decoration: none;
  border: 1px solid transparent; transition: filter 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn--gilt { background: linear-gradient(180deg, var(--gilt-hi), var(--gilt)); color: #2e1f0b; box-shadow: inset 0 0 0 1px rgba(255, 248, 220, 0.6), 0 6px 16px -6px rgba(0, 0, 0, 0.5); }
.btn--gilt:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.label .btn--ghost { color: var(--ink); border-color: rgba(43, 27, 21, 0.45); }
.btn--text { background: none; border: 0; padding: 0 2px; min-height: 40px; color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; border-radius: 4px; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: var(--step--1); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---- Kamera ---- */
.screen--camera { max-width: 640px; }
.cam-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.cam-head .btn--ghost { color: var(--gilt-hi); border-color: rgba(239, 217, 159, 0.5); }
.cam-head__fig { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: var(--step-0); color: var(--gilt-hi); text-align: right; }
.cam-head__fig img { width: 36px; height: 48px; object-fit: cover; border: 2px solid var(--gilt); }

.viewer {
  position: relative; aspect-ratio: 3 / 4; width: 100%; max-height: 66dvh; margin: 0 auto;
  overflow: hidden; background: #150807; border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(239, 217, 159, 0.35), 0 20px 40px -14px rgba(0, 0, 0, 0.7);
}
@media (min-aspect-ratio: 4/5) { .viewer { width: auto; height: 66dvh; } }
.viewer video, .viewer__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.viewer__preview { object-fit: contain; background: #150807; transform: none; }
.viewer__guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.viewer__oval { fill: none; stroke: var(--gilt-hi); stroke-width: 2.4; stroke-dasharray: 6 7; vector-effect: non-scaling-stroke; transition: stroke 0.2s ease; }
.viewer.is-good .viewer__oval { stroke: #bfe8a6; stroke-dasharray: none; }
.viewer.is-preview .viewer__guide { display: none; }
.viewer__count {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-family: var(--serif); font-size: clamp(5rem, 22vw, 9rem); color: var(--gilt-hi);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
.viewer__flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.viewer__flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }
.viewer__msg {
  position: absolute; inset: auto 16px 16px; padding: 14px 16px; border-radius: 6px;
  background: var(--parchment); color: var(--ink); font-size: var(--step--1); line-height: 1.45;
}
.hint { text-align: center; margin: 14px 0 6px; font-size: var(--step-1); color: var(--gilt-hi); min-height: 1.6em; }
.cam-actions { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.shutter {
  width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--gilt-hi); background: transparent; padding: 5px; cursor: pointer;
}
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: linear-gradient(180deg, var(--gilt-hi), var(--gilt)); transition: transform 0.12s ease; }
.shutter:active span { transform: scale(0.9); }
.upload { color: var(--gilt-hi); border-color: rgba(239, 217, 159, 0.5); }
.screen--camera .btn--ghost { color: var(--gilt-hi); }

/* ---- Boyanıyor ---- */
.screen--painting { display: grid; justify-items: center; gap: 22px; padding-top: 2vh; }
.painting { width: min(78vw, 46dvh, 420px); }
.painting img { filter: saturate(0.6) brightness(0.8) blur(1.5px); transition: filter 1s ease; }
.painting__light {
  position: absolute; inset: -20%;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 232, 180, 0.28) 48%, rgba(255, 246, 220, 0.45) 50%, rgba(255, 232, 180, 0.28) 52%, transparent 65%);
  animation: sweep 2.8s ease-in-out infinite;
}
@keyframes sweep { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.painting__text { text-align: center; }
.painting__title { margin: 0; font-family: var(--serif); font-size: var(--step-2); color: var(--gilt-hi); }
.painting__step { margin: 8px 0 0; font-size: var(--step-1); min-height: 1.5em; }
.painting__time { margin: 6px 0 0; font-size: var(--step--1); color: rgba(243, 233, 212, 0.7); }
.painting__clock { font-variant-numeric: tabular-nums; margin-left: 6px; }

/* ---- Sonuç ---- */
.result {
  display: grid; gap: clamp(22px, 4vw, 56px); align-items: center; justify-content: center;
  grid-template-columns: minmax(0, min(560px, 62dvh * 0.75 + 52px));
  padding-top: 1vh;
}
@media (min-width: 900px) {
  .result { grid-template-columns: minmax(0, min(560px, calc((100dvh - 140px) * 0.75))) minmax(300px, 400px); }
}
.compare .compare__orig, .compare .compare__res { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .compare__res { clip-path: inset(0 0 0 var(--split, 0%)); }
.compare__line {
  position: absolute; top: 0; bottom: 0; left: var(--split, 0%); width: 2px; margin-left: -1px;
  background: var(--gilt-hi); box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); pointer-events: none;
}
.compare__line::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: var(--gilt-hi) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233a2810' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l-6 6 6 6M15 6l6 6-6 6'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.compare__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.compare__range:focus-visible + .compare__line, .compare:focus-within .compare__line { box-shadow: 0 0 0 3px var(--focus); }

.qr { display: flex; gap: 16px; align-items: center; margin-top: 18px; padding: 14px; background: #fff; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--parchment-edge); }
.qr__code { flex: 0 0 auto; width: 132px; height: 132px; }
.qr__code svg { width: 100%; height: 100%; display: block; }
.qr__text { margin: 0; font-size: var(--step--1); color: var(--ink); }

/* ---- Diyaloglar ---- */
.sheet {
  border: 0; padding: 0; background: transparent; color: inherit;
  width: min(980px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
.sheet--narrow { width: min(520px, calc(100vw - 24px)); }
.sheet::backdrop { background: rgba(25, 4, 6, 0.72); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise 0.28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.sheet__close { display: flex; justify-content: flex-end; margin: 0 4px 6px; }
.sheet__close .btn--text { color: var(--gilt-hi); }
.sheet__body { max-height: calc(100dvh - 90px); overflow: auto; }
.detail { display: grid; gap: clamp(18px, 3vw, 40px); align-items: start; grid-template-columns: 1fr; }
.detail .frame { width: min(100%, 380px); justify-self: center; }
@media (min-width: 760px) { .detail { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: center; } .detail .frame { width: 100%; } }
.consent { background: var(--parchment); color: var(--ink); padding: clamp(22px, 4vw, 36px); border-radius: 3px; }
.consent__title { margin: 0 0 12px; font-family: var(--serif); font-weight: 600; font-size: var(--step-2); line-height: 1.15; }
.consent p { margin: 10px 0 0; max-width: 54ch; }
.consent .btn--ghost { color: var(--ink); border-color: rgba(43, 27, 21, 0.45); }

/* ---- Bildirim ---- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 12px 20px; border-radius: 999px; background: var(--parchment); color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); font-weight: 500; z-index: 10;
}

/* ---- Kiosk modu: büyük dokunma alanları, indirme/paylaş yok ---- */
body.kiosk [data-kiosk-hide] { display: none !important; }
body.kiosk { user-select: none; -webkit-user-select: none; }
body.kiosk .btn { min-height: 60px; padding: 0 28px; }
body.kiosk .qr__code { width: 180px; height: 180px; }

/* ---- Paylaşım sayfası ---- */
.page-share { padding: 0 var(--gutter); }
.share { max-width: 1100px; margin: 0 auto; padding: clamp(24px, 6vh, 64px) 0; }
.share__eyebrow { margin: 0 0 18px; color: var(--gilt-hi); font-size: var(--step--1); }
.share__title { margin: 0; font-family: var(--serif); font-weight: 500; font-size: var(--step-4); line-height: 1; color: var(--gilt-hi); }
.share__lead { max-width: 44ch; font-size: var(--step-1); margin: 18px 0 26px; }
.share__grid { display: grid; gap: clamp(22px, 4vw, 56px); align-items: center; grid-template-columns: 1fr; }
.share__grid .frame { width: min(100%, 520px); justify-self: center; }
@media (min-width: 860px) { .share__grid { grid-template-columns: minmax(0, 520px) minmax(0, 400px); justify-content: center; } }
.share__grid .frame__inner img { width: 100%; height: 100%; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .painting__light { display: none; }
}

/* Açılış başlığı masaüstünde tek satıra sığsın */
@media (min-width: 900px) {
  .hero .intro__title { font-size: clamp(3rem, 1.4rem + 3.4vw, 5.4rem); }
}
