/* JamiGO Apple-design foundations — forest materials, type, press, a11y.
   Never share SPEDALIS apple-design.css (cream/terracotta). SPEDALIS ≠ JamiGO. */

:root {
  /* Materials — translucent functional layers (WWDC: hierarchy via weight) */
  --jg-glass: rgba(244, 248, 236, 0.72);
  --jg-glass-heavy: rgba(244, 248, 236, 0.88);
  --jg-glass-dark: rgba(11, 15, 20, 0.82);
  --jg-glass-chip: linear-gradient(160deg, #ffffffb8, #ffffff78);
  --jg-apple-hairline: rgba(255, 255, 255, 0.55);
  --jg-apple-edge: rgba(8, 56, 32, 0.12);
  --jg-blur: blur(16px) saturate(170%);
  --jg-blur-soft: blur(14px) saturate(160%);
  --jg-scrim: rgba(6, 26, 16, 0.42);
  --jg-shadow-chrome: 0 12px 38px rgba(6, 26, 16, 0.18);
  --jg-shadow-sheet: 0 -12px 48px rgba(6, 26, 16, 0.22);

  /* Press — feedback on pointer-down, ≤120ms */
  --jg-apple-press: 100ms;
  --jg-apple-press-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --jg-apple-press-scale: 0.97;
  --jg-apple-press-primary: 0.95;
  --jg-apple-press-go: 0.92;

  /* Type — size-specific tracking (never one letter-spacing for all sizes) */
  --jg-tracking-display: -0.045em;
  --jg-tracking-title: -0.03em;
  --jg-tracking-body: 0;
  --jg-tracking-caption: 0.01em;
  --jg-leading-display: 0.94;
  --jg-leading-title: 1.1;
  --jg-leading-body: 1.5;

  /* Spring response hints (JS reads these when present) */
  --jg-spring-response: 0.36s;
  --jg-spring-bounce: 0;
  --jg-spring-bounce-throw: 0.18;
}

html[data-jg-tone="dark"],
html[data-theme="dark"] {
  --jg-glass: rgba(12, 40, 24, 0.78);
  --jg-glass-heavy: rgba(12, 40, 24, 0.92);
  --jg-apple-edge: rgba(216, 232, 192, 0.14);
  --jg-apple-hairline: rgba(216, 232, 192, 0.22);
  --jg-shadow-chrome: 0 12px 38px rgba(0, 0, 0, 0.45);
  --jg-shadow-sheet: 0 -12px 48px rgba(0, 0, 0, 0.4);
}

/* Optical sizing where the face supports it */
h1,
h2,
h3,
.jg-brand-mark,
.jg-gate h1,
.jg-sheet-body h1,
.jo-top h1,
.jp-brand strong {
  font-optical-sizing: auto;
}

h1 {
  letter-spacing: var(--jg-tracking-display);
  line-height: var(--jg-leading-display);
}
h2 {
  letter-spacing: var(--jg-tracking-title);
  line-height: var(--jg-leading-title);
}
h3 {
  letter-spacing: var(--jg-tracking-title);
}

/* Instant press — transform on :active, ≤120ms */
.jg-btn:active,
.jg-btn-google:active,
.jg-tab:active,
.jg-map-fab:active,
.jg-map-go:active,
.jg-home-btn:active,
.jg-icon-btn:active,
.jg-offer-accept:active,
.jg-offer-decline:active,
.jg-online-bar-icon:active,
.jg-account-row:active,
.jg-earn-row:active,
.jg-choice:active,
.jg-nav-exit:active,
.jg-today-chip:active,
.jg-status-chip:active,
.jg-privacy-chip:active,
.jo-rail-btn:active,
.jo-card:active,
.jo-accept:active,
.jo-menu-btn:active,
.jp-nav button:active,
.jg-cta:active,
.jg-link-btn:active,
.jg-qty button:active,
.jg-chip:active,
.jg-featured-add:active,
.jg-addon:active,
.jg-heart:active,
.jg-fav:active {
  transition-property: transform;
  transition-duration: var(--jg-apple-press);
  transition-timing-function: var(--jg-apple-press-ease);
}

.jg-map-go:active {
  transform: translate(-50%, calc(-1 * var(--jg-tabbar, 64px))) scale(var(--jg-apple-press-go));
}
.jg-map-shell.is-peek .jg-map-go:active {
  transform: translate(-50%, 0) scale(var(--jg-apple-press-go));
}

.jg-offer-accept:active,
.jg-btn.jg-btn-primary:active {
  transform: scale(var(--jg-apple-press-primary));
}

.jg-map-fab:active,
.jg-home-btn:active,
.jg-icon-btn:active,
.jg-offer-decline:active,
.jg-online-bar-icon:active,
.jg-tab:active,
.jo-rail-btn:active,
.jp-nav button:active {
  transform: scale(var(--jg-apple-press-scale));
}

/* Frosted chrome — tab bars / sticky headers / floating bars */
.jg-chrome {
  background: var(--jg-glass);
  border: 1px solid var(--jg-apple-edge);
  box-shadow: var(--jg-shadow-chrome);
  backdrop-filter: var(--jg-blur);
  -webkit-backdrop-filter: var(--jg-blur);
}

.jg-chrome--heavy {
  background: var(--jg-glass-heavy);
}

.jg-chrome--dark {
  background: var(--jg-glass-dark);
  border-color: rgba(255, 255, 255, 0.08);
  color: #f4f8ec;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

/* Scroll-edge mask instead of a hard divider under sticky chrome */
.jg-scroll-edge {
  border-bottom: 0;
  box-shadow:
    0 1px 0 var(--jg-apple-hairline),
    0 12px 24px -16px rgba(6, 26, 16, 0.16);
}

/* Modal scrim — dim to focus */
.jg-scrim {
  background: var(--jg-scrim);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

@media (prefers-reduced-transparency: reduce) {
  :root {
    --jg-glass: #f4f8ec;
    --jg-glass-heavy: #f4f8ec;
    --jg-glass-dark: #0b0f14;
    --jg-blur: none;
    --jg-blur-soft: none;
  }
  .jg-chrome,
  .jg-chrome--heavy,
  .jg-chrome--dark,
  .jg-tabbar,
  .jg-online-bar,
  .jg-offline-bar,
  .jo-top,
  .jp-side {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .jg-chrome,
  .jg-chrome--heavy {
    background: #f4f8ec !important;
  }
  .jg-chrome--dark {
    background: #0b0f14 !important;
  }
}

@media (prefers-contrast: more) {
  .jg-chrome,
  .jg-chrome--heavy,
  .jg-tabbar,
  .jg-online-bar {
    background: #f4f8ec;
    border-color: #083820;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .jg-chrome--dark {
    background: #061a10;
    border-color: #d8e8c0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jg-btn:active,
  .jg-map-fab:active,
  .jg-home-btn:active,
  .jg-icon-btn:active,
  .jg-offer-accept:active,
  .jg-offer-decline:active,
  .jg-tab:active,
  .jo-rail-btn:active,
  .jp-nav button:active {
    transform: none;
    opacity: 0.85;
  }
  .jg-map-go:active {
    /* Keep centering translate; drop press scale travel. */
    transform: translate(-50%, calc(-1 * var(--jg-tabbar, 64px)));
    opacity: 0.85;
  }
  .jg-map-shell.is-peek .jg-map-go:active {
    transform: translate(-50%, 0);
    opacity: 0.85;
  }
  .jg-sheet,
  .jg-offer-card,
  .jg-offer-overlay {
    animation: none !important;
    transition: opacity 200ms ease !important;
  }
}

/* Customer app: small controls that had no press response */
.jg-qty button:active { transform: scale(0.95); }
.jg-chip:active,
.jg-featured-add:active,
.jg-addon:active,
.jg-heart:active,
.jg-fav:active { transform: scale(var(--jg-apple-press-scale)); }
