/* ==========================================================
   Deneme Kabini — mobile layer (loaded after styles.css)
   Desktop keeps the existing layout; everything under 900px
   is reshaped for one-handed phone use.
   ========================================================== */
:root { --tabbar-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }

/* ---------- Pieces that exist on every size ---------- */
.mobile-only { display: none !important; }
.photo-src { display: none; }
.stage-top, .stage-bar { display: none; }
.tabbar { display: none; }
.install { display: none; }

.pose-tips { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pose-tips li { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--r-md); background: var(--chalk); border: 1px solid var(--line); font-size: 0.75rem; color: #3c4541; text-align: center; }
.pose-tips svg { width: 22px; height: 22px; fill: none; stroke: var(--loden); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dropzone.has-photo ~ .pose-tips { display: none; }

.photo-hints { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.photo-hints li { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: #fbf3dc; border: 1px solid #efd88f; color: var(--tape-ink); font-size: 0.85rem; line-height: 1.4; }
.photo-hints li::before { content: '!'; flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--tape); color: var(--tape-ink); font-weight: 700; font-size: 0.75rem; }
.photo-hints li.is-ok { background: #e3efe8; border-color: #b9d9c4; color: #1f4d33; }
.photo-hints li.is-ok::before { content: '✓'; background: #1f6b3f; color: #fff; }

.privacy-note { margin-top: 10px; }

.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-ghost-light { border-color: rgba(255, 255, 255, 0.45); color: var(--chalk); background: transparent; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.1); }
.btn[aria-disabled='true'], .btn:disabled { opacity: 0.45; pointer-events: none; }

/* Bottom sheet (share) */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: min(100%, 520px); max-width: 100%; border-radius: 18px 18px 0 0; background: var(--chalk); color: inherit; box-shadow: var(--shadow-float); }
.sheet::backdrop { background: rgba(22, 33, 30, 0.55); }
.sheet[open] { animation: sheet-up 0.28s var(--ease); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-inner { display: grid; gap: 10px; padding: 10px 18px calc(16px + var(--safe-b)); }
.sheet-grip { justify-self: center; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 6px; }
.sheet h2 { margin: 0 0 4px; font-size: 1.2rem; }
.sheet-list { display: grid; gap: 8px; }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bone); font: inherit; text-align: left; color: inherit; cursor: pointer; }
.sheet-item:active { background: #e9e8e4; }
.sheet-item span:last-child { display: grid; gap: 2px; }
.sheet-item small { color: var(--stone); font-size: 0.8rem; }
.sheet-ico { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--loden); color: var(--chalk); }
.sheet-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: none) {
  .stage-loupe { display: none !important; }
}

/* ==========================================================
   Phone / small tablet
   ========================================================== */
@media (max-width: 900px) {
  html { -webkit-text-size-adjust: 100%; }
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px !important; } /* stops iOS zoom on focus */
  .mobile-only { display: inline-flex !important; }
  .btn { min-height: 50px; }
  .btn:active { transform: scale(0.98); }

  /* Header */
  .site-header { padding-top: var(--safe-t); }
  .header-row { height: 60px; gap: 12px; }
  .header-cta { min-height: 40px; padding: 0 14px; font-size: 0.85rem; max-width: 52vw; }
  .wrap { width: calc(100% - 32px); }

  /* Bottom tab bar */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--chalk) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    position: relative; display: grid; place-items: center; align-content: center; gap: 3px;
    text-decoration: none; color: var(--stone); font-size: 0.7rem; font-weight: 600;
  }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current='true'] { color: var(--loden-ink); }
  .tabbar a[aria-current='true'] svg { stroke-width: 2.2; }
  .tabbar a[aria-current='true']::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--tape); }
  .tab-badge {
    position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 9px; background: var(--tape); color: var(--tape-ink);
    font-size: 0.68rem; font-weight: 700;
  }

  /* Hero: headline, actions, mirror, facts — in that order */
  .hero { padding: 22px 0 34px; }
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .hero-copy { display: contents; }
  .hero h1 { order: 1; font-size: clamp(2.1rem, 9.4vw, 2.9rem); max-width: 14ch; }
  .hero-lead { order: 2; font-size: 1rem; margin: 14px 0 20px; }
  .hero-actions { order: 3; display: grid; grid-template-columns: 1fr; gap: 10px; }
  .hero-actions .btn-link { justify-self: center; min-height: 40px; }
  .hero-actions .btn { white-space: nowrap; }
  .hero-mirror { order: 4; justify-self: center; width: min(66%, 300px); margin-top: 28px; }
  .garment-tag { left: -22px; bottom: 26px; width: 160px; padding: 12px 12px 10px 28px; font-size: 0.75rem; }
  .tag-hole { left: 10px; }
  .hero-facts { order: 5; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; padding-top: 18px; }
  .hero-facts dt { font-size: 1.5rem; }
  .hero-facts dd { font-size: 0.76rem; line-height: 1.35; }

  .brands { padding: 18px 0; }
  .brands-track li { font-size: 1.1rem; padding-right: 36px; }

  /* Collection: sticky, swipeable filters */
  .collection { padding: 32px 0 40px; }
  .section-head { margin-bottom: 16px; gap: 14px; }
  .section-head h2 { font-size: 1.8rem; }
  .section-head p { font-size: 0.92rem; }
  .filter-row {
    position: sticky; top: calc(60px + var(--safe-t)); z-index: 20;
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    margin: 0 -16px 18px; padding: 10px 16px;
    background: color-mix(in srgb, var(--chalk) 96%, transparent);
    border-bottom: 1px solid var(--line);
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row .chip { flex: none; scroll-snap-align: start; min-height: 40px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 22px 12px; }
  .card-body { padding-top: 8px; }
  .card-brand { font-size: 0.85rem; }
  .card-name { font-size: 0.82rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card-price { font-size: 0.95rem; margin-top: 2px; }
  .card-link { font-size: 0.72rem; margin-top: 4px; }
  .card-pin { width: 34px; height: 34px; top: 8px; right: 8px; }
  .card-slot { font-size: 0.7rem; left: 8px; bottom: 8px; }
  .source-note { margin-top: 24px; }

  /* Studio */
  .studio { padding: 30px 0 40px; }
  .studio-panel > p { margin: 8px 0 18px; }
  .step { padding: 18px 0; }
  .photo-src { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .photo-src .btn { padding: 0 10px; font-size: 0.92rem; }
  .dropzone:not(.has-photo) { display: none; }
  .dropzone.has-photo { margin-bottom: 12px; }
  .dz-filled img { width: 56px; height: 74px; }
  .pose-tips { margin-top: 12px; }

  /* Sticky try button sits above the tab bar while the panel is on screen */
  .step-go {
    position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 15;
    margin: 0 -16px; padding: 10px 16px 12px; gap: 6px;
    background: color-mix(in srgb, var(--bone) 96%, transparent);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
  }
  .step-go .quota { font-size: 0.82rem; text-align: center; }
  #tryBtn { min-height: 54px; font-size: 1rem; }

  .studio-stage { margin-top: 8px; }
  .mirror-stage { width: min(100%, 420px); }
  .stage-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .stage-actions .btn { width: 100%; padding: 0 10px; }
  .share-row { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding-bottom: 2px; }
  .share-row .chip { flex: none; }

  /* Full-screen result */
  .studio-stage.is-full {
    position: fixed; inset: 0; z-index: 80; margin: 0;
    display: flex; flex-direction: column; gap: 10px;
    padding: calc(8px + var(--safe-t)) 12px calc(12px + var(--safe-b));
    background: var(--loden-ink); color: var(--chalk);
  }
  .studio-stage.is-full .stage-top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
  .stage-top strong { font-family: var(--font-display); font-size: 1.05rem; }
  .stage-close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: var(--chalk); cursor: pointer; }
  .stage-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .stage-zoom-hint { margin-left: auto; font-size: 0.75rem; color: rgba(255, 255, 255, 0.6); opacity: 0; transition: opacity 0.3s; }
  .studio-stage.is-full[data-done='true'] .stage-zoom-hint { opacity: 1; }
  .studio-stage.is-full .mirror-stage {
    flex: 1 1 auto; min-height: 0; width: 100%; max-width: calc((100dvh - 220px) * 0.75);
    aspect-ratio: auto; max-height: none; margin: 0 auto; padding: 8px;
  }
  .studio-stage.is-full .mirror-stage::after { inset: 8px; }
  .studio-stage.is-full .stage-view { inset: 8px; touch-action: none; }
  .studio-stage.is-full .stage-status { margin: 0; min-height: 24px; color: rgba(243, 242, 239, 0.85); font-size: 0.9rem; }
  .studio-stage.is-full .stage-status.is-error { color: #f3b6ad; }
  .studio-stage.is-full .stage-actions,
  .studio-stage.is-full .result-extras,
  .studio-stage.is-full .engine-note { display: none !important; }
  .studio-stage.is-full .stage-bar { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 8px; }
  .stage-bar .btn { min-height: 52px; padding: 0 8px; font-size: 0.88rem; gap: 6px; white-space: nowrap; }
  .panel-page .header-cta { display: none; }
  body.stage-locked { overflow: hidden; }

  .stage-before, .stage-after { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--z, 1)); transform-origin: center; }
  .stage-view.is-zooming .stage-before, .stage-view.is-zooming .stage-after { transition: none; }

  /* Selection tray above the tab bar */
  .tray { bottom: calc(var(--tabbar-h) + var(--safe-b)); padding: 8px 0; }
  .tray-items img { width: 32px; height: 44px; }
  body.has-tray .footer-bottom-row { padding-bottom: 76px; }

  .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 76px); }

  /* Gate dialog becomes a bottom sheet */
  .gate { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; }
  .gate[open] { animation: sheet-up 0.28s var(--ease); }
  .gate-inner { padding: 28px 20px calc(20px + var(--safe-b)); }
  .gate-actions { display: grid; }
  .gate-actions .btn { width: 100%; }

  /* Sections */
  .pricing { padding: 40px 0; }
  .plans { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%; max-width: none; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin: 24px -16px 16px; padding: 14px 16px 6px; scrollbar-width: none; }
  .plans::-webkit-scrollbar { display: none; }
  .plan { scroll-snap-align: center; }
  .how { padding: 40px 0; }
  .how-steps { margin-top: 24px; gap: 20px; }
  .how-steps li::before { font-size: 1.8rem; margin-bottom: 8px; }
  .footer-main { padding: 36px 0 28px; }

  /* Install banner */
  .install:not([hidden]) {
    position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); z-index: 55;
    display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
    background: var(--chalk); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float);
  }
  .install img { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); flex: none; }
  .install-text { display: grid; min-width: 0; line-height: 1.3; }
  .install-text strong { font-size: 0.92rem; }
  .install-text span { font-size: 0.78rem; color: var(--stone); }
  .install .btn { margin-left: auto; flex: none; min-height: 40px; }
  .install-close { flex: none; width: 36px; height: 36px; border: 0; background: none; font-size: 1.3rem; color: var(--stone); cursor: pointer; }
}

/* Standalone app (added to home screen): no browser chrome, keep header compact */
@media (max-width: 420px) {
  .stage-bar .btn svg { display: none; }
  .stage-top strong { white-space: nowrap; }
}
@media (max-width: 380px) {
  .stage-zoom-hint { display: none; }
}

@media (display-mode: standalone) and (max-width: 900px) {
  .install { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open], .gate[open] { animation: none; }
}
