/* ============================================================
   defrancesco.io design system — shared across all pages

   Deliverables from the Apple-design audit (Oct 2026):
     1. Accessibility: respects prefers-reduced-motion / -transparency / -contrast
     2. Press feedback: every tappable class name gets :active
     3. Touch baseline: touch-action manipulation (kills 300ms tap delay)
     4. Material tokens: shared glass / line / blur vocabulary
     5. Reusable keyframes: ding, shake, dot pulse, materialize
     6. Pointer-event friendly: compositor-only transitions by default

   To use on any page: <link rel="stylesheet" href="/css/defrancesco-system.css">
   For haptics:         <script defer src="/js/defrancesco-haptics.js"></script>
   ============================================================ */


/* ───────── 1. Material tokens ───────── */
:root {
  --df-glass: rgba(22, 24, 30, 0.62);
  --df-glass-strong: rgba(18, 20, 26, 0.9);
  --df-glass-light: rgba(255, 255, 255, 0.62);
  --df-line: rgba(255, 255, 255, 0.14);
  --df-line-dark: rgba(0, 0, 0, 0.14);
  --df-ink: #f7f3ea;
  --df-ink-dim: rgba(247, 243, 234, 0.72);
  --df-blur-sm: blur(8px);
  --df-blur-md: blur(14px);
  --df-blur-lg: blur(20px) saturate(180%);
  --df-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --df-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --df-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* subtle overshoot */
  --df-press-scale: 0.97;
}

/* Optical sizing wherever the font supports it — one line, visible everywhere */
html { font-optical-sizing: auto; }


/* ───────── 2. Touch & tap baseline ─────────
   Kills the 300ms tap delay on mobile across every known tappable class
   name in the defrancesco.io codebase. Add new class names here as needed. */
button, a, [role="button"], input[type="button"], input[type="submit"],
.big-btn, .ctrl-btn, .choice, .cat-chip, .diff-chip, .theme-chip,
.score-card, .tile, .cat-pick, .dd-quick-btn, .btn, .mute-btn,
.ibtn, .classchip, .mchip, .pill, .seg, .clsrow, .emojis button,
.filter-chip, .listing-card, .star, .price-tag, .zone-pill, .nav-btn,
.ed-card, .lab-card, .st-row, .cl-item, .mast-action, .clf, .cl-fbtn,
.food-card, .mob-tab, .mob-menu-item, .auth-tab, .am-tab, .auth-submit {
  touch-action: manipulation;
}


/* ───────── 3. Press feedback — the single biggest UX upgrade ─────────
   Every tappable class now has a pressed state (Apple rule 1: respond
   on pointer-down, not release). Each uses only compositor-friendly
   properties (transform, opacity) so interrupts stay smooth. */
.ed-card, .lab-card, .st-row, .mast-action,
.big-btn, .ctrl-btn, .choice, .cat-chip, .diff-chip, .theme-chip,
.score-card, .tile, .cat-pick, .dd-quick-btn, .btn, .mute-btn,
.ibtn, .classchip, .mchip, .pill, .seg,
.filter-chip, .listing-card, .star, .price-tag, .zone-pill, .nav-btn,
.cl-item, .cl-fbtn, .clf,
.food-card, .mob-tab, .mob-menu-item {
  transition: transform 120ms ease-out,
              background 120ms ease-out,
              opacity 120ms ease-out,
              box-shadow 120ms ease-out;
}

.ed-card:active, .lab-card:active, .mast-action:active,
.big-btn:active, .ctrl-btn:active, .choice:active,
.cat-chip:active, .diff-chip:active, .theme-chip:active,
.score-card:active, .tile:active, .cat-pick:active, .dd-quick-btn:active,
.btn:active, .mute-btn:active,
.ibtn:active, .classchip:active, .mchip:active, .pill:active, .seg:active,
.filter-chip:active, .listing-card:active, .zone-pill:active, .nav-btn:active,
.cl-item:active, .cl-fbtn:active, .clf:active,
.food-card:active {
  transform: scale(var(--df-press-scale));
}

/* .star takes a different, bigger press (rating feedback) */
.star:active { transform: scale(1.25); }

/* .st-row: no scale (would fight the Solari flap); just a subtle fill */
.st-row:active {
  transform: none;
  background: rgba(255, 255, 255, 0.04);
}


/* ───────── 4. Shared keyframes — materialize, don't just fade ─────────
   Name them df-* so they can't collide with page-specific keyframes. */
@keyframes df-ding {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.04); }
}

@keyframes df-shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(3px); }
  50%      { transform: translateX(-3px); }
}

@keyframes df-dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(95, 211, 141, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(95, 211, 141, 0); }
  100% { box-shadow: 0 0 0 0 rgba(95, 211, 141, 0); }
}

@keyframes df-materialize-up {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes df-materialize-down {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes df-flap-settle {
  0%   { transform: translateY(-4px); opacity: 0; }
  70%  { transform: translateY(1px);  opacity: 1; }
  100% { transform: translateY(0);    opacity: 1; }
}


/* ───────── 5. Utility classes ─────────
   Shortcut helpers for new UI. Existing pages don't need to adopt them. */
.df-pressable {
  transition: transform 120ms ease-out, background 120ms ease-out;
}
.df-pressable:active { transform: scale(var(--df-press-scale)); }

.df-materialize { animation: df-materialize-up 320ms var(--df-ease-out) both; }
.df-materialize-down { animation: df-materialize-down 220ms var(--df-ease-out) both; }
.df-ding  { animation: df-ding 420ms var(--df-ease-out); }
.df-shake { animation: df-shake 320ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

.df-glass {
  background: var(--df-glass);
  backdrop-filter: var(--df-blur-sm);
  -webkit-backdrop-filter: var(--df-blur-sm);
  border: 1px solid var(--df-line);
}
.df-glass-strong {
  background: var(--df-glass-strong);
  backdrop-filter: var(--df-blur-md);
  -webkit-backdrop-filter: var(--df-blur-md);
  border: 1px solid var(--df-line);
}


/* ───────── 6. Accessibility — ALL THREE preference queries ─────────
   This is the single most important block in this file.
   Nothing on the site respected these before Oct 2026. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
    scroll-behavior: auto !important;
  }
  /* Keep opacity transitions — they aid comprehension without triggering vestibular systems */
  .df-materialize, .df-materialize-down { animation: none !important; opacity: 1; transform: none !important; }
  /* Known page-specific motion to tame */
  .flap-leaf { display: none !important; }
  .flap-static { transition: opacity 200ms ease !important; }
  canvas#scene { opacity: 0.35; } /* Quiet Safari — dim, not kill */
}

@media (prefers-reduced-transparency: reduce) {
  .df-glass, .df-glass-strong,
  [class*="glass"], [class*="backdrop"],
  .brand, .ptsbox, .toast, .toolbar,
  #musicBox, #classMenu, #siteNav,
  .cl-overlay, .cl-panel,
  .auth-card, .am-card, header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(18, 20, 26, 0.96) !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --df-line: rgba(255, 255, 255, 0.4);
    --df-ink-dim: rgba(255, 255, 255, 0.92);
    --line: rgba(255, 255, 255, 0.4);
  }
  button, a, [role="button"], .btn, .big-btn, .ibtn {
    border: 1px solid currentColor;
  }
}


/* ───────── 7. Focus-visible — keyboard users deserve this too ───────── */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}
