/* ==========================================================================
   gremloid.net — shared stylesheet
   Every page links this one file, so colors, spacing, and the nav only
   need to be changed in one place.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
    /* Warm "paper and terracotta" light theme. Every text/background pairing below
       meets WCAG AA contrast (4.5:1 or better). */
    --bg: #f3ebde;
    --surface: #faf5ec;
    --surface-2: #ece2d2;
    --text: #2f241c;
    --muted: #6b5a4b;
    --border: #e0d3bf;
    --accent: #9a4421;
    --accent-hover: #823819;
    --accent-soft: #f3dccd;
    --on-accent: #fff8f0;
    --board: #4a3527;
    --shadow: 0 1px 2px rgba(60, 38, 20, .06), 0 8px 24px rgba(60, 38, 20, .09);

    --font-display: "Outfit", "Avantgarde", "TeX Gyre Adventor", "URW Gothic L", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --radius: 14px;
    --max-width: 1080px;
    --gutter: clamp(16px, 4vw, 32px);
    color-scheme: light;
}

/* Saved preference wins; otherwise follow the operating system. */
:root[data-theme="dark"] {
    /* Warm "espresso and amber" dark theme */
    --bg: #1d1713;
    --surface: #27201a;
    --surface-2: #312820;
    --text: #f0e4d3;
    --muted: #b9a690;
    --border: #3d3128;
    --accent: #e8a065;
    --accent-hover: #f2b47e;
    --accent-soft: #3f2c1f;
    --on-accent: #1d1713;
    --board: #4a3527;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 .5em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }

p { margin: 0 0 1em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

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

.skip-link {
    position: absolute;
    left: -999px;
    top: 8px;
    padding: 8px 14px;
    background: var(--accent);
    color: var(--on-accent);
    border-radius: 8px;
    z-index: 100;
}
.skip-link:focus { left: 8px; }

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

.section { padding-block: clamp(48px, 8vw, 88px); }
.section + .section { padding-top: 0; }

.eyebrow {
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .6em;
}

.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

.page-header { padding-block: clamp(40px, 7vw, 72px) clamp(24px, 4vw, 40px); }
.page-header p { margin-bottom: 0; }

/* ---------- Header / navigation ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 64px;
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
}
.brand span { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: block;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* Icon buttons (theme toggle, mobile menu) */
.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.icon-button:hover { border-color: var(--accent); color: var(--accent); }

/* Light/dark switch: the thumb slides under the sun (light) or moon (dark). */
.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    width: 64px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    transition: border-color .15s;
}
.theme-toggle:hover { border-color: var(--accent); }

.theme-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .25s ease;
}
[data-theme="dark"] .theme-toggle-thumb { transform: translateX(30px); }

.theme-icon {
    position: relative;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: color .25s;
}
:root:not([data-theme="dark"]) .theme-icon.sun,
[data-theme="dark"] .theme-icon.moon { color: var(--on-accent); }

/* On wide screens, pin the switch to the right edge of the window, apart from the nav links. */
@media (min-width: 1320px) {
    .site-header .theme-toggle {
        position: absolute;
        top: 15px;
        right: var(--gutter);
    }
}

.menu-toggle { display: none; }
.menu-toggle .bars,
.menu-toggle .bars::before,
.menu-toggle .bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
    transition: transform .2s;
}
.menu-toggle .bars::before,
.menu-toggle .bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle .bars::before { top: -6px; }
.menu-toggle .bars::after { top: 6px; }
.menu-open .menu-toggle .bars { background: transparent; }
.menu-open .menu-toggle .bars::before { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-toggle .bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 720px) {
    .menu-toggle { display: inline-grid; }
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        padding: 8px var(--gutter) 16px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
    }
    .menu-open .nav-links { display: flex; }
    .nav-links a { padding: 12px 14px; }
}

/* ---------- Buttons ---------- */
.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    font: 600 .95rem var(--font-body);
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); transform: translateY(-1px); }

.button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.button.secondary:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Social icons ---------- */
/* Inline SVG icons colored with currentColor (work even when opened straight from disk) */
.icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.socials { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; }
.socials a {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    color: var(--muted);
    transition: color .15s, background-color .15s;
}
.socials a:hover { color: var(--accent); background: var(--accent-soft); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 24px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tags li {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .8rem;
    font-weight: 600;
}

/* ---------- Home: hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: clamp(32px, 6vw, 72px);
    align-items: center;
    padding-block: clamp(40px, 9vw, 104px) clamp(16px, 3vw, 32px);
}
.hero h1 span { color: var(--accent); }
.hero .lead { margin-bottom: 28px; }
.hero .socials { margin-top: 24px; margin-left: -8px; }

.portrait {
    position: relative;
    justify-self: center;
    width: min(100%, 360px);
}
.portrait img {
    aspect-ratio: 1;
    width: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 6px solid var(--surface);
    box-shadow: var(--shadow);
}
.portrait::before {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: var(--accent-soft);
    z-index: -1;
}

@media (max-width: 760px) {
    .hero { grid-template-columns: 1fr; text-align: left; }
    .portrait { order: -1; width: min(60%, 240px); justify-self: start; }
}

/* ---------- Home: about / skills ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(24px, 5vw, 56px);
}
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.skill-group + .skill-group { margin-top: 20px; }
.skill-group h3 { font-size: .95rem; color: var(--muted); font-family: var(--font-body); font-weight: 600; }

/* ---------- Timeline (experience) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: 0 0 26px 26px;
    border-left: 2px solid var(--border);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}
/* Current role: filled dot with a soft halo */
.timeline li.current::before {
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
/* Education milestone: diamond marker */
.timeline li.milestone::before {
    border-radius: 2px;
    transform: rotate(45deg);
}
.timeline h3 { margin-bottom: 2px; }
.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font: 600 .7rem var(--font-body);
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: 3px;
}
.timeline .org { color: var(--text); font-weight: 500; margin: 0; }
.timeline .date { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---------- Project cards ---------- */
.project-card { display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.project-card:hover { transform: translateY(-4px); }

.project-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.project-thumb img { width: 42%; max-width: 150px; image-rendering: auto; }

.project-body { display: flex; flex-direction: column; gap: 12px; padding: 22px; flex: 1; }
.project-body h3 { margin: 0; }
.project-body p { color: var(--muted); margin: 0; flex: 1; }
.project-body .button { align-self: flex-start; margin-top: 4px; }

/* ---------- Music ---------- */
.band {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: clamp(20px, 4vw, 40px);
    padding: clamp(20px, 4vw, 32px);
}
.band + .band { margin-top: 24px; }
.band img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
}
.band h2 { margin-bottom: 4px; }
.band .role { color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.band p { color: var(--muted); }
/* color-scheme: normal stops the browser painting a white backdrop behind
   Spotify's rounded corners when the site is in dark mode */
.band iframe { color-scheme: normal; width: 100%; height: 352px; border: 0; border-radius: 12px; margin-top: 8px; }

@media (max-width: 640px) {
    .band { grid-template-columns: 1fr; }
    .band img { max-width: 200px; }
}

/* ---------- Video editing ---------- */
.video-card iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}
.video-card .project-body { gap: 4px; }
.video-card .date { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---------- Contact ---------- */
.contact-card {
    max-width: 640px;
    margin-inline: auto;
    padding: clamp(24px, 5vw, 44px);
}
.contact-email {
    display: inline-block;
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 4vw, 1.9rem);
    font-weight: 600;
    word-break: break-all;
    margin-bottom: 24px;
}
.contact-links { display: grid; gap: 10px; list-style: none; padding: 0; margin: 28px 0 0; }
.contact-links a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, color .15s;
}
.contact-links a:hover { border-color: var(--accent); color: var(--accent); }
.contact-links .handle { margin-left: auto; color: var(--muted); font-size: .9rem; }

/* ---------- Connect 4 ---------- */
.game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-bottom: 64px;
}
.board {
    --cell: min(56px, calc((100vw - 2 * var(--gutter) - 70px) / 7));
    display: grid;
    grid-template-columns: repeat(7, var(--cell));
    grid-template-rows: repeat(6, var(--cell));
    gap: 6px;
    padding: 12px;
    background: var(--board);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.cell {
    border-radius: 50%;
    background: var(--bg);
    cursor: pointer;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, .18);
    transition: background-color .2s;
}
.cell.red { background: #e5484d; }
.cell.yellow { background: #f5c542; }
.game-status { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; margin: 0; }
.game-status .chip {
    display: inline-block;
    width: .8em;
    height: .8em;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: -1px;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding-block: 28px;
    color: var(--muted);
    font-size: .9rem;
}
.site-footer .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.site-footer p { margin: 0; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Inline SVG thumbnail art that follows the theme accent */
.thumb-art { width: 38%; max-width: 140px; color: var(--accent); }

/* Neutral badge (e.g. "Former" on the music page) */
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
h2 .badge { font-size: .75rem; vertical-align: 6px; }
