/* base.css — shared across all pages on wheelofnames.net
   Defines design tokens, reset, typography, header/nav, footer.
   Pages may override --primary / --primary-hover for per-tool theming. */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #007AFF;
    --primary-hover: #0051D5;
    --secondary: #5856D6;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;

    --gray-50:  #FAFAFA;
    --gray-100: #F5F5F7;
    --gray-200: #E5E5EA;
    --gray-300: #D1D1D6;
    --gray-400: #C7C7CC;
    --gray-500: #AEAEB2;
    --gray-600: #8E8E93;
    --gray-700: #636366;
    --gray-800: #48484A;
    --gray-900: #1C1C1E;

    --bg:        linear-gradient(180deg, #F5F5F7 0%, #FAFAFA 100%);
    --surface:   #ffffff;
    --text:      var(--gray-900);
    --text-soft: var(--gray-600);
    --border:    var(--gray-200);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow:    0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);

    --radius-sm: 10px;
    --radius:    16px;
    --radius-lg: 24px;

    --header-bg: rgba(255, 255, 255, 0.8);
    --footer-bg: var(--gray-900);
    --footer-text: var(--gray-400);
    --footer-heading: #ffffff;
    --footer-border: var(--gray-800);
}

/* Dark mode — auto via prefers-color-scheme; or forced via [data-theme="dark"] on <html> */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:        linear-gradient(180deg, #0a0a0c 0%, #18181b 100%);
        --surface:   #1c1c1e;
        --text:      #f5f5f7;
        --text-soft: #a1a1aa;
        --border:    #2c2c2e;

        --gray-100: #1c1c1e;
        --gray-200: #2c2c2e;
        --gray-300: #3a3a3c;

        --header-bg: rgba(20, 20, 22, 0.78);
        --shadow:    0 4px 16px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.55);
    }
}
:root[data-theme="dark"] {
    --bg:        linear-gradient(180deg, #0a0a0c 0%, #18181b 100%);
    --surface:   #1c1c1e;
    --text:      #f5f5f7;
    --text-soft: #a1a1aa;
    --border:    #2c2c2e;
    --gray-100:  #1c1c1e;
    --gray-200:  #2c2c2e;
    --gray-300:  #3a3a3c;
    --header-bg: rgba(20, 20, 22, 0.78);
    --shadow:    0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.55);
}

html { color-scheme: light dark; }

/* Force dark backgrounds for variant pages that hard-code their own gradient.
   These rules win because of !important; pages can opt out by also using !important. */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) body {
        background: linear-gradient(180deg, #0a0a0c 0%, #18181b 100%) !important;
        color: var(--text);
    }
    html:not([data-theme="light"]) .container,
    html:not([data-theme="light"]) .wheel-container,
    html:not([data-theme="light"]) .card,
    html:not([data-theme="light"]) .wheel-card {
        background: var(--surface);
        color: var(--text);
    }
}
html[data-theme="dark"] body {
    background: linear-gradient(180deg, #0a0a0c 0%, #18181b 100%) !important;
    color: var(--text);
}
html[data-theme="dark"] .container,
html[data-theme="dark"] .wheel-container,
html[data-theme="dark"] .card,
html[data-theme="dark"] .wheel-card {
    background: var(--surface);
    color: var(--text);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
                 system-ui, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

img, svg { max-width: 100%; display: block; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    left: 8px;
    top: -40px;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    z-index: 2000;
    transition: top 0.2s;
}
.skip-link:focus { top: 8px; color: #fff; }

/* Typography utilities */
.text-hero {
    font-size: clamp(36px, 6vw, 56px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.07;
}
.text-title    { font-size: 32px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.text-headline { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.text-body     { font-size: 17px; font-weight: 400; line-height: 1.47; letter-spacing: -0.022em; }
.text-caption  { font-size: 15px; font-weight: 400; color: var(--text-soft); letter-spacing: -0.01em; }

/* Buttons */
.btn {
    font-family: inherit;
    font-size: 17px;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.022em;
    text-decoration: none;
    color: inherit;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    color: #fff;
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
    background: var(--gray-100);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--gray-200); color: var(--text); }
.btn-icon {
    padding: 10px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--text-soft);
    min-width: 40px;
    min-height: 40px;
}
.btn-icon:hover { background: var(--gray-200); color: var(--text); }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Header / nav */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
}
.site-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.site-logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.site-logo svg { width: 28px; height: 28px; }
.site-nav-links {
    display: flex;
    list-style: none;
    gap: 28px;
    align-items: center;
}
.site-nav-links a {
    color: var(--text-soft);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s ease;
}
.site-nav-links a:hover,
.site-nav-links a[aria-current="page"] { color: var(--primary); }

.theme-toggle {
    background: var(--gray-100);
    border: 1px solid var(--border);
    color: var(--text-soft);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--gray-200); color: var(--text); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
}

@media (max-width: 720px) {
    .site-nav { padding: 12px 20px; }
    .nav-toggle { display: inline-flex; }
    .site-nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 8px 20px 16px;
        display: none;
    }
    .site-nav-links.open { display: flex; }
    .site-nav-links li { width: 100%; }
    .site-nav-links a {
        display: block;
        padding: 12px 0;
        font-size: 17px;
        border-bottom: 1px solid var(--border);
    }
    .site-nav-links li:last-child a { border-bottom: none; }
    .container { padding: 0 20px; }
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 56px 0 28px;
    margin-top: 80px;
}
.site-footer .container { padding: 0 32px; }
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 32px;
}
.footer-section h3 {
    color: var(--footer-heading);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}
.footer-section p { font-size: 15px; line-height: 1.55; color: var(--footer-text); }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 10px; }
.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s ease;
}
.footer-links a:hover { color: #fff; }
.footer-bottom {
    text-align: center;
    padding-top: 28px;
    border-top: 1px solid var(--footer-border);
    color: var(--gray-500);
    font-size: 14px;
}
@media (max-width: 720px) {
    .site-footer { padding: 40px 0 24px; margin-top: 56px; }
    .site-footer .container { padding: 0 20px; }
    .footer-content { gap: 28px; }
}

/* Page chrome utilities */
.page-hero {
    text-align: center;
    padding: 72px 0 48px;
}
.page-hero h1 { margin-bottom: 16px; color: var(--text); }
.page-hero .tagline {
    font-size: clamp(18px, 2.4vw, 22px);
    color: var(--text-soft);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.4;
}

@media (max-width: 720px) {
    .page-hero { padding: 40px 0 32px; }
}
