/* ==========================================================
   Mobile app layer (≤ 768px)
   Turns the site into an app-like shell: bottom tab bar, bottom
   sheet, inset-grouped lists, swipe carousels, tap feedback.
   ========================================================== */

.tabbar, .sheet { display: none; }

@media (max-width: 768px) {
  :root {
    --tabbar-h: 64px;
    --section-y: 3.5rem;
    --gutter: 1.125rem;
    --fs-2xl: clamp(1.85rem, 1.4rem + 2.4vw, 2.3rem);
    --fs-3xl: clamp(2.4rem, 1.8rem + 3.6vw, 3rem);
    --fs-xl: 1.45rem;
    --fs-lg: 1.15rem;
    --fs-md: 1.05rem;
  }

  html { scroll-padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px); }
  body {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
  }
  .sheet-open { overflow: hidden; }

  /* ---------- Top app bar ---------- */
  .site-header { background: var(--surface-glass); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%); border-bottom-color: var(--border); }
  .site-header__inner { height: var(--header-h); }
  .menu-toggle, .theme-toggle, .header-cta { display: none !important; }
  .lang-toggle { width: 38px; height: 38px; }
  .brand__en { display: inline; font-size: 0.95rem; }

  /* ---------- Bottom tab bar ---------- */
  .tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 110;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 6px 6px env(safe-area-inset-bottom, 0px);
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    backdrop-filter: blur(20px) saturate(150%);
    border-top: 1px solid var(--border);
  }
  .tabbar__item {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 52px;
    color: var(--text-muted);
    font-size: 0.6875rem;
    line-height: 1.2;
    border-radius: var(--radius-sm);
    transition: color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }
  .tabbar__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 30px;
    border-radius: var(--radius-pill);
    transition: background-color var(--dur-base) var(--ease-out);
  }
  .tabbar__icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .tabbar__item.is-active { color: var(--accent-strong); }
  .tabbar__item.is-active .tabbar__icon { background: var(--accent-soft); }
  .tabbar__item:active { transform: scale(0.92); }

  /* ---------- Bottom sheet ---------- */
  .sheet { display: block; position: fixed; inset: 0; z-index: 150; }
  .sheet[hidden] { display: none; }
  .sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 14, 16, 0.55);
    opacity: 0;
    transition: opacity 380ms var(--ease-out);
  }
  .sheet__panel {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    max-height: 88vh;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-top: 1px solid var(--border);
    box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 420ms var(--ease-out);
    outline: none;
  }
  .sheet.is-open .sheet__backdrop { opacity: 1; }
  .sheet.is-open .sheet__panel { transform: translateY(0); }
  .sheet__panel.is-dragging { transition: none; }

  .sheet__handle { padding: 10px var(--gutter) 6px; touch-action: none; cursor: grab; }
  .sheet__grabber { display: block; width: 38px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: var(--border-strong); }
  .sheet__top { display: flex; align-items: center; justify-content: space-between; }
  .sheet__title { font-size: var(--fs-lg); font-weight: 500; }
  .sheet__close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-strong);
  }
  .sheet__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

  .sheet__body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-2) var(--gutter) calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }
  .sheet__group-label { font-size: var(--fs-xs); color: var(--text-muted); margin: var(--space-4) var(--space-4) var(--space-2); }
  .sheet__group { background: var(--surface-strong); border-radius: var(--radius-md); overflow: hidden; }
  .sheet__group li + li .sheet__row { border-top: 1px solid var(--border); }
  .sheet__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 54px;
    padding: 0 var(--space-4);
    font-size: var(--fs-base);
    text-align: start;
    transition: background-color var(--dur-fast);
  }
  .sheet__row:active { background: var(--surface-strong); }
  .sheet__value { color: var(--text-muted); font-size: var(--fs-sm); }
  .sheet__chev { width: 18px; height: 18px; fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  [dir="ltr"] .sheet__chev { transform: scaleX(-1); }
  .sheet__cta { width: 100%; margin-top: var(--space-6); }

  /* ---------- Tap feedback (replaces hover) ---------- */
  .btn:active, .value-node__btn:active, .service-card__link:active, .support-case:active, .pillar:active { transform: scale(0.97); }
  .btn, .value-node__btn, .service-card__link, .support-case, .pillar { transition-property: transform, background-color, border-color, color; transition-duration: var(--dur-fast); }

  /* ---------- Shared: section headers ---------- */
  .display { max-width: none; line-height: 1.22; }
  .lead { font-size: var(--fs-base); line-height: 1.8; }
  .about__head { margin-bottom: var(--space-5); }
  .ops__head, .start__head, .support__head { margin-bottom: var(--space-5); }

  /* ---------- Hero: app home screen ---------- */
  .hero { padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + var(--space-5)); padding-bottom: var(--space-7); }
  .hero__inner { gap: var(--space-6); }
  .hero__visual { order: -1; width: 100%; margin: 0; justify-self: stretch; }
  .hero__photo { aspect-ratio: 4 / 3; clip-path: none; border-radius: var(--radius-lg); overflow: hidden; }
  .js .hero__photo, .is-loaded .hero__photo { clip-path: inset(0 round var(--radius-lg)); }
  .hero__emblem { width: 21%; inset-inline-start: auto; inset-inline-end: 5%; bottom: -9%; }
  .hero__caption { display: none; }
  .hero__kicker { margin-bottom: var(--space-3); }
  .hero__lede { margin-top: var(--space-4); }
  .hero__actions { margin-top: var(--space-5); flex-direction: column; align-items: stretch; }
  .hero__links { display: none; }

  /* ---------- Swipe carousels ---------- */
  .pillars, .support__grid, .start__steps {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--space-1) var(--gutter) var(--space-3);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .pillars::-webkit-scrollbar, .support__grid::-webkit-scrollbar, .start__steps::-webkit-scrollbar { display: none; }
  .pillars > *, .support__grid > *, .start__steps > * {
    flex: 0 0 78%;
    scroll-snap-align: start;
  }
  .pillar {
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
  }
  .pillar::before { display: none; }
  .vision { margin-top: var(--space-8); padding-top: var(--space-6); }
  .vision__quote { font-size: var(--fs-xl); max-width: none; }
  .pillars { margin-top: var(--space-6); }

  .start-step {
    display: grid;
    grid-template-columns: 1fr;
    padding: var(--space-5);
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
  }
  .start-step__num { grid-row: auto; width: 44px; height: 44px; margin-bottom: var(--space-2); }

  /* ---------- About ---------- */
  .about__grid { gap: var(--space-6); }
  .about__story .lead { font-size: var(--fs-md); }
  .about__traits { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .about__traits::-webkit-scrollbar { display: none; }
  .trait { flex-shrink: 0; }
  .about__company { padding: var(--space-6) var(--space-5); border-radius: var(--radius-md); }

  /* ---------- Values: segmented chips + live card ---------- */
  .values__intro { display: contents; }
  .values__layout { gap: var(--space-4); }
  .values-readout { order: 3; }
  .values-map { order: 2; }
  .values-readout, .values__hint { display: block; }
  .values__hint { margin-top: var(--space-2); }
  .values-readout { margin-top: 0; min-height: 8.5rem; padding: var(--space-5); }
  .values-map { gap: var(--space-4); }
  .values-map__core { width: 108px; }
  .values-map__nodes {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--space-1) var(--gutter);
    scroll-snap-type: x proximity;
  }
  .values-map__nodes::-webkit-scrollbar { display: none; }
  .value-node { padding: 0; border: 0; background: none; flex-shrink: 0; scroll-snap-align: start; }
  .values-map .value-node__btn {
    pointer-events: auto;
    padding: 0.55rem 1.1rem;
    font-size: var(--fs-sm);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    background: var(--surface);
  }
  .values-map .value-node__btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .values-map .value-node--approach .value-node__btn { border-style: dashed; }
  .value-node__desc { display: none; }

  /* ---------- Inset-grouped lists (audience, contexts, quality) ---------- */
  .audience__layout { gap: var(--space-5); }
  .audience__photo { border-radius: var(--radius-md); aspect-ratio: 16 / 9; }
  .audience__list, .contexts__list, .quality__table tbody {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .audience__list li, .context-row, .quality__table tbody tr {
    padding: var(--space-4) var(--space-5);
    border: 0;
    border-top: 1px solid var(--border);
  }
  .audience__list li:first-child, .context-row:first-child, .quality__table tbody tr:first-child { border-top: 0; }
  .audience__list li:last-child, .context-row:last-child { border-bottom: 0; }
  .audience__list h3, .context-row h3 { font-size: var(--fs-md); font-weight: 400; padding: 0; }
  .audience__list p, .context-row p { font-size: var(--fs-sm); }
  .audience__list li:hover h3 { transform: none; color: inherit; }
  .context-row::before { display: none; }
  .contexts__head { margin-bottom: var(--space-5); }
  .quality { margin-top: var(--space-8); gap: var(--space-4); }
  .quality__table tbody th { font-size: var(--fs-base); }
  .quality__table td { font-size: var(--fs-sm); }

  /* ---------- Journey: compact stepper ---------- */
  .journey__layout { gap: var(--space-5); }
  .timeline { gap: var(--space-3); }
  .step__body { padding: var(--space-4); }
  .step__title { font-size: var(--fs-md); margin-bottom: var(--space-1); }
  .step__body p { font-size: var(--fs-sm); }

  /* ---------- Services: swipe cards ---------- */
  .services__pin { gap: var(--space-5); }
  .services__track { gap: var(--space-3); padding-inline: var(--gutter); }
  .services__viewport { scroll-padding-inline: var(--gutter); }
  .service-card { width: 82vw; scroll-snap-align: start; }
  .service-card__link { border-radius: var(--radius-md); }
  .service-card__title { font-size: var(--fs-lg); }

  /* ---------- Operations ---------- */
  .bento__tile { border-radius: var(--radius-md); padding: var(--space-5); }
  .bento__tile--point { border-radius: var(--radius-md); }
  .bento__tile--point .bento__text { padding: var(--space-5); }
  .bento__tile--ready, .bento__tile--org { grid-column: span 6; }
  .bento { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .bento__tile--point, .bento__tile--platform { grid-column: 1 / -1; }
  .bento__art--ring { width: 64px; height: 64px; }
  .bento__tile--org .bento__art { max-height: 70px; }
  .support { margin-top: var(--space-8); }
  .support-case { border-radius: var(--radius-md); background: var(--surface); }

  /* ---------- Contact: action list ---------- */
  .contact { padding-block: var(--space-8); }
  .contact__inner { gap: var(--space-5); }
  .contact__title { font-size: var(--fs-2xl); max-width: none; }
  .contact__details {
    gap: 0;
    padding: 0;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .contact__details > div { padding: var(--space-4) var(--space-5); }
  .contact__details > div + div { border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .contact__details dd { font-size: var(--fs-base); }

  .site-footer { padding-bottom: var(--space-5); }
}

/* Small tablets keep the hamburger menu; phones use the tab bar instead. */
@media (min-width: 769px) {
  .tabbar, .sheet { display: none !important; }
}

/* Installed as an app (home-screen / standalone) */
@media (display-mode: standalone) and (max-width: 768px) {
  .site-header { padding-top: env(safe-area-inset-top, 0px); }
  .site-footer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet__panel, .sheet__backdrop { transition: none; }
}
