:root{
  --bg1:#0b7b8a;
  --bg2:#0a6776;
  --bg3:#0a5162;
  --accent:#ff7a3b;

  --white:#ffffff;
  --muted: rgba(255,255,255,.78);

  --pill:#f3f6f7;
  --pillText:#a9b3b8;

  --tileStroke: rgba(255,255,255,.18);
  --shadow: 0 10px 30px rgba(0,0,0,.18);
}

*{ box-sizing:border-box; }
html, body{
  height:100%;
  overflow:hidden;   /* HARD STOP global scroll */
  overscroll-behavior: none;
  touch-action: manipulation;
}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--white);
  background:#061a1f;
}

/* =========================
   SCREEN + BACKGROUND
========================= */
.screen{
  width:100%;
  max-width:420px;
  min-height:100svh;
  margin:0 auto;
  position:relative;
  overflow:hidden;
  height:100svh; /* helps consistent transitions */
}

/* Gradient overlay behind hero (keeps your look) */
.bg{
  position:absolute;
  inset:0;
  background:
    radial-gradient(110% 55% at 35% -10%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 42%, var(--bg3) 70%, #0b4f5f 100%);
  z-index:0;
  pointer-events:none;
}

/* Global hero background behind BOTH pages */
.hero-bg{
  position:absolute;
  inset:0;
  z-index:0;
  overflow:hidden;
  pointer-events:none;
}

.hero-bg img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  display:block;
  opacity:0.95;
}

/* =========================
   PAGES BASE
========================= */
.page{
  position:absolute;
  inset:0;
  z-index:2;
  transition: opacity .35s ease;
}

/* Default visibility */
.page.page1{ opacity:1; pointer-events:auto; }
.page.page2{ opacity:0; pointer-events:none; }

/* =========================
   PAGE 1 (HOME)
========================= */
.page1{
  display:flex;
  flex-direction:column;
  min-height:100svh;
}

/* Top content area */
.top{
  position:relative;
  z-index:1;
  padding: clamp(18px, 4.2vw, 24px) clamp(16px, 4.2vw, 22px) 14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;

  /* used for transition-out */
  transform: translateY(0);
  opacity: 1;
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}

/* Logo */
.logo-wrap{
  width:170px;
  height:120px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.logo{
  width:120px;
  height:120px;
  object-fit:contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.18));
}

/* Headline */
.headline{
  width:100%;
  text-align:center;
  padding: 12px 12px 10px;
}

.headline h1{
  margin:0;
  line-height:1.02;
  letter-spacing:.5px;
  text-transform:uppercase;
}

.headline .thin{
  font-weight:700;
  font-size: clamp(18px, 5.0vw, 22px);
}

.headline .bold{
  font-weight:900;
  font-size: clamp(34px, 9.6vw, 44px);
}

.headline p{
  margin:8px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing:.2px;
}

/* =========================
   CTA PILL
========================= */
.pill{
  width:100%;
  max-width:320px;
  height:44px;
  border-radius:999px;
  background: var(--pill);
  color: var(--pillText);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding: 0 14px;
  text-decoration:none;
  box-shadow: var(--shadow);

  position:relative;
  overflow:hidden;
  user-select:none;
  touch-action: pan-y;
}

.pill-icon{
  width:18px;
  height:18px;
  display:block;
  color:#fff;
}

.pill-text{
  position:relative;
  z-index:2;
  font-weight:800;
  letter-spacing:1.8px;
  font-size:11px;
  text-transform:uppercase;
}

/* Optional swipe visuals (if your JS uses them) */
.pill-fill{
  position:absolute;
  inset:0;
  width:0%;
  background: rgba(255, 122, 59, 0.18);
  pointer-events:none;
}

.pill-handle{
  position:absolute;
  left:6px;
  top:50%;
  transform: translate(0, -50%);
  width:34px;
  height:34px;
  border-radius:999px;
  background: var(--accent);
  color:#fff;
  display:grid;
  place-items:center;
  pointer-events:none;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
}

/* =========================
   ACTION TILES
========================= */
.actions{
  width:100%;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:14px;
  margin-top:2px;
}

.action{
  height:84px;
  border-radius:12px;
  background: rgba(10, 90, 105, .55);
  border: 1px solid var(--tileStroke);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color: var(--white);
  gap:8px;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.action:active{ transform: translateY(1px); }

.action-icon{
  width:36px;
  height:36px;
  border-radius:10px;
  display:grid;
  place-items:center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
}

.action-label{
  font-size:10px;
  font-weight:800;
  letter-spacing:.7px;
  opacity:.95;
  text-transform:uppercase;
  text-align:center;
  padding:0 6px;
}

/* =========================
   PAGE 2 (MENU)
========================= */
.page2{
  position:relative;
  overflow:hidden;
  height: 100svh;
}

/* the actual menu layout */
.menu-shell{
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  padding: 18px;
  gap: 14px;
  box-sizing: border-box;
  z-index: 2;

  /* transition-in baseline */
  transform: translateY(14px);
  opacity: 0;
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}

/* LEFT RAIL */
.menu-rail{
  width: 92px;
  border-radius: 22px;
  background: rgba(255, 122, 59, 0.85);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 12px 10px;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  transform: translateX(-28px);
  opacity: 0;
  transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}

.menu-rail .back-btn{
  width: 100%;
  border-radius: 14px;
  padding: 10px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-weight: 900;
}

/* categories */
.cat{
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  padding: 0;
}

.cat-ico{
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.45);
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
  background: rgba(255,255,255,0.08);
  font-size: 22px;
}

.cat-lbl{
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 900;
  opacity: 0.95;
}

.cat.active .cat-ico{
  background: rgba(255,255,255,0.95);
  color: #ff7a3b;
  border-color: rgba(255,255,255,0.95);
}

.cat.active .cat-lbl{
  color: #fff;
}

/* RIGHT PANE */
.menu-pane{
  flex: 1;
  border-radius: 26px;
  background: rgba(51, 182, 196, 0.88);
  border: 1px solid rgba(255,255,255,0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;

  transform: translateX(28px);
  opacity: 0;
  transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}

.menu-pane-head{
  padding: 14px 16px 10px;
}

.menu-title{
  margin: 0;
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* SCROLL AREA */
.menu-scroll{
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================
   SUBCATEGORY PILLS (STICKY)
========================= */
.subcat-pills{
  position: sticky;
  top: 0;
  z-index: 5;

  display:flex;
  gap:10px;
  overflow-x:auto;
  padding:10px 6px 12px;
  margin:0 0 6px;

  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;

  background: rgba(0,0,0,.10);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.subcat-pills::-webkit-scrollbar{ display:none; }

.subcat-pill{
  appearance:none;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(0,0,0,.22);
  color:#fff;
  padding:10px 14px;
  border-radius:999px;
  font-weight:900;
  letter-spacing:.02em;
  white-space:nowrap;
  cursor:pointer;
}
.subcat-pill.active{
  background:var(--accent, #ff7a3b);
  border-color:transparent;
}

/* =========================
   ITEM CARD (FINAL: IMAGE TOP + TITLE + PRICES)
========================= */
.item-card{
  background: rgba(255,255,255,0.92);
  color: #0b2024;
  border-radius: 26px;
  padding: 14px;
  margin: 8px 0px;
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;

  display:flex;
  flex-direction:column;
  gap: 10px;
}

/* square image area on top */
.item-thumb{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(0,0,0,0.06);
}

/* image fills the square */
.item-thumb img,
.item-img-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* text block below */
.item-info{
  text-align:center;
}

.item-name{
  font-weight: 1000;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-size: 18px;
  line-height: 1.15;
  margin: 0;
}

.item-desc{
  font-size: 11px;
  opacity: 0.78;
  line-height: 1.35;
  margin: 6px 0 10px;
  text-align: center;
}

/* prices row (same as your original) */
.item-prices{
  display: flex;
  justify-content: center;
  gap: 18px;
  font-weight: 1000;
  color: #159aa7;
}

.item-prices small{
  display: block;
  font-size: 10px;
  letter-spacing: 0.4px;
  opacity: 0.8;
  text-align: center;
}

/* =========================
   PAGE SWITCH: MENU OPEN STATE
========================= */
.screen.menu-open .page.page1{
  opacity: 0;
  pointer-events: none;
}

.screen.menu-open .page.page2{
  opacity: 1;
  pointer-events: auto;
}

/* Page1 elements animate out */
.screen.menu-open .page1 .top{
  transform: translateY(-16px);
  opacity: 0;
}

/* Page2 elements animate in */
.screen.menu-open .page2 .menu-shell{
  transform: translateY(0);
  opacity: 1;
}

.screen.menu-open .page2 .menu-rail{
  transform: translateX(0);
  opacity: 1;
}

.screen.menu-open .page2 .menu-pane{
  transform: translateX(0);
  opacity: 1;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .page,
  .top,
  .menu-shell,
  .menu-rail,
  .menu-pane{
    transition:none !important;
    transform:none !important;
  }
}

/* Blur background when menu is open */
.screen.menu-open .hero-bg img{
  filter: blur(10px);
  transform: scale(1.03); /* prevents blur edges */
  opacity: 0.9;
  transition: filter .35s ease, transform .35s ease, opacity .35s ease;
}

/* Smooth transition back */
.hero-bg img{
  transition: filter .35s ease, transform .35s ease, opacity .35s ease;
}

/* ===== CONFIGURATOR (PASTA) LAYOUT ===== */
.config-wrap{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.config-section{
  background: rgba(255,255,255,0.92);
  border-radius: 26px;
  padding: 14px;
  color:#0b2024;
  border: 1px solid rgba(0,0,0,0.06);
}

.config-title{
  margin: 0 0 10px;
  text-transform: uppercase;
  font-weight: 1000;
  letter-spacing: .4px;
  font-size: 14px;
  text-align:center;
}

.config-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}

.config-opt{
  border: 2px solid rgba(21,154,167,0.22);
  background: rgba(21,154,167,0.08);
  border-radius: 18px;
  padding: 10px;
  text-align:center;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .3px;
  font-size: 12px;
  color:#0b2024;
  cursor:pointer;
  user-select:none;
}

.config-opt-img{
  width: 100%;
  height: 72px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin-bottom: 8px;
}

.config-opt small{
  display:block;
  margin-top:4px;
  font-weight: 900;
  font-size: 11px;
  color:#159aa7;
  opacity:.95;
}

.config-opt.active{
  background: rgba(21,154,167,0.18);
  border-color: rgba(21,154,167,0.65);
}

/* optional price bar like your reference */
.config-footer{
  position: sticky;
  bottom: 0;
  margin-top: 10px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.06);
  color:#0b2024;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

.config-total{
  font-weight: 1000;
  letter-spacing:.3px;
  text-transform: uppercase;
}

.config-cta{
  border:0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #159aa7;
  color:#fff;
  font-weight: 1000;
  letter-spacing:.3px;
  text-transform: uppercase;
}

/* =========================
   SAFE AREA (iPhone notch / browser bars)
========================= */
:root{
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* keep the whole UI inside safe area */
.screen{
  padding-top: var(--sat);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
}

/* make sure inner shells still fit after safe padding */
.page1{ min-height: calc(100svh - var(--sat) - var(--sab)); }
.page2{ height: calc(100svh - var(--sat) - var(--sab)); }

/* optional: give menu shell correct breathing room */
.menu-shell{
  height: 100%;
  padding-top: calc(18px + var(--sat));
  padding-bottom: calc(18px + var(--sab));
  padding-left: calc(18px + var(--sal));
  padding-right: calc(18px + var(--sar));
}

/* =========================
   iOS SCROLL FIXES (rail + right pane)
========================= */

/* your global touch-action can interfere with nested scrolling on iOS */
html, body{
  touch-action: auto; /* override your current manipulation setting */
}

/* allow vertical panning inside scroll areas */
.menu-rail,
.menu-scroll{
  touch-action: pan-y;
}

/* critical: ensure flex children can actually scroll */
.menu-pane{ min-height: 0; }
.menu-scroll{ min-height: 0; }

/* optional nicer scroll feel */
.menu-rail, .menu-scroll{
  overscroll-behavior: contain;
}

/* =========================
   PANELS + PREWARM
========================= */
.cat-panel{
  gap: 10px;
  display:block;
}

/* Prewarm panels: keep in DOM/render tree so images load+decode, but not visible */
.cat-panel.prewarm{
  position: absolute;
  left: -99999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* =========================
   MODAL
========================= */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
}

.modal-overlay.open{ display: flex; }

.modal{
  width: min(720px, 100%);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(16px);
}

.modal-top{
  position: relative;
}

.modal-img{
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.modal-close{
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.modal-body{
  padding: 14px 16px 16px;
}

.modal-title{
  font-weight: 1100;
  font-size: 18px;
  margin: 2px 0 6px;
}

.modal-desc{
  opacity: .9;
  line-height: 1.35;
  margin: 0 0 12px;
}

.modal-prices{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-prices .price-pill{
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  font-weight: 1000;
}

.modal-prices .price-pill small{
  font-weight: 900;
  opacity: .9;
  letter-spacing: .4px;
}

/* =========================
   TEXT WEIGHT + OVERFLOW CONTROL (DROP-IN OVERRIDES)
========================= */

/* 1) Item title: regular + centered */
.item-name{
  text-align: center !important;
  text-transform: uppercase;        /* keep your current style */
  letter-spacing: 0.4px;
}

/* 1) Config option label: regular */
.config-opt{
  font-weight: 600;                /* button itself can stay semi-bold for tap feel */
}
.config-opt .config-opt-txt{
  font-weight: 500 !important;     /* regular label */
}

/* If your config label is just in a <div class="config-opt-txt"> */
.config-opt-txt{
  font-weight: 500 !important;
}

/* 2) Prevent overflow in cards (title + description + prices) */
.item-card,
.config-opt,
.config-section{
  overflow: hidden; /* safety */
}

/* Title: clamp to 2 lines, wrap nicely, no overflow */
.item-name{
  display: block;          /* remove -webkit-box */
  overflow: hidden;

  /* wrap ONLY on spaces */
  white-space: normal;
  word-break: keep-all;    /* critical: prevents mid-word breaks */
  overflow-wrap: normal;   /* no forced breaking */
  hyphens: none;           /* no hyphen insertion */

  line-height: 1.15;
  text-align: center;
}


/* Config option text: clamp to 2 lines, wrap safely */
.config-opt-txt{
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  line-height: 1.15;
}

/* Also protect category labels in the rail */
.cat-lbl{
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;

  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Prevent long price text from pushing layout */
.item-prices span{
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Config option label: fixed area so fitText can size reliably */
.config-opt-txt{
  line-height: 1.15;
  min-height: 2.3em;   /* roughly 2 lines space */
  overflow: hidden;    /* prevents spill during shrink */
}
