/* try/try.css — "Yüzünde Dene" tek-ekran uygulaması.
   Sahne = koyu enstrüman şasesi (HUD şeridi, köşe braketleri, diyoptri
   cetveli); sağda numaralı "numune" kartlarından oluşan koleksiyon rayı. */

.of-try {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  grid-template-areas:
    "head    head"
    "stage   rail"
    "err     rail"
    "privacy rail";
  grid-template-rows: auto auto auto 1fr;
  align-items: start;
  column-gap: 28px;
  row-gap: 0;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 40px;
}

/* ------------------------------- Head block ------------------------------- */
.of-try-head {
  grid-area: head;
  margin-bottom: 26px;
}

.of-try-head h1 {
  margin: 10px 0 8px;
  font-family: var(--of-font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.of-try-sub {
  margin: 0;
  max-width: 46ch;
  color: var(--of-mut);
  font-size: 15.5px;
  line-height: 1.55;
}

/* --------------------------------- Stage --------------------------------- */
#stage {
  grid-area: stage;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--of-stage);
  border-radius: var(--of-radius);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(23, 30, 27, 0.06),
    0 24px 56px -24px rgba(16, 20, 26, 0.55);
}

#cam { display: none; }

#stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--of-stage);
  object-fit: contain;   /* kaynak oranını koru — yüz ezilmesin */
}

/* HUD şeridi — cihaz okuması: sol "durum", sağ "işleme yeri". Salt dekor
   değil: sağdaki etiket gizlilik vaadinin sahnedeki kısa hâli. */
.of-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  pointer-events: none;
  font-family: var(--of-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--of-hud);
  background: linear-gradient(to bottom, rgba(16, 20, 26, 0.55), rgba(16, 20, 26, 0));
}

.of-hud span:last-child { margin-left: auto; }

.of-hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--of-acc);
  box-shadow: 0 0 8px var(--of-acc);
}

/* Vizör köşe braketleri */
.of-stage-frame {
  position: absolute;
  inset: 16px;
  z-index: 2;
  pointer-events: none;
}

.of-stage-frame .tick {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
}

.tick-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 3px 0 0 0; }
.tick-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 3px 0 0; }
.tick-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 3px; }
.tick-br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 3px 0; }

/* Diyoptri cetveli — sahnenin alt kenarında ince tik şeridi */
.of-ruler {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 74px;
  height: 7px;
  z-index: 2;
  pointer-events: none;
  background:
    repeating-linear-gradient(to right,
      rgba(255, 255, 255, 0.34) 0 1px, transparent 1px 9px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.of-stage-empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 16%;
  text-align: center;
  color: rgba(230, 238, 233, 0.66);
  pointer-events: none;
}

.of-stage-empty svg {
  width: 72px;
  height: auto;
  opacity: 0.5;
}

.of-stage-empty p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 34ch;
}

#stage-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(to top, rgba(16, 20, 26, 0.82), rgba(16, 20, 26, 0));
}

#stage-actions .of-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(4px);
}

#stage-actions .of-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
  color: #fff;
}

#photo-fallback { cursor: pointer; }

/* ---------------------------------- Alert --------------------------------- */
#err-bar {
  grid-area: err;
  margin: 14px 0 0;
}

/* --------------------------------- Privacy -------------------------------- */
/* Gizlilik künyesi — cihazın "spec plakası" gibi: mono, çerçeveli, sakin. */
.of-privacy {
  grid-area: privacy;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0 0;
  padding: 13px 16px;
  border: 1px solid var(--of-line);
  border-radius: var(--of-radius-sm);
  background: color-mix(in srgb, var(--of-card) 60%, var(--of-bg));
  color: var(--of-mut);
  font-family: var(--of-font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
  line-height: 1.6;
}

.of-privacy svg {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  color: var(--of-acc);
}

.of-privacy strong {
  color: var(--of-ink);
  font-weight: 500;
}

/* ----------------------------------- Rail ---------------------------------- */
#rail-wrap {
  grid-area: rail;
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.of-rail-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.of-rail-head h2 {
  margin: 0;
  font-family: var(--of-font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--of-mut);
}

.of-rail-rule {
  flex: 1;
  height: 7px;
  background:
    repeating-linear-gradient(to right,
      var(--of-line) 0 1px, transparent 1px 9px);
}

#glasses-rail {
  counter-reset: spec;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Numune kartı — katalog numarası + lens tepsisinde çerçeve + ad.
   (Kart iskeleti try.js tarafından üretilir: .glass > img + span) */
.glass {
  counter-increment: spec;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--of-line);
  border-radius: var(--of-radius-sm);
  background: var(--of-card);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--of-ink);
  transition: border-color 0.15s ease, background-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.15s ease;
}

.glass::before {
  content: counter(spec, decimal-leading-zero);
  flex: none;
  font-family: var(--of-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--of-mut);
  transition: color 0.15s ease;
}

.glass:hover {
  border-color: color-mix(in srgb, var(--of-ink) 26%, var(--of-line));
  transform: translateY(-1px);
  box-shadow: var(--of-shadow);
}

.glass.sel {
  border-color: var(--of-acc);
  background: var(--of-acc-soft);
  box-shadow: inset 0 0 0 1px var(--of-acc);
}

.glass.sel::before { color: var(--of-acc-deep); font-weight: 500; }

.glass img {
  flex: none;
  width: 62px;
  height: 42px;
  object-fit: contain;
  background:
    linear-gradient(180deg, #fff 62%, color-mix(in srgb, var(--of-ink) 5%, #fff));
  border: 1px solid color-mix(in srgb, var(--of-line) 55%, transparent);
  border-radius: 7px;
  padding: 3px;
}

.glass span {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.35;
}

.of-rail-cta {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--of-line);
}

.of-rail-cta .of-btn { width: 100%; }

/* -------------------------------- Responsive ------------------------------- */
@media (max-width: 900px) {
  .of-try {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "stage"
      "err"
      "rail"
      "privacy";
    grid-template-rows: none;
    padding: 24px 16px 32px;
  }

  .of-try-head { margin-bottom: 18px; }

  #stage { aspect-ratio: 3 / 4; }

  #rail-wrap {
    position: static;
    margin-top: 20px;
  }

  /* Ray yatay şeride döner: sahne görünür kalır, çerçeveler kaydırılır. */
  #glasses-rail {
    flex-direction: row;
    gap: 10px;
    margin: 0 -16px;
    padding: 2px 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  #glasses-rail::-webkit-scrollbar { display: none; }

  .glass {
    flex: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 132px;
    padding: 10px 12px 12px;
    scroll-snap-align: start;
  }

  .glass img { width: 100%; height: 52px; }

  .glass span { font-size: 12.5px; }

  .of-rail-cta { margin-top: 4px; }
}

@media (max-width: 420px) {
  .of-header .of-header-badge { display: none; }
  #stage-actions { flex-direction: column; align-items: stretch; padding: 14px; }
  #stage-actions .of-btn { width: 100%; }
}

/* ---------------------------------- Tuner ---------------------------------- */
#tuner { max-width: 640px; margin: 24px auto 0; padding: 18px; border: 1px solid var(--of-line, #e4e8ef);
  border-radius: 14px; background: var(--of-surface, #fff); }
#tuner[hidden] { display: none; }
#tuner h2 { font-size: 15px; margin: 0 0 4px; }
#tuner .of-tuner-hint { font-size: 13px; color: var(--of-muted, #5b6472); margin: 0 0 14px; }
#tuner label { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 14px; }
#tuner label span:first-child { width: 64px; }
#tuner input[type=range] { flex: 1; }
#tuner b { width: 56px; text-align: right; font-variant-numeric: tabular-nums; color: var(--of-acc, #2563eb); }
#t-out { width: 100%; height: 130px; margin-top: 10px; font-family: ui-monospace, monospace;
  font-size: 12px; border: 1px solid var(--of-line, #e4e8ef); border-radius: 8px; padding: 8px; }
