/* ============================================
   Now is Youngest — Shared Design Variables
   ============================================
   All CSS custom properties live here.
   home.css, app.css, global.css reference these.
   ============================================ */

:root {
  /* Responsive root font-size — single source of scaling */
  font-size: clamp(14px, 0.4vw + 13px, 16px);

  /* --- Colors --- */
  --color-accent: #2B4C9B;
  --color-accent-hover: #1F3A7A;
  --color-accent-light: #E8EDF7;
  --color-bg-base: #FCFBF9;
  --color-card-bg: #FFFFFF;
  --color-text-primary: #1E2432;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;
  --color-border: #E5E7EB;
  --color-gold: #C9A84C;
  --color-footer-bg: #2B4C9B;
  --color-footer-text: #FFFFFF;
  --color-footer-link: #C5D0F0;
  --color-footer-muted: #7B8FC7;

  /* --- Typography scale (rem = scales with root font-size) --- */
  --text-2xs: 0.625rem;  /* ~10px */
  --text-xs: 0.6875rem;  /* ~11px */
  --text-sm: 0.75rem;    /* ~12px */
  --text-base: 0.8125rem; /* ~13px */
  --text-md: 0.875rem;   /* ~14px */
  --text-lg: 0.9375rem;  /* ~15px */
  --text-xl: 1.0625rem;  /* ~17px */

  /* --- Spacing scale --- */
  --space-2xs: 0.25rem;  /* ~4px */
  --space-xs: 0.5rem;    /* ~8px */
  --space-sm: 0.75rem;   /* ~12px */
  --space-md: 1.25rem;   /* ~20px */
  --space-lg: 1.5rem;    /* ~24px */
  --space-xl: 1.75rem;   /* ~28px */
  --space-2xl: 2.5rem;   /* ~40px */
  --space-3xl: 3rem;     /* ~48px */
  --space-4xl: 4rem;     /* ~64px */

  /* --- Radii --- */
  --radius-card: 1rem;
  --radius-btn: 0.625rem;
  --radius-pill: 100px;

  /* --- Status / Badge colors --- */
  --color-error-bg: #fef2f2;
  --color-error-text: #dc2626;
  --color-error-border: rgba(220, 38, 38, 0.15);
  --color-success-bg: #f0fdf4;
  --color-success-text: #16a34a;
  --color-success-border: rgba(22, 163, 74, 0.15);
  --color-warning-bg: #FFFBEB;
  --color-warning-bg-strong: #FEF3C7;
  --color-warning-text: #92400E;
  --color-warning-border: rgba(217, 119, 6, 0.2);
  --color-info-bg: #EFF6FF;
  --color-info-bg-light: #DBEAFE;
  --color-surface-secondary: #F9FAFB;
  --color-badge-purple-bg: #F3E8FF;
  --color-badge-purple-text: #6B21A8;
  --color-badge-green-bg: #D1FAE5;
  --color-badge-green-text: #065F46;

  /* --- Demo preview font-size tokens (linear vw scaling, min @ iPhone 17 402px) --- */
  --demo-text-2xs: clamp(0.55rem, 0.3rem + 0.8vw, 0.75rem);
  --demo-text-xs:  clamp(0.625rem, 0.35rem + 0.9vw, 0.875rem);
  --demo-text-sm:  clamp(0.7rem,  0.4rem + 1vw,   1rem);
  --demo-text-md:  clamp(0.8rem,  0.45rem + 1.1vw, 1.125rem);
  --demo-text-lg:  clamp(0.9rem,  0.5rem + 1.3vw,  1.3rem);
  --demo-text-xl:  clamp(1rem,    0.55rem + 1.5vw,  1.5rem);
  --demo-text-2xl: clamp(1.1rem,  0.6rem + 1.7vw,   1.75rem);

  /* --- Misc --- */
  --header-height: 3.75rem;
  --font-base: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --transition: all 0.1s ease-in-out;

  /* --- Legacy aliases (home.css) --- */
  --bg-base: var(--color-bg-base);
  --card-bg: var(--color-card-bg);
  --accent: var(--color-accent);
  --accent-hover: var(--color-accent-hover);
  --accent-light: var(--color-accent-light);
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: var(--color-text-muted);
  --border: var(--color-border);
  --gold: var(--color-gold);
  --footer-bg: var(--color-footer-bg);
  --footer-text: var(--color-footer-text);
  --footer-link: var(--color-footer-link);
  --footer-muted: var(--color-footer-muted);
  --card-radius: var(--radius-card);
  --btn-radius: var(--radius-btn);

  /* --- Legacy aliases (app.css / global.css) --- */
  --primary-color: var(--color-accent);
  --primary-dark: var(--color-accent-hover);
  --primary-light: var(--color-accent-light);
  --secondary-color: var(--color-bg-base);
  --text-color: var(--color-text-primary);
  --text-light: var(--color-text-secondary);
  --bg-color: var(--color-bg-base);
  --border-color: var(--color-border);
  --border-radius: 6px;
  --light-gray: #f1f3f4;
  --text-dark: var(--color-text-primary);
}

/* --- Dark mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --color-accent: #5B7FD4;
    --color-accent-hover: #7B9BE0;
    --color-accent-light: #2D3150;
    --color-bg-base: #181B2E;
    --color-card-bg: #232540;
    --color-card-bg-hover: #2A2D4A;
    --color-text-primary: #E8E8ED;
    --color-text-secondary: #8B90A5;
    --color-text-muted: #6B7080;
    --color-border: #2D3150;
    --color-footer-bg: #141626;
    --color-footer-text: #E8E8ED;
    --color-footer-link: #8B90A5;
    --color-footer-muted: #4A5275;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);

    /* Dark-specific surface tokens */
    --dark-bg-primary: #181B2E;
    --dark-bg-secondary: #232540;
    --dark-bg-tertiary: #2D3150;
    --dark-surface: #2A2D4A;
    --dark-border: #2D3150;
    --dark-text: #E8E8ED;
    --dark-text-secondary: #8B90A5;

    /* Status / Badge colors (dark) */
    --color-error-bg: rgba(248, 113, 113, 0.1);
    --color-error-text: #f87171;
    --color-error-border: rgba(248, 113, 113, 0.2);
    --color-success-bg: rgba(34, 197, 94, 0.1);
    --color-success-text: #22c55e;
    --color-success-border: rgba(34, 197, 94, 0.2);
    --color-warning-bg: rgba(217, 119, 6, 0.08);
    --color-warning-bg-strong: rgba(217, 119, 6, 0.15);
    --color-warning-text: #fbbf24;
    --color-warning-border: rgba(217, 119, 6, 0.3);
    --color-info-bg: rgba(59, 130, 246, 0.1);
    --color-info-bg-light: rgba(59, 130, 246, 0.15);
    --color-surface-secondary: var(--color-card-bg);
    --color-badge-purple-bg: rgba(147, 51, 234, 0.15);
    --color-badge-purple-text: #c084fc;
    --color-badge-green-bg: rgba(34, 197, 94, 0.15);
    --color-badge-green-text: #6ee7b7;

    /* Legacy aliases re-resolve automatically via var() chain,
       but override the ones that used hardcoded fallbacks */
    --secondary-color: #232540;
    --light-gray: #2d3139;
    --border-color: #3c4043;
  }
}

/* --- Base body (single definition) --- */
body {
  font-family: var(--font-base);
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Global reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
