/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE LAYER — loaded last on index.html.
   Only adds rules; styles.css, enhance.css, script.js and sakuga/ are untouched.
   Breakpoints: 360 · 480 · 620 · 768 · 1024 · 1280 · 1600, plus landscape-phone,
   touch (hover:none) and safe-area handling.
   ═══════════════════════════════════════════════════════════════════ */

:root{
  --gutter:clamp(16px,4.5vw,48px);
  --shell:min(1160px,calc(100% - (var(--gutter) * 2)));
  --section-y:clamp(64px,9vw,120px);
  --tap:44px;
  --safe-t:env(safe-area-inset-top,0px);
  --safe-r:env(safe-area-inset-right,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
  --safe-l:env(safe-area-inset-left,0px);
}

/* ───────── Foundations ───────── */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
html,body{max-width:100%;overflow-x:clip}
body{min-height:100vh;min-height:100dvh;-webkit-tap-highlight-color:transparent}
img,svg,video,canvas{max-width:100%}
/* decorative glows live in a clipped layer so they can never widen the layout viewport
   (on phones an overflowing glow made the fixed menu and modal wider than the screen) */
body{position:relative}
.glow-layer{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:0}
.glow-layer .page-glow{max-width:80vw;max-height:80vw}
/* portrait may rise above its box, but never sideways past the screen */
.portrait-stage{overflow-x:clip;overflow-y:visible}
.hero-art{max-width:100%}

/* fluid shell + section rhythm that scales between breakpoints */
.section-shell{width:var(--shell)}
.intro,.universe,.work,.creative,.brief{padding-block:var(--section-y)}
.principles{padding-block:calc(var(--section-y) * .8) var(--section-y)}
.contact{padding-bottom:var(--section-y)}

/* header respects notches and landscape cut-outs */
.site-header{
  padding-left:max(var(--gutter),var(--safe-l));
  padding-right:max(var(--gutter),var(--safe-r));
  padding-top:var(--safe-t);
  height:calc(76px + var(--safe-t));
}
.site-footer{padding-bottom:calc(28px + var(--safe-b))}

/* ───────── Touch targets (≥44px hit area, visuals unchanged) ───────── */
.icon-button,.menu-toggle{position:relative;min-width:36px;min-height:36px}
.icon-button::after,.menu-toggle::after,.modal-close::after,.mobile-menu-close::after{
  content:"";position:absolute;inset:50% auto auto 50%;width:var(--tap);height:var(--tap);transform:translate(-50%,-50%)
}
.nav-link,.text-link,.footer-credit,.creative-item,.mobile-menu>a{position:relative}
.nav-link{padding-block:12px}
.nav-link::after{bottom:4px}
.text-link{padding-block:14px 8px}
.filter-button{min-height:var(--tap)}
.footer-credit{display:inline-block;padding-block:12px}

/* ───────── Large desktop (≥1600) — use the extra room ───────── */
@media(min-width:1600px){
  :root{--shell:min(1320px,calc(100% - 160px))}
  .site-header{padding-inline:max(48px,calc((100vw - 1320px)/2))}
  .hero{min-height:780px;padding-top:128px}
  .hero-art{height:520px}
  .hero-lead{font-size:16px;max-width:560px}
  .brand-grid{gap:18px}
  .project-grid{gap:22px}
}
@media(min-width:1280px) and (max-width:1599px){
  :root{--shell:min(1200px,calc(100% - 96px))}
}

/* ───────── Small laptop / large tablet landscape (851–1024) ───────── */
@media(min-width:851px) and (max-width:1024px){
  .desktop-nav{gap:22px}
  .hero-grid{gap:24px}
  .brand-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
  .brand-word{font-size:clamp(40px,5.4vw,52px)}
  .project-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
  .intro{gap:6%}
}

/* ───────── Tablet portrait (621–850) ───────── */
@media(min-width:621px) and (max-width:850px){
  /* six nav links no longer fit comfortably — use the full-screen menu from here down */
  .desktop-nav{display:none}
  .menu-toggle{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:6px}
  .menu-toggle span+span{margin:0;width:13px}
  .hero{min-height:auto;padding-top:calc(88px + var(--safe-t));padding-bottom:70px}
  .hero-grid{grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);gap:20px}
  .hero h1{font-size:clamp(54px,9.4vw,72px)}
  .intro{display:block}
  .intro-content{padding-top:30px}
  .intro-bottom{gap:20px}
  .row-heading{gap:24px}
  .brand-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .brand-grid>.brand-card:last-child:nth-child(odd){grid-column:1/-1;min-height:380px}
  .brand-card{min-height:380px}
  .project-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .principle-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
  .creative-item{grid-template-columns:40px 1fr 1fr 20px;gap:14px}
  .contact-panel{padding:60px 7%}
}

/* ───────── Phones (≤620) ───────── */
@media(max-width:620px){
  .site-header{height:calc(65px + var(--safe-t))}
  .hero{padding-top:calc(75px + var(--safe-t))}
  .hero h1{font-size:clamp(46px,13.6vw,72px)}
  .hero-lead{font-size:clamp(13px,3.7vw,15px)}
  /* primary actions fill the width — easier to hit with a thumb */
  .hero-actions,.contact-actions{display:grid;grid-template-columns:1fr;gap:14px;padding-right:10px}
  .hero-actions>*,.contact-actions>*{width:100%}
  .brief-actions{display:grid;grid-template-columns:1fr;gap:14px;padding-right:10px}
  .brief-actions>*{width:100%}
  .hero-meta{flex-wrap:wrap;row-gap:6px}
  .section-heading h2{font-size:clamp(34px,10.4vw,46px)}
  .intro-statement{font-size:clamp(20px,5.9vw,24px)}
  .creative-item{padding-block:20px}
  .creative-desc{font-size:10.5px}
  .principle-grid p{font-size:12px}
  .brand-description,.project-info p,.contact-copy,.heading-note,.intro-bottom p{font-size:12.5px}
  .contact-panel{padding:44px clamp(18px,6vw,28px)}
  .contact-panel h2{font-size:clamp(38px,12.5vw,52px)}
  .site-footer{gap:12px 18px}
  /* project modal becomes a bottom sheet */
  .modal{place-items:end center;padding:0}
  .modal-card{width:100%;max-height:min(88vh,88dvh);overflow-y:auto;overscroll-behavior:contain;border-radius:16px 16px 0 0;padding:28px 22px calc(28px + var(--safe-b))}
  .modal-card h2{font-size:clamp(26px,8vw,32px);padding-right:34px}
  /* mobile menu */
  .mobile-menu{padding:calc(35px + var(--safe-t)) 28px calc(35px + var(--safe-b));overflow-y:auto;justify-content:flex-start;padding-top:calc(96px + var(--safe-t))}
  .mobile-menu>a{font-size:clamp(26px,8.4vw,34px);min-height:var(--tap);align-items:center}
  .mobile-menu-close{top:calc(20px + var(--safe-t));right:20px}
  .toast{bottom:calc(16px + var(--safe-b));max-width:calc(100vw - 24px)}
  sakuga-toast{bottom:calc(10px + var(--safe-b))}
}

/* very small phones (≤360) */
@media(max-width:360px){
  :root{--gutter:14px}
  .brand-copy{font-size:11px;letter-spacing:.08em}
  .brand-logo{width:34px;height:34px}
  .brand-word{font-size:clamp(40px,15vw,52px)}
  .project-visual{height:160px}
  .brief-card{padding:18px}
  .filter-button{font-size:9px;padding:8px}
  .hero-meta{font-size:7.5px}
}

/* ───────── Short landscape phones ───────── */
@media(max-height:480px) and (orientation:landscape){
  .site-header{height:calc(56px + var(--safe-t))}
  .hero{min-height:auto;padding-top:calc(76px + var(--safe-t));padding-bottom:48px}
  .hero-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);align-items:center;gap:24px}
  .hero h1{font-size:clamp(40px,8vw,60px);margin-bottom:16px}
  .hero-art,.portrait-stage{height:min(78vh,300px)}
  .hero-actions{grid-template-columns:repeat(2,auto);display:flex}
  .hero-actions>*{width:auto}
  .mobile-menu{padding-top:calc(70px + var(--safe-t))}
  .mobile-menu>a{font-size:24px;padding-block:8px}
  .modal{place-items:center;padding:12px}
  .modal-card{max-height:92vh;max-height:92dvh;overflow-y:auto;border-radius:10px}
  .intro-splash{overflow-y:auto}
}
@media(min-width:621px) and (max-height:480px) and (orientation:landscape){
  .desktop-nav{display:flex;gap:16px}
  .menu-toggle{display:none}
}

/* ───────── Modal scroll safety on every size ───────── */
.modal-card{max-height:calc(100dvh - 40px);overflow-y:auto;overscroll-behavior:contain}
.mobile-menu{overscroll-behavior:contain}

/* ───────── Touch devices: no sticky hover, no hover-only effects ───────── */
@media(hover:none){
  .brand-card:hover,.project-card:hover{--ty:0px;transform:perspective(900px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg))}
  .brand-card:hover::before,.project-card:hover::before{opacity:0}
  .creative-item:hover{padding-left:5px;color:inherit}
  .nav-link::after{display:none}
  .filter-button:hover{background:transparent;border-color:var(--line);color:var(--muted)}
  .filter-button.active:hover{background:rgba(168,85,247,.15);border-color:rgba(168,85,247,.55);color:var(--text)}
}
@media(hover:none) and (pointer:coarse){
  .field-checks{gap:14px 22px}
  .field sakuga-input,.field sakuga-slider{max-width:100%}
}

/* inputs must stay ≥16px on iOS or Safari zooms the page on focus */
@media(max-width:620px){
  input,textarea,select{font-size:16px}
}

/* long words / emails never push the layout */
.brief-preview,.contact-copy,.modal-card p,.creative-desc,.heading-note{overflow-wrap:anywhere}

/* ───────── Print ───────── */
@media print{
  .noise,.page-glow,#fx-canvas,.intro-splash,.site-header,.mobile-menu,.scroll-bar,.toast,sakuga-toast{display:none!important}
  body{background:#fff;color:#000}
  .reveal{opacity:1!important}
}
