:root {
  --paper: #f5efe6;
  --paper-deep: #e8ddcf;
  --ink: #291f1d;
  --ink-soft: #71645e;
  --wine: #611f2b;
  --wine-deep: #3c121c;
  --gold: #b58a34;
  --gold-pale: #d7bd7b;
  --line: rgba(76, 47, 39, .16);
  --font: "Karla", "Avenir Next", "Segoe UI", sans-serif;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, a { font: inherit; }
.skip-link { position: fixed; left: -9999px; top: .5rem; z-index: 100; }
.skip-link:focus { left: .5rem; padding: .6rem .85rem; color: white; background: var(--wine); }

.studio-header {
  height: calc(4.5rem + var(--safe-top));
  padding: var(--safe-top) calc(1.5rem + var(--safe-right)) 0 calc(1.5rem + var(--safe-left));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 239, 230, .96);
  position: relative;
  z-index: 30;
}
.studio-back, .studio-brand, .studio-wa { color: inherit; text-decoration: none; }
.studio-back { width: max-content; color: var(--ink-soft); font-size: .77rem; letter-spacing: .04em; }
.studio-brand { display:flex; align-items:center; gap:.55rem; font: 500 clamp(1.55rem, 2.4vw, 2rem)/1 var(--display); letter-spacing: .02em; }
.studio-brand img { width:36px; height:36px; }
.studio-header-actions { justify-self: end; display: flex; align-items: center; gap: .65rem; }
.studio-status {
  color: var(--gold);
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.studio-wa { padding: .52rem .7rem; border: 1px solid var(--line); font-size: .72rem; font-weight: 700; }

.tryon-app {
  height: calc(100dvh - 4.5rem - var(--safe-top));
  min-height: 38rem;
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(22rem, 38fr);
}
.studio-panel {
  position: relative;
  min-width: 0;
  padding: 1.25rem 1.5rem 1rem;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 1.35rem;
  background:
    radial-gradient(circle at 76% 38%, rgba(255,255,255,.76), transparent 30%),
    linear-gradient(145deg, #eee5d9 0%, #d8cabc 100%);
  overflow: hidden;
}
.studio-intro { position: absolute; z-index: 5; left: 1.75rem; bottom: 4.8rem; width: min(13rem, 25%); }
.studio-intro p, .catalog-kicker {
  margin: 0 0 .45rem;
  color: var(--wine);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.studio-intro h1 {
  margin: 0;
  max-width: 7ch;
  font: 500 clamp(2.1rem, 3.3vw, 3.7rem)/.88 var(--display);
  letter-spacing: -.04em;
}
.photo-stage {
  width: min(100%, calc((100dvh - 9.8rem) * .6666667));
  height: auto;
  max-height: none;
  aspect-ratio: 2 / 3;
  justify-self: center;
  align-self: center;
  position: relative;
  overflow: hidden;
  background: var(--wine-deep);
  box-shadow: 0 28px 65px rgba(62, 39, 30, .2);
}
.studio-transform {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  transition: transform .72s var(--ease);
  will-change: transform;
}
#studio-photo, #tryon-canvas, .photo-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; }
#studio-photo { object-fit: fill; opacity: 0; transition: opacity .5s ease; }
.photo-stage.is-photo-ready #studio-photo { opacity: 1; }
#tryon-canvas { display: block; pointer-events: none; }
.photo-placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .3rem;
  color: rgba(255,245,228,.75);
  background:
    radial-gradient(circle at 50% 34%, rgba(208,167,103,.28), transparent 19%),
    linear-gradient(155deg, #6f2734, #35121a);
  transition: opacity .35s;
}
.photo-stage.is-photo-ready .photo-placeholder { opacity: 0; }
.photo-placeholder span { font: 500 5.5rem/1 var(--display); }
.photo-placeholder small { letter-spacing: .14em; text-transform: uppercase; font-size: .62rem; }
.studio-selection {
  position: absolute;
  left: .85rem;
  bottom: 2.15rem;
  max-width: calc(100% - 1.7rem);
  padding: .55rem .65rem;
  color: white;
  background: rgba(42,21,23,.62);
  backdrop-filter: blur(10px);
  z-index: 6;
}
.studio-selection span { display: block; color: var(--gold-pale); font-size: .57rem; letter-spacing: .13em; text-transform: uppercase; }
.studio-selection strong { display: block; margin-top: .12rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .7rem; }
.studio-disclosure {
  position: absolute;
  right: .75rem;
  bottom: .65rem;
  z-index: 6;
  margin: 0;
  color: rgba(255,255,255,.7);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
  font-size: .55rem;
}
.photo-stage.is-renderer-unavailable .studio-selection::after {
  content: " · Fotoğraf önizlemesi";
  color: rgba(255,255,255,.72);
  font-size: .57rem;
}
.view-controls {
  grid-column: 1 / -1;
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
}
.view-btn, .category-chip, .clear-selection {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition: color .22s, background .22s, border-color .22s, transform .22s;
}
.view-btn {
  padding: .58rem .75rem;
  color: var(--ink-soft);
  background: rgba(255,255,255,.48);
  border: 1px solid rgba(65,45,37,.13);
  font-size: .68rem;
}
.view-btn:hover, .view-btn.is-active { color: white; background: var(--wine); border-color: var(--wine); }

.catalog-panel {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.55rem max(1.25rem, 3vw) 1.4rem;
  background: var(--paper);
  border-left: 1px solid var(--line);
}
.catalog-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.catalog-panel h2 { margin: 0; font: 500 clamp(2rem, 3vw, 3.1rem)/.88 var(--display); }
.catalog-lead { margin: .65rem 0 1.15rem; max-width: 40ch; color: var(--ink-soft); font-size: .78rem; line-height: 1.45; }
.clear-selection { padding: .2rem 0; color: var(--wine); background: transparent; border-bottom: 1px solid currentColor; font-size: .65rem; }
.category-chips { display: flex; gap: .35rem; overflow-x: auto; padding: 0 0 .85rem; scrollbar-width: none; }
.category-chips::-webkit-scrollbar { display: none; }
.category-chip {
  flex: 0 0 auto;
  padding: .56rem .68rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  font-size: .68rem;
}
.category-chip:hover, .category-chip.is-active { color: white; background: var(--wine); border-color: var(--wine); }
.catalog-products { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.product-option {
  appearance: none;
  min-width: 0;
  padding: .55rem;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  background: rgba(255,255,255,.52);
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.product-option:hover, .product-option.is-active { border-color: rgba(181,138,52,.75); box-shadow: 0 8px 24px rgba(77,45,35,.09); transform: translateY(-1px); }
.product-option img { width: 3rem; height: 3rem; object-fit: contain; background: #eee5d9; }
.product-option strong { display: block; font-size: .69rem; line-height: 1.2; }
.product-option span span { display: block; margin-top: .18rem; color: var(--ink-soft); font-size: .59rem; }

.selected-card { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .85rem; }
.selected-empty { min-height: 5rem; display: flex; align-items: center; gap: .75rem; color: var(--ink-soft); }
.selected-empty-mark { color: var(--gold); font: 400 2.2rem/1 var(--display); }
.selected-empty h3, .selected-copy h3 { margin: 0; font: 600 1.22rem/1.05 var(--display); color: var(--ink); }
.selected-empty p { margin: .2rem 0 0; max-width: 36ch; font-size: .68rem; line-height: 1.4; }
.selected-content { display: grid; grid-template-columns: 5.1rem 1fr; gap: .75rem; }
#selected-image { width: 5.1rem; height: 5.1rem; object-fit: contain; background: var(--paper-deep); }
.selected-copy { min-width: 0; }
#selected-slot { margin: 0 0 .18rem; color: var(--wine); font-size: .58rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
#selected-meta, #selected-desc { margin: .25rem 0 0; color: var(--ink-soft); font-size: .65rem; line-height: 1.35; }
#selected-price { display: block; margin-top: .25rem; color: var(--gold); font-size: .72rem; }
.selected-actions { grid-column: 1 / -1; display: flex; gap: .45rem; }
.selected-actions a { flex: 1 1 50%; padding: .65rem .75rem; text-align: center; text-decoration: none; font-size: .68rem; font-weight: 700; }
.action-primary { color: white; background: var(--wine); }
.action-secondary { color: var(--wine); border: 1px solid rgba(97,31,43,.3); }
.selected-note { grid-column: 1 / -1; margin: 0; color: #8a7c75; font-size: .56rem; line-height: 1.4; }

.studio-loader { position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center; color: var(--wine); background: var(--paper); transition: opacity .45s, visibility .45s; }
.studio-loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-monogram { width: 3.3rem; height: 3.3rem; display: grid; place-content: center; border: 1px solid var(--gold); border-radius: 50%; font: 500 2rem/1 var(--display); animation: breathe 1.4s ease-in-out infinite; }
.studio-loader p { margin: .7rem 0 0; color: var(--ink-soft); font-size: .72rem; }
.studio-noscript { position: fixed; inset: 0; z-index: 100; margin: 0; display: grid; place-content: center; padding: 2rem; background: var(--paper); }
.studio-noscript a { color: var(--wine); }

@keyframes breathe { 50% { transform: scale(1.06); opacity: .62; } }

@media (max-width: 1040px) {
  .tryon-app { grid-template-columns: minmax(0, 56fr) minmax(21rem, 44fr); }
  .studio-panel { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr) auto; }
  .studio-intro { position: absolute; z-index: 7; left: 1.25rem; bottom: 5rem; width: 9rem; color: white; text-shadow: 0 2px 24px rgba(0,0,0,.45); pointer-events: none; }
  .studio-intro p { color: var(--gold-pale); }
  .studio-intro h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); }
  .photo-stage { grid-row: 1 / 3; }
  .view-controls { grid-row: 3; }
  .catalog-products { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .studio-header { height: calc(3.75rem + var(--safe-top)); padding-left: calc(.75rem + var(--safe-left)); padding-right: calc(.75rem + var(--safe-right)); }
  .studio-brand { font-size: 1.3rem; }
  .studio-status { display: none; }
  .studio-back, .studio-wa { font-size: .65rem; }
  .studio-wa { padding: .42rem .5rem; }
  .tryon-app { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .studio-panel { order: 1; display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto; gap: .6rem; padding: .65rem 0 .75rem; overflow: visible; }
  .studio-intro { display: none; }
  .photo-stage { grid-row: 1; width: min(100%, calc(52svh * .6667)); height: 52svh; max-height: none; aspect-ratio: 2 / 3; box-shadow: none; scroll-margin-top: calc(3.75rem + var(--safe-top)); }
  .view-controls { grid-row: 2; flex-wrap: nowrap; width: 100%; justify-content: flex-start; overflow-x: auto; padding: 0 .65rem; scrollbar-width: none; }
  .view-btn { flex: 0 0 auto; }
  .catalog-panel { order: 2; overflow: visible; padding: 1.2rem calc(.8rem + var(--safe-right)) calc(1.3rem + var(--safe-bottom)) calc(.8rem + var(--safe-left)); border-left: 0; border-top: 1px solid var(--line); }
  .catalog-panel h2 { font-size: 2.45rem; }
  .catalog-lead { margin-bottom: .85rem; }
  .category-chips { margin-right: calc(-.8rem - var(--safe-right)); padding-right: .8rem; }
  .catalog-products { display: flex; overflow-x: auto; gap: .5rem; margin-right: calc(-.8rem - var(--safe-right)); padding: 0 .8rem .5rem 0; scrollbar-width: none; }
  .product-option { flex: 0 0 13rem; }
  .selected-card { min-height: 7rem; }
  .studio-disclosure { font-size: .52rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
