/* ========================================
   TOKENS (light is the default, dark is set by data-theme="dark")
   ======================================== */
:root {
    --bg: #e8e8e6;
    --surface: #f1f1ef;
    --ink: #1c1c1c;
    --muted: #4b4b48;
    --red: #cf1f1b;
    --bulb: #f6c945;
    --line: rgba(28, 28, 28, .18);

    --font-base: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
    --font-display: "Arial Black", "Helvetica Neue", Impact, Arial, sans-serif;
    --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
    --pad: clamp(20px, 5vw, 72px);
    --max: 1500px;
    color-scheme: light;
}

html[data-theme='dark'] {
    --bg: #151515;
    --surface: #1e1e1e;
    --ink: #f2f2ee;
    --muted: #b9b9b3;
    --red: #ff5b52;
    --bulb: transparent;
    --line: rgba(242, 242, 238, .22);
    color-scheme: dark;
}

/* ========================================
   BASE
   ======================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: var(--font-base);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s, color .3s;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* ========================================
   HEADER
   ======================================== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    transition: background-color .3s;
}

header .container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    min-height: 76px;
}

.logo { font-weight: 700; font-size: 1.25rem; text-decoration: none; }

header nav ul { display: flex; align-items: center; gap: clamp(2px, 1.6vw, 24px); list-style: none; }

header nav ul li a {
    display: inline-block;
    padding: 10px 12px;
    font-size: .95rem;
    color: var(--muted);
    text-decoration: none;
    transition: color .15s;
}
header nav ul li a:hover { color: var(--ink); }

/* Hamburger (mobile only) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}
.menu-toggle .bar { display: block; width: 100%; height: 2px; background: var(--ink); border-radius: 2px; transition: all .3s; }

/* Right side of the header: Contact button, menu icon, light-bulb cord */
.header-right { justify-self: end; align-self: stretch; display: flex; align-items: center; gap: 14px; }

.pill {
    padding: 10px 22px;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    transition: background-color .15s, color .15s;
}
.pill:hover { background: var(--ink); color: var(--bg); }

/* Light-bulb pull cord (theme switch). Light mode = bulb lit, dark mode = bulb off. */
.cord { align-self: flex-start; width: 28px; height: 64px; padding: 0; color: var(--ink); background: none; border: none; cursor: pointer; }
.cord svg { display: block; overflow: visible; }
.cord-line { stroke: currentColor; stroke-width: 1.5; }
.cord-cap { fill: currentColor; }
.cord-bulb { fill: var(--bulb); stroke: currentColor; stroke-width: 1.5; transition: fill .3s; }
.cord:hover .cord-bulb { stroke: var(--red); }
@media (prefers-reduced-motion: no-preference) {
    .cord.is-pulled svg { animation: pull .35s ease; }
    @keyframes pull { 40% { transform: translateY(9px); } 100% { transform: none; } }
}

/* ========================================
   HERO
   ======================================== */
#hero { min-height: calc(100svh - 76px); display: flex; align-items: center; padding-bottom: clamp(32px, 5vw, 64px); }
#hero .container { display: flex; flex-direction: column; gap: clamp(14px, 3vw, 36px); text-align: left; }

.name { display: block; width: 100%; height: auto; fill: var(--ink); }
.name text { font-family: var(--font-display); font-weight: 900; }

.hero-role {
    font: italic 400 clamp(2.4rem, 8.5vw, 7rem)/1 var(--font-serif);
    color: var(--red);
    letter-spacing: -.02em;
}

.hero-sub { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; }
.hero-subtitle { max-width: 36ch; font-size: clamp(1.1rem, 1.6vw, 1.35rem); line-height: 1.45; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 32px; }
.link { font-size: 1.1rem; font-weight: 700; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 7px; transition: color .15s; }
.link:hover { color: var(--red); }

.btn {
    display: inline-block;
    padding: 14px 28px;
    font: 600 1rem/1.2 var(--font-base);
    text-decoration: none;
    color: var(--bg);
    background: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ========================================
   SECTIONS (heading left, content right)
   ======================================== */
#about .container,
#projects .container, #skills .container,
#contact .container {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 4fr;
    gap: 16px clamp(24px, 5vw, 80px);
    padding-block: clamp(48px, 8vw, 104px);
    border-top: 1px solid var(--line);
}

/* the border sits on the inner box, so inset it to match the page padding */
#about, #projects, #skills, #contact { padding-inline: var(--pad); }
#about .container, #projects .container, #skills .container, #contact .container { padding-inline: 0; max-width: calc(var(--max) - 2 * var(--pad)); }

section h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.2; text-align: left; margin: 0; }

/* ABOUT */
.about-content { display: grid; gap: clamp(28px, 4vw, 48px); }
.about-statement { max-width: 20ch; font-size: clamp(1.8rem, 4.6vw, 3.4rem); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
.about-facts, .skills-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 20px 32px; }
.about-facts > div, .skills-list > div { padding-top: 14px; border-top: 1px solid var(--line); }
.about-facts dt, .skills-list dt { font-size: .9rem; color: var(--muted); }
.about-facts dd, .skills-list dd { font-size: 1.15rem; font-weight: 600; }

/* SKILLS (rows share the look of the About facts) */
.skills-content { display: grid; gap: clamp(24px, 3vw, 36px); }
.skills-note { max-width: 30ch; font-size: clamp(1.3rem, 2.6vw, 2rem); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }

/* PROJECTS (interactive list: tap or click a row to open it) */
.projects-container { list-style: none; border-top: 1px solid var(--line); }
.project { border-bottom: 1px solid var(--line); }

.project-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 22px 0;
    font: inherit;
    color: var(--ink);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}
.project-name {
    font-size: clamp(1.6rem, 4.6vw, 3.2rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    transition: color .2s, transform .25s;
}
.project-head:hover .project-name,
.project.is-open .project-name { color: var(--red); }
.project-head:hover .project-name { transform: translateX(8px); }
.project-tags { margin-left: auto; font-size: .9rem; color: var(--muted); text-align: right; }

.project-icon { position: relative; flex: none; width: 22px; height: 22px; transition: transform .3s; }
.project-icon::before, .project-icon::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: currentColor; }
.project-icon::after { transform: rotate(90deg); }
.project.is-open .project-icon { transform: rotate(45deg); color: var(--red); }

.project-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.project.is-open .project-panel { grid-template-rows: 1fr; }
.project-panel-inner { min-height: 0; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 32px; align-items: end; }
.project-panel-inner > * { padding-bottom: 28px; }
.project-image { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 12px; }
.project-body { display: flex; flex-direction: column; gap: 20px; }
.project-body p { font-size: clamp(1.1rem, 1.8vw, 1.4rem); line-height: 1.4; max-width: 28ch; }

.project-links { display: flex; flex-wrap: wrap; gap: 10px; }
.project-links a {
    display: inline-block;
    padding: 9px 18px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--bg);
    background: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.project-links a:hover { background: var(--red); border-color: var(--red); color: #fff; }
.project-links a:not(:first-child) { background: transparent; color: var(--ink); }
.project-links a:not(:first-child):hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.project-links a:active { transform: scale(.97); }

@media (max-width: 700px) {
    .project-panel-inner { grid-template-columns: 1fr; }
    .project-tags { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .project-panel, .project-icon, .project-name { transition: none; }
}

/* CONTACT */
#contact h2 { grid-row: 1 / 3; }
#contact .container > p { max-width: 54ch; margin: 0; }
#contact form { display: grid; gap: 16px; max-width: 560px; }
#contact label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }

#contact input[type="text"],
#contact input[type="email"],
#contact textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    transition: border-color .2s, background-color .3s, color .3s;
}
#contact textarea { min-height: 150px; resize: vertical; }
#contact input:focus, #contact textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }

#contact button[type="submit"] {
    justify-self: start;
    padding: 14px 28px;
    font: 600 1rem/1.2 var(--font-base);
    color: var(--bg);
    background: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
#contact button[type="submit"]:hover { background: var(--red); border-color: var(--red); color: #fff; }
#contact button[type="submit"]:active { transform: scale(.97); }
#contact button[type="submit"]:disabled { opacity: .5; cursor: wait; }

/* Form status messages (info while sending, then success or error) */
#form-status {
    display: none;
    padding: 12px 16px;
    font-weight: 600;
    border-radius: 10px;
    border: 1.5px solid var(--line);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .3s, transform .3s;
}
#form-status.info, #form-status.success, #form-status.error { display: block; opacity: 1; transform: none; }
#form-status.success { background: #d1e7dd; color: #0f5132; border-color: #badbcc; }
#form-status.error { background: #f8d7da; color: #842029; border-color: #f5c2c7; }
html[data-theme='dark'] #form-status.success { background: #0f5132; color: #d1e7dd; border-color: #146c43; }
html[data-theme='dark'] #form-status.error { background: #842029; color: #f8d7da; border-color: #9b2a34; }

/* ========================================
   FOOTER
   ======================================== */
footer { color: var(--muted); font-size: .9rem; padding-inline: var(--pad); }
footer .container {
    padding-inline: 0;
    max-width: calc(var(--max) - 2 * var(--pad));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    padding-block: 32px;
    border-top: 1px solid var(--line);
}
footer ul { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; }
footer ul li a { text-decoration: none; color: var(--muted); transition: color .15s; }
footer ul li a:hover { color: var(--red); }

/* ========================================
   ONE LOAD MOMENT
   ======================================== */
@media (prefers-reduced-motion: no-preference) {
    .name { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
    .hero-role { animation: fade .8s .45s ease both; }
    .hero-sub { animation: fade .8s .7s ease both; }
    @keyframes rise { from { opacity: 0; transform: translateY(7%); } to { opacity: 1; transform: none; } }
    @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    #about .container, #projects .container, #skills .container, #contact .container { grid-template-columns: 1fr; }
    #contact h2 { grid-row: auto; }

    header .container { grid-template-columns: 1fr auto; }
    .menu-toggle { display: flex; }

    header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 8px var(--pad) 16px;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
    }
    header nav.nav-open { display: block; }
    header nav ul { flex-direction: column; align-items: stretch; gap: 0; }
    header nav ul li a { display: block; padding: 14px 0; border-top: 1px solid var(--line); font-size: 1.05rem; }

    .menu-toggle.is-active .bar:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .menu-toggle.is-active .bar:nth-child(2) { opacity: 0; }
    .menu-toggle.is-active .bar:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    footer .container { flex-direction: column; align-items: flex-start; }
}
