/* Responsive: the phone layout is redesigned, not shrunk.
   Desktop: four-column workspace. Tablet: slimmer panels.
   Phone: full-bleed stage, horizontal tool strip and a bottom sheet. */

.sheet-tabs, .sheet-grip { display: none; }

@media (max-width: 1280px) {
  .studio { grid-template-columns: 52px 270px minmax(0, 1fr) 250px; }
  .booth { grid-template-columns: 290px minmax(0, 1fr) 170px; }
}

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 120px; }
  .hero__visual { max-width: 560px; }
  .engine__grid, .privacy__grid { grid-template-columns: 1fr; }
  .kit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kit__col:nth-child(2) { border-right: 0; }
  .kit__col:nth-child(n+3) { border-top: var(--hair) solid var(--vellum-3); padding-left: 0; }
  .kit__col:nth-child(4) { padding-left: var(--s-4); }
  .privacy-pill span { display: none; }
  .mode span { display: none; }
  .mode { padding: 0 12px; }
}

@media (max-width: 900px) {
  .nav__links { display: none; }
  .nav__menu { display: block; }
  .nav__end .btn { display: none; }
  .nav__end .lang { display: none; }
  .split, .live { grid-template-columns: 1fr; }
  .split--rev .split__copy { order: 0; }
  .closeups { grid-template-columns: 1fr 1fr; }
  .closeup:first-child { grid-column: 1 / -1; }
  .how__steps { grid-template-columns: 1fr; }
  .privacy__list { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stat { display: grid; grid-template-columns: 120px 1fr; align-items: baseline; gap: 16px; border-left: 0; border-top: var(--hair) solid var(--vellum-3); padding: 14px 0 0; }
  .stat dd { margin: 0; }
  .footer__cols { grid-template-columns: 1fr 1fr; }
  .live__stage { max-width: 520px; width: 100%; margin: 0 auto; }

  /* App bar */
  .appbar { gap: 8px; padding: 0 8px; padding-top: env(safe-area-inset-top); }
  .appbar__word { display: none; }
  .modes { margin: 0 auto; }
  .lang--app { display: none; }
  .privacy-pill { padding: 5px 7px; }

  /* Studio becomes stage + strip + sheet */
  .studio { display: flex; flex-direction: column; }
  .studio .stage { flex: 1 1 auto; min-height: 0; }
  .studio .rail { order: 2; flex-direction: row; height: 52px; padding: 0 8px; border-right: 0; border-top: 1px solid var(--studio-line); overflow-x: auto; overflow-y: hidden; justify-content: flex-start; flex: none; gap: 0; }
  .studio .rail hr { width: 1px; height: 24px; border: 0; border-left: 1px solid var(--studio-line); margin: 0 6px; }
  .studio .rail .ibtn[aria-pressed='true']::before { left: 10px; right: 10px; top: auto; bottom: -6px; width: auto; height: 2px; }
  .sheet-tabs { order: 3; display: flex; flex: none; background: var(--studio-1); border-top: 1px solid var(--studio-line); }
  .sheet-tabs .tab { flex: 1; }
  .studio .panel { order: 4; flex: none; height: min(40dvh, 340px); border: 0; display: none; padding-bottom: env(safe-area-inset-bottom); }
  .studio[data-sheet='products'] .panel--left { display: flex; }
  .studio[data-sheet='shade'] .panel--right, .studio[data-sheet='brush'] .panel--right, .studio[data-sheet='layers'] .panel--right { display: flex; }
  .studio[data-sheet='shade'] .panel--right [data-sec]:not([data-sec='product']) { display: none; }
  .studio[data-sheet='brush'] .panel--right [data-sec]:not([data-sec='brush']) { display: none; }
  .studio[data-sheet='layers'] .panel--right [data-sec]:not([data-sec='layers']) { display: none; }
  .studio[data-sheet='none'] .panel { display: none; }
  .stage__bar { bottom: 10px; }
  .stage__actions { top: 12px; bottom: auto; right: 12px; }
  .stage__actions .tbtn { height: 30px; padding: 0 10px; }
  .stage__bar .hide-sm { display: none; }
  .live-controls { bottom: 12px; }
  .shutter { width: 60px; height: 60px; } .shutter::after { width: 47px; height: 47px; }

  .darkroom, .booth { display: flex; flex-direction: column; }
  .filmstrip, .tray { order: 0; display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; height: 96px; flex: none; border: 0; border-bottom: 1px solid var(--studio-line); padding: 8px; }
  .filmstrip .film, .tray .film, .filmstrip .add { width: 64px; flex: none; height: 80px; aspect-ratio: auto; }
  .dr-stage, .booth-stage { flex: 1 1 auto; padding: 14px; min-height: 180px; }
  .darkroom .panel, .booth .panel { flex: none; height: min(42dvh, 360px); border: 0; border-top: 1px solid var(--studio-line); padding-bottom: env(safe-area-inset-bottom); }
  .booth .panel { order: 3; }
  .booth .tray { order: 1; }
  .booth .booth-stage { order: 2; }
}

@media (max-width: 560px) {
  :root { --t-h1: clamp(3.1rem, 14.5vw, 5.4rem); }
  .hero { padding-top: 104px; gap: 36px; }
  .hero__ctas .btn { flex: 1 1 auto; justify-content: center; }
  .kit { grid-template-columns: 1fr; }
  .kit__col { border-right: 0 !important; padding-left: 0 !important; border-top: var(--hair) solid var(--vellum-3); }
  .closeups { grid-template-columns: 1fr; }
  .footer__cols { grid-template-columns: 1fr; }
  .modes .mode { padding: 0 10px; }
  .demo__tag { top: 10px; }
  .filters { grid-template-columns: repeat(4, 1fr); }
  .layouts { grid-template-columns: repeat(4, 1fr); }
}

/* Short landscape phones: keep the stage usable. */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .studio { display: grid; grid-template-columns: 48px minmax(0, 1fr) 300px; grid-template-rows: auto minmax(0, 1fr); }
  .studio .rail { order: 0; grid-row: 1 / -1; flex-direction: column; height: auto; border-top: 0; border-right: 1px solid var(--studio-line); overflow-y: auto; overflow-x: hidden; }
  .studio .stage { grid-row: 1 / -1; grid-column: 2; }
  .sheet-tabs { grid-column: 3; grid-row: 1; }
  .studio .panel { grid-column: 3; grid-row: 2; height: auto; }
}

/* Coarse pointers (touch): larger hit areas. */
@media (pointer: coarse) {
  .ibtn { width: 42px; height: 42px; }
  .ibtn--sm { width: 36px; height: 36px; }
  .shade { min-width: 34px; }
  .pitem { padding-block: 11px; }
  input[type='range'] { height: 30px; }
  input[type='range']::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -9px; }
  .film__del { opacity: 1; }
}

@media (hover: none) {
  .layer__actions { opacity: 1; }
}

/* Large screens */
@media (min-width: 1800px) {
  :root { --maxw: 1640px; }
  .studio { grid-template-columns: 56px 340px minmax(0, 1fr) 320px; }
}

@media print {
  .nav, .loader, .curtain, .toasts, .app { display: none !important; }
}
