/*
 * nibbleworkshop.com — Apple-style design layer.
 * Source of the rules: awesome-design-md/design-md/apple/DESIGN.md.
 *
 * Loaded last in <head> on every page, after Tailwind and the page's own
 * <style> block. Together with assets/tailwind-config.js it restyles the
 * existing markup:
 *   - Light canvas (#fff), parchment (#f5f5f7) and near-black tiles (#272729).
 *     A section gets its surface from one class: .tile-light, .tile-parchment
 *     or .tile-dark. The color change between tiles is the divider.
 *   - One accent: Action Blue #0066cc (Sky Link Blue #2997ff on dark).
 *   - SF Pro (system font) with Inter as fallback, 17px body, 600 headlines.
 *   - Black 44px global nav, pill CTAs, 18px cards, parchment footer.
 *   - No gradients, no glow, no shadows on chrome. The only shadow is the
 *     product shadow under screenshots and device images.
 *
 * Selectors start with `body` so they win over Tailwind utilities
 * (one extra element in the specificity) regardless of stylesheet order.
 */

/* ---------- Tokens ---------- */
:root {
    --apple-blue: #0066cc;
    --apple-blue-focus: #0071e3;
    --apple-blue-hover: #0077ed;
    --apple-blue-on-dark: #2997ff;
    --apple-ink: #1d1d1f;
    --apple-ink-80: #333333;
    --apple-ink-48: #6e6e73;
    --apple-hairline: #e0e0e0;
    --apple-parchment: #f5f5f7;
    --apple-tile-1: #272729;
    --apple-product-shadow: 3px 5px 30px 0 rgba(0, 0, 0, 0.22);
    --apple-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
                  "Helvetica Neue", Inter, system-ui, sans-serif;
}

/* ---------- Surfaces (palette roles used by tailwind-config.js) ---------- */

/* Light: the default canvas. "white" = ink text, "black" = paper. */
:root,
.tile-light {
    --c-bg: 255 255 255;
    --c-card: 245 245 247;
    --c-text: 29 29 31;
    --c-muted: 110 110 115;
    --c-accent: 0 102 204;
    --c-white: 29 29 31;
    --c-black: 255 255 255;
    --c-gray-100: 29 29 31;
    --c-gray-200: 29 29 31;
    --c-gray-300: 29 29 31;
    --c-gray-400: 51 51 51;
    --c-gray-500: 110 110 115;
    --c-gray-600: 110 110 115;
    --c-gray-700: 210 210 215;
    --c-gray-800: 224 224 224;
    --c-gray-900: 245 245 247;
}

/* Parchment: like light, but cards and subtle boxes turn white. */
.tile-parchment {
    --c-bg: 245 245 247;
    --c-card: 255 255 255;
    --c-text: 29 29 31;
    --c-muted: 110 110 115;
    --c-accent: 0 102 204;
    --c-white: 29 29 31;
    --c-black: 255 255 255;
    --c-gray-100: 29 29 31;
    --c-gray-200: 29 29 31;
    --c-gray-300: 29 29 31;
    --c-gray-400: 51 51 51;
    --c-gray-500: 110 110 115;
    --c-gray-600: 110 110 115;
    --c-gray-700: 210 210 215;
    --c-gray-800: 224 224 224;
    --c-gray-900: 255 255 255;
}

/* Dark tile and the global nav: real white text on near-black. */
.tile-dark,
body > nav {
    --c-bg: 39 39 41;
    --c-card: 29 29 31;
    --c-text: 245 245 247;
    --c-muted: 161 161 166;
    --c-accent: 41 151 255;
    --c-white: 255 255 255;
    --c-black: 0 0 0;
    --c-gray-100: 245 245 247;
    --c-gray-200: 245 245 247;
    --c-gray-300: 232 232 237;
    --c-gray-400: 204 204 204;
    --c-gray-500: 161 161 166;
    --c-gray-600: 134 134 139;
    --c-gray-700: 72 72 74;
    --c-gray-800: 58 58 60;
    --c-gray-900: 29 29 31;
}

body .tile-light,
body .tile-parchment,
body .tile-dark {
    background-color: rgb(var(--c-bg));
    background-image: none;
    color: rgb(var(--c-text));
    border-top-width: 0;
    border-bottom-width: 0;
}

/* ---------- Base typography ---------- */
html { background-color: #fff; }

body {
    background-color: #fff;
    color: var(--apple-ink);
    font-family: var(--apple-font);
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body h1, body h2, body h3, body h4 {
    font-family: var(--apple-font);
    font-weight: 600;
}
body h1 { letter-spacing: -0.005em; }
body h2 { letter-spacing: -0.003em; }

/* No all-caps, no wide tracking: Apple sets UI text in sentence case. */
body .uppercase { text-transform: none; }

/* The former LCD / pixel / serif display faces become SF Pro. */
body .lcd-text,
body .pixel-text,
body .display-text {
    font-family: var(--apple-font);
    letter-spacing: -0.01em;
}
/* Small eyebrow lines above headlines (were LCD, uppercase, 0.3em). */
body p.lcd-text,
body span.lcd-text {
    font-weight: 600;
}

body a { text-underline-offset: 0.15em; }

/* Small phones: hero type steps down (56 -> 40 -> 34 -> 28). */
@media (max-width: 640px) {
    body h1.text-4xl, body h2.text-4xl { font-size: 34px; line-height: 1.1; }
    body h1.text-5xl, body h2.text-5xl { font-size: 40px; line-height: 1.1; }
}
@media (max-width: 419px) {
    body h1.text-4xl, body h2.text-4xl { font-size: 28px; }
    body h1.text-5xl, body h2.text-5xl { font-size: 34px; }
}

/* ---------- Global nav: black, 44px, 12px links ---------- */
body > nav[class] {
    background-color: rgba(0, 0, 0, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom-width: 0;
    color: #f5f5f7;
}
body > nav .h-16 { height: 44px; }
main.pt-16 { padding-top: 44px; }

/* Wordmark */
body > nav .flex-shrink-0 > a {
    font-family: var(--apple-font);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.022em;
    color: #f5f5f7;
}
body > nav .flex-shrink-0 > a:hover { color: #fff; }

/* Desktop links (main nav and the per-product navs) */
body > nav .ml-10 { align-items: center; }
body > nav .ml-10 > a,
body > nav .ml-10 > .nav-dropdown > a {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 44px;
    padding: 0 10px;
    border-color: transparent;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.8);
}
body > nav .ml-10 > a:hover,
body > nav .ml-10 > .nav-dropdown > a:hover { color: #fff; }
/* Current page: Sky Link Blue (the class on the active item is the accent). */
body > nav .ml-10 > a[class*="-amber"],
body > nav .ml-10 > a[class*="-gold"],
body > nav .ml-10 > .nav-dropdown > a[class*="-amber"],
body > nav .ml-10 > .nav-dropdown > a[class*="-gold"] {
    color: var(--apple-blue-on-dark);
}

/* Dropdown flyouts */
body .nav-dropdown-menu {
    top: 44px;
    background: #1d1d1f;
    border: 1px solid #3a3a3c;
    border-radius: 18px;
    padding: 8px;
    box-shadow: none;
    transform: none;
}
body .nav-dropdown-menu a {
    font-size: 14px;
    letter-spacing: -0.016em;
    color: #e8e8ed;
    border-radius: 11px;
    line-height: 1.29;
    padding: 9px 12px;
}
body .nav-dropdown-menu a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
body .nav-dropdown-menu .menu-meta { font-size: 12px; color: #a1a1a6; letter-spacing: -0.01em; }

/* Mobile menu */
body > nav #mobile-menu-btn { background-color: transparent; }
body > nav #mobile-menu { background-color: #000; border-bottom-width: 0; }
body > nav #mobile-menu a {
    font-size: 17px;
    letter-spacing: -0.022em;
    border-radius: 11px;
}
body > nav #mobile-menu a.text-xs {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #86868b;
}

/* ---------- Buttons ---------- */

/* Solid accent CTAs -> Action Blue pill, white label, scale on press. */
body a.bg-nw-amber, body button.bg-nw-amber,
body a.bg-hp-amber, body button.bg-hp-amber,
body a.bg-hp-gold,  body button.bg-hp-gold,
body a.bg-ti-gold,  body button.bg-ti-gold,
body a.bg-pref-gold, body button.bg-pref-gold,
body a.bg-hp-blue,  body button.bg-hp-blue {
    background-color: var(--apple-blue);
    color: #fff;
    border-radius: 9999px;
    font-weight: 400;
    font-size: 17px;
    letter-spacing: -0.022em;
    box-shadow: none;
}
body a.bg-nw-amber:hover, body button.bg-nw-amber:hover,
body a.bg-hp-amber:hover, body button.bg-hp-amber:hover,
body a.bg-hp-gold:hover,  body button.bg-hp-gold:hover,
body a.bg-ti-gold:hover,  body button.bg-ti-gold:hover,
body a.bg-pref-gold:hover, body button.bg-pref-gold:hover,
body a.bg-hp-blue:hover,  body button.bg-hp-blue:hover {
    background-color: var(--apple-blue-hover);
}
/* Dark utility button (was the white "secondary" button). */
body a.bg-white { border-radius: 9999px; }

/* Discord: same pill grammar and the one accent, not a second brand color. */
body a.bg-discord {
    background-color: var(--apple-blue);
    border-radius: 9999px;
    color: #fff;
}
body a.bg-discord:hover { background-color: var(--apple-blue-hover); }
body .text-discord { color: rgb(var(--c-accent)); }

body a.rounded-md[class*="border"],
body a.rounded-lg[class*="border"],
body button.rounded-md[class*="border"] {
    border-radius: 9999px;
}

body a, body button { -webkit-tap-highlight-color: transparent; }
body a[class*="bg-"]:active,
body button:active { transform: scale(0.95); }

body a:focus-visible,
body button:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible {
    outline: 2px solid var(--apple-blue-focus);
    outline-offset: 2px;
}

/* ---------- Cards ---------- */
body .feature-card,
body .felt-card,
body .grid-card,
body .num-card {
    background: rgb(var(--c-card));
    border-color: rgb(var(--c-gray-800));
    box-shadow: none;
    transition: none;
}
body .feature-card:hover,
body .felt-card:hover,
body .grid-card:hover {
    transform: none;
    box-shadow: none;
    border-color: rgb(var(--c-gray-700));
}
body .group:hover .group-hover\:text-nw-amber { color: rgb(var(--c-accent)); }

body .enemy-card .enemy-name,
body .powerup-card .pu-name,
body .level-card .level-name,
body .tier-card .tier-name { color: rgb(var(--c-accent)); }

body .tier-card .tier-cell {
    font-family: var(--apple-font);
    font-weight: 600;
    color: rgb(var(--c-accent));
    border-color: rgb(var(--c-gray-800));
    background: rgb(var(--c-bg));
    border-radius: 11px;
}

body .step-number {
    font-family: var(--apple-font);
    font-weight: 600;
    color: rgb(var(--c-accent));
    border-color: rgb(var(--c-accent) / 0.4);
}

/* Chips (configurator-option-chip style) */
body .modifier-pill,
body .suit-pill,
body .tech-pill {
    background: rgb(var(--c-card));
    border: 1px solid rgb(var(--c-gray-800));
    color: rgb(var(--c-text));
    font-family: var(--apple-font);
    font-size: 14px;
    letter-spacing: -0.016em;
    text-transform: none;
    border-radius: 9999px;
    padding: 6px 14px;
}

/* Screenshot cards */
body .shot-card {
    background: rgb(var(--c-card));
    border: 1px solid rgb(var(--c-gray-800));
    border-radius: 18px;
    transition: none;
}
body .shot-card:hover { transform: none; border-color: rgb(var(--c-gray-700)); }
body .shot-card .shot-caption {
    font-family: var(--apple-font);
    font-size: 12px;
    letter-spacing: -0.01em;
    text-transform: none;
    color: rgb(var(--c-muted));
    border-top-color: rgb(var(--c-gray-800));
}

body .shot {
    border-radius: 18px;
    border-color: rgb(var(--c-gray-800));
    box-shadow: var(--apple-product-shadow);
}
body .gallery-item:hover img { transform: none; }

body .screen-container { border-color: rgb(var(--c-gray-800)); transition: none; }
body .screen-container:hover {
    transform: none;
    box-shadow: none;
    border-color: rgb(var(--c-gray-700));
}

/* ---------- Product imagery: the single system shadow ---------- */
body img.shadow-lg,
body img.shadow-xl,
body img.shadow-2xl {
    box-shadow: var(--apple-product-shadow);
}

/* ---------- Decoration removed (no gradients, glow, pulses) ---------- */
body .hero-gradient { background-image: none; }
body .hero-gradient::before { display: none; }
body .glow-border,
body .v3-card { animation: none; }
body .title-pulse { animation: none; text-shadow: none; color: inherit; }
body .blur-2xl,
body .blur-3xl { display: none; }
body [class*="shadow-[0_0"] { box-shadow: none; }
body > nav .animate-pulse { display: none; }

/* Content shows at once; no slide-in. */
body .animate-fade-in-up { animation: none; opacity: 1; transform: none; }
body .delay-100, body .delay-200, body .delay-300,
body .delay-400, body .delay-500 { opacity: 1; }

/* ---------- Forms (search-input grammar) ---------- */
body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
body select[class],
body textarea[class] {
    background-color: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    border-radius: 11px;
    color: var(--apple-ink);
    font-size: 17px;
    letter-spacing: -0.022em;
}
body label[class] {
    color: rgb(var(--c-text));
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.016em;
}

/* ---------- Former mono labels ---------- */
/* Section heads that were amber mono caps -> ink, 21px tagline. */
body h2.font-mono,
body h3.font-mono {
    color: rgb(var(--c-text));
    font-weight: 600;
    letter-spacing: 0.011em;
}
/* Tags (HEX/DEC/OCT/BIN, RPN STACK, ...) -> configurator chips. */
body span.font-mono.rounded,
body span.font-mono.rounded-full {
    background-color: rgb(var(--c-black));
    border-color: rgb(var(--c-gray-700));
    color: rgb(var(--c-text));
    border-radius: 9999px;
    padding: 4px 12px;
}

/* ---------- Footer: parchment, fine print ---------- */
body > footer[class] {
    background-color: var(--apple-parchment);
    border-top: 1px solid #d2d2d7;
    color: var(--apple-ink-48);
}
body > footer .text-sm,
body > footer .text-xs { font-size: 12px; letter-spacing: -0.01em; }
body > footer .text-gray-600 { color: var(--apple-ink-48); }
body > footer a { color: var(--apple-blue); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #c7c7cc;
    border-radius: 9999px;
    border: 2px solid #fff;
}
::-webkit-scrollbar-thumb:hover { background: #a1a1a6; }
