/* NadirGold Ajda Bilezik — 3D viewer arayüzü */
:root {
  --bg: #e2e2e2;
  --surface: #ffffff;
  --surface-2: #f3f3f3;
  --ink: #111111;
  --ink-2: #5d5d5d;
  --line: rgba(0, 0, 0, .09);
  --gold: #a98c55;
  --gold-ink: #7d6532;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .07);
  --radius: 12px;
  --gap: 10px;
  --edge: 20px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
html[data-theme="dark"] {
  --bg: #17171a;
  --surface: #26262b;
  --surface-2: #323238;
  --ink: #f4f4f4;
  --ink-2: #a9a9b0;
  --line: rgba(255, 255, 255, .12);
  --gold: #c9ac72;
  --gold-ink: #dcc28e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .35s ease;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; background: var(--bg); transition: background-color .35s ease; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; touch-action: none; opacity: 0; transition: opacity .5s ease; }
#stage canvas.is-ready { opacity: 1; }
#stage canvas:active { cursor: grabbing; }

/* ── Markalar ─────────────────────────────────────────────────────────── */
.brand { position: absolute; z-index: 5; display: block; line-height: 0; opacity: .96; transition: opacity .2s ease; }
.brand:hover { opacity: 1; }
.brand--tl { top: max(12px, env(safe-area-inset-top)); left: var(--edge); }
.brand--tl img { width: 76px; height: auto; }
.brand--bl { bottom: max(16px, env(safe-area-inset-bottom)); left: var(--edge); }
.brand--bl img { width: 69px; height: auto; }
html[data-theme="dark"] .brand img { filter: brightness(1.22) saturate(.9); }

/* ── Araç çubuğu ──────────────────────────────────────────────────────── */
.toolbar { position: absolute; z-index: 20; top: max(20px, env(safe-area-inset-top)); right: var(--edge); display: flex; gap: var(--gap); }
.tbtn {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; transition: transform .15s ease, background-color .2s ease, color .2s ease;
}
.tbtn svg, .pill svg, .modal__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tbtn:hover { transform: translateY(-1px); }
.tbtn:active { transform: scale(.94); }
.tbtn[aria-pressed="true"], .tbtn[aria-expanded="true"] { background: var(--ink); color: var(--surface); }
.tbtn .ico-sun { display: none; }
html[data-theme="dark"] .tbtn .ico-sun { display: block; }
html[data-theme="dark"] .tbtn .ico-moon { display: none; }
html[data-theme="dark"] #btnTheme { background: var(--surface); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Alt kontrol alanı ────────────────────────────────────────────────── */
.dock {
  position: absolute; z-index: 15; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: max-content; max-width: calc(100vw - 24px); pointer-events: none;
  margin-bottom: var(--dock-lift, 0px);   /* barındırıcı rozetiyle çakışınca JS ayarlar */
}
.dock > * { pointer-events: auto; }
.dock__row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }

.sizes { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.sizes__label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.sizes__opts { display: flex; gap: 2px; }
.size {
  position: relative; min-width: 44px; height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent;
  font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color .2s ease, color .2s ease;
}
.size:hover { background: var(--surface-2); }
.size[aria-checked="true"] { background: var(--ink); color: var(--surface); }
.size.is-loading { color: transparent; }
.size.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--ink); animation: spin .7s linear infinite;
}
.size[aria-checked="true"].is-loading::after { border-color: rgba(255, 255, 255, .3); border-top-color: var(--surface); }

.lid { display: flex; padding: 4px; gap: 2px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: transform .15s ease, background-color .2s ease, color .2s ease, opacity .2s ease;
}
.pill:active { transform: scale(.97); }
.lid .pill { height: 32px; padding: 0 14px; box-shadow: none; background: transparent; font-weight: 500; }
.lid .pill svg { width: 18px; height: 18px; }
.lid .pill:not(:disabled) { background: var(--ink); color: var(--surface); }
.lid .pill:disabled { color: var(--ink-2); opacity: .55; cursor: default; }
.lid .pill:disabled:active { transform: none; }
.pill--ar:hover { transform: translateY(-1px); }

/* ── Bilgi paneli ─────────────────────────────────────────────────────── */
.info {
  position: absolute; z-index: 18; top: calc(max(20px, env(safe-area-inset-top)) + 52px); right: var(--edge);
  width: min(300px, calc(100vw - 2 * var(--edge))); padding: 18px 18px 16px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  animation: pop .22s ease;
}
.info__eyebrow { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }
.info__title { margin: 0 0 12px; font-size: 17px; font-weight: 650; line-height: 1.25; text-wrap: balance; }
.info__list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; }
.info__list > div { padding: 8px 10px; background: var(--surface); }
.info__list dt { font-size: 11px; color: var(--ink-2); }
.info__list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.info__note { margin: 12px 0 12px; font-size: 12px; color: var(--ink-2); }
.info__link { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--ink); color: var(--surface); font-weight: 600; font-size: 13px; text-decoration: none; }

/* ── Ölçü çizgisi etiketleri ──────────────────────────────────────────── */
#dimLayer { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.dim {
  position: absolute; left: 0; top: 0; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  transform: translate(-50%, -50%); will-change: transform; box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.dim--gold { background: var(--gold-ink); color: #fff; }
html[data-theme="dark"] .dim--gold { background: var(--gold); color: #17171a; }
/* ── AR penceresi ─────────────────────────────────────────────────────── */
.modal { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); animation: fade .2s ease; }
.modal__card { position: relative; width: min(340px, 100%); padding: 26px 24px 22px; text-align: center; background: #fff; color: #000; border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: pop .22s ease; }
.modal__card h2 { margin: 0 20px 16px; font-size: 17px; font-weight: 650; text-wrap: balance; }
.modal__card p { margin: 14px 0 0; font-size: 13px; color: #444; text-wrap: balance; }
.modal__qr { width: 208px; height: 208px; margin: 0 auto; }
.modal__qr svg { width: 100%; height: 100%; display: block; }
.modal__close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #000; cursor: pointer; }
.modal__close:hover { background: #f0f0f0; }

/* ── Bildirim + yükleniyor ────────────────────────────────────────────── */
#toast {
  position: absolute; z-index: 40; left: 50%; top: max(20px, env(safe-area-inset-top)); transform: translate(-50%, -12px);
  padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; max-width: calc(100vw - 32px); text-align: center;
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

#loader { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); transition: opacity .45s ease, visibility .45s; }
#loader.is-done { opacity: 0; visibility: hidden; }
.loader__ring { grid-area: 1 / 1; width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gold); animation: spin .9s linear infinite; }
.loader__pct { grid-area: 1 / 1; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ── Mobil ────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --edge: 12px; --gap: 8px; }
  .brand--tl img { width: 58px; }
  .brand--bl { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 66px); }
  .brand--bl img { width: 56px; }
  .toolbar { top: max(12px, env(safe-area-inset-top)); }
  .tbtn { width: 38px; height: 38px; }
  .dock { bottom: max(12px, env(safe-area-inset-bottom)); gap: 8px; }
  .dock__row { gap: 8px; }
  .sizes { gap: 6px; padding-left: 12px; }
  .size { min-width: 40px; padding: 0 8px; }
  .pill { padding: 0 16px; }
  .lid .pill { padding: 0 12px; }
  .info { top: calc(max(12px, env(safe-area-inset-top)) + 48px); }
}
@media (max-width: 380px) {
  .sizes__label { display: none; }
  .sizes { padding-left: 6px; }
  .lid .pill svg { display: none; }
}
@media (max-height: 460px) {
  .dock { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .brand--bl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
