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

:root {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);
    --accent: #c0602a;
    --border: rgba(255, 255, 255, 0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

button,
input,
textarea {
    font: inherit;
}

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

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 0 48px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    border-bottom: 1px solid var(--border);
    transition: height 0.4s ease, padding 0.4s ease;
}

.nav.scrolled {
    height: 52px;
}

.nav-logo {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 36px;
    list-style: none;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.nav-links a:hover {
    opacity: 1;
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 210;
}

.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 199;
    background: rgba(0, 0, 0, 0.97);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-mobile.open {
    opacity: 1;
    visibility: visible;
}

.nav-mobile a {
    color: var(--text);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
    transition: opacity 0.3s, color 0.3s;
}

.nav-mobile a:hover {
    opacity: 1;
    color: var(--accent);
}

/* Hero */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: -30px;
    background: center center / cover no-repeat;
    transition: transform 0.4s ease-out;
    will-change: transform;
    z-index: 0;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
}

.hero-name {
    font-size: clamp(3.5rem, 10vw, 9rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 0.95;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(40px);
}

.hero-name span {
    display: block;
}

.hero-divider {
    margin: 28px auto 0;
    border: none;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transform: scaleX(0);
}

.hero-tagline {
    margin-top: 20px;
    font-size: clamp(0.9rem, 1.5vw, 1.15rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0;
    transform: translateY(20px);
}

.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
}

.hero-scroll span {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.hero-scroll .chevron {
    width: 20px;
    height: 20px;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.4; }
    50% { transform: rotate(45deg) translate(4px, 4px); opacity: 1; }
}

.section {
    padding: 140px 48px;
    position: relative;
}

.section-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 24px;
}

.section-heading {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 32px;
}

.about {
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.about-statement {
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.about-statement .highlight {
    color: var(--accent);
}

.about-body {
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.9;
    color: var(--text-secondary);
}

.about-body a {
    color: var(--accent);
    text-decoration: none;
}

.about-body p + p {
    margin-top: 24px;
}

.skills {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
    margin-top: 64px;
}

.skill-card {
    padding: 40px 0;
    border-top: 2px solid var(--accent);
}

.skill-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.skill-list {
    list-style: none;
}

.skill-list li {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.skill-list li:last-child {
    border-bottom: none;
}

.gallery {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.gallery-track {
    display: flex;
    gap: 24px;
    margin-top: 64px;
    padding: 0 48px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    cursor: default;
    user-select: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-item {
    flex-shrink: 0;
    width: 400px;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.subscribe {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.subscribe-text {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.subscribe-form {
    display: flex;
    gap: 12px;
    max-width: 440px;
    margin: 0 auto;
}

.subscribe-form input[type="email"],
.subscribe-form input[type="text"] {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
}

.subscribe-form input::placeholder {
    color: var(--text-muted);
}

.subscribe-form input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.subscribe-form button {
    padding: 14px 28px;
    background: var(--accent);
    color: var(--text);
    border: none;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.3s, transform 0.2s;
}

.subscribe-form button:hover {
    opacity: 0.88;
    transform: translateY(-2px);
}

.subscribe-form button:active {
    transform: translateY(0);
}

.subscribe-form button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.subscribe-status {
    margin-top: 16px;
    font-size: 0.9rem;
    min-height: 24px;
}

.subscribe-status.success { color: #6ee7b7; }
.subscribe-status.error { color: #fca5a5; }

.contact {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.contact-intro h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}

.contact-intro p:not(.section-label) {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 440px;
}

.contact-form {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.3s, background 0.3s;
    outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

.challenge-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.challenge-row .question {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.challenge-row input {
    width: 72px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    text-align: center;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
}

.challenge-row input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.btn-send {
    width: 100%;
    padding: 16px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
}

.btn-send:hover {
    opacity: 0.88;
    transform: translateY(-2px);
}

.btn-send:active {
    transform: translateY(0);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.form-status {
    margin-top: 16px;
    text-align: center;
    font-size: 0.9rem;
    min-height: 24px;
}

.form-status.success { color: #6ee7b7; }
.form-status.error { color: #fca5a5; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transform: scale(0.92);
    transition: transform 0.3s ease;
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close::before,
.lightbox-close::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
    transition: background 0.2s;
}

.lightbox-close::before { transform: rotate(45deg); }
.lightbox-close::after { transform: rotate(-45deg); }

.lightbox-close:hover::before,
.lightbox-close:hover::after {
    background: #fff;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 3rem;
    cursor: pointer;
    padding: 16px;
    line-height: 1;
    transition: color 0.2s;
    z-index: 1002;
    user-select: none;
}

.lightbox-arrow:hover {
    color: #fff;
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.footer {
    padding: 40px 48px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left,
.footer-right {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-right {
    letter-spacing: 0.05em;
}

.reveal {
    opacity: 0;
    transform: translateY(50px);
}

/* Article pages don't load GSAP — make .reveal elements visible by default
   so they don't get stuck at opacity:0. */
.articles-page .reveal,
.article-page .reveal {
    opacity: 1;
    transform: none;
}

/* ---------- Articles ---------- */

.articles-page,
.article-page {
    padding-top: 64px;
}

.articles-main,
.article-main {
    min-height: calc(100vh - 64px - 100px);
}

.articles-list {
    list-style: none;
    margin-top: 64px;
    display: grid;
    gap: 32px;
}

.article-card a {
    display: block;
    padding: 28px 0;
    border-top: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.article-card a:hover {
    opacity: 0.85;
}

.article-card .article-date {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.article-card .article-title {
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.article-card .article-excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

.articles-empty,
.signed-in-note {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-top: 32px;
}

/* ---------- Article reader ---------- */

.article-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 24px 120px;
}

.back-link {
    margin-bottom: 32px;
}

.back-link a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.back-link a:hover {
    color: var(--text);
}

.article-meta-date {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
}

.article-headline {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.article-lede {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 48px;
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text);
}

.article-body p {
    margin-bottom: 1.4em;
}

.article-body h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 2.2em 0 0.8em;
}

.article-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.8em 0 0.6em;
}

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

.article-body img {
    border-radius: 12px;
    margin: 1.5em 0;
}

.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 24px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 1.5em 0;
}

.article-body code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.article-body pre {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.article-body pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
    line-height: 1.55;
}

/* ---------- Sign-in (magic link) ---------- */

.signin-card,
.paywall {
    margin-top: 56px;
    padding: 36px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 520px;
}

.paywall {
    margin-top: 48px;
}

.signin-card h3,
.paywall h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.signin-card p,
.paywall p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.signin-form {
    display: flex;
    gap: 12px;
}

.signin-form input[type="email"] {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
}

.signin-form input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.signin-form input::placeholder {
    color: var(--text-muted);
}

.signin-form button {
    padding: 14px 22px;
    background: var(--accent);
    color: var(--text);
    border: none;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.signin-form button:hover {
    opacity: 0.88;
}

.signin-form button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.signin-status {
    margin-top: 14px;
    min-height: 22px;
    font-size: 0.9rem;
}

.signin-status.success { color: #6ee7b7; }
.signin-status.error { color: #fca5a5; }

.signin-footnote {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.signin-footnote a {
    color: var(--accent);
    text-decoration: none;
}

/* ---------- Nav button (sign out) ---------- */

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.nav-link-button {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.3s ease;
}

.nav-link-button:hover {
    opacity: 1;
}

.nav-mobile-button {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.3s, color 0.3s;
}

.nav-mobile-button:hover {
    opacity: 1;
    color: var(--accent);
}

@media (max-width: 600px) {
    .signin-form { flex-direction: column; }
    .article-main { padding: 56px 20px 80px; }
    .article-card a { padding: 22px 0; }
}

@media (max-width: 1024px) {
    .section { padding: 100px 32px; }
    .about-grid { gap: 48px; }
    .contact-grid { gap: 48px; }
    .skills-grid { gap: 32px; }
}

@media (max-width: 860px) {
    .nav { padding: 20px 24px; }
    .nav-links { gap: 24px; }
    .section { padding: 80px 24px; }
    .about-grid { grid-template-columns: 1fr; gap: 32px; }
    .skills-grid { grid-template-columns: 1fr; gap: 24px; }
    .contact-grid { grid-template-columns: 1fr; gap: 40px; }
    .gallery-track { padding: 0 24px; gap: 16px; }
    .gallery-item { width: 300px; height: 225px; }
}

@media (max-width: 600px) {
    .nav { padding: 0 20px; height: 56px; }
    .nav-links { display: none; }
    .nav-hamburger { display: flex; }
    .nav-mobile { display: flex; }
    .section { padding: 64px 20px; }
    .footer { flex-direction: column; gap: 12px; text-align: center; padding: 32px 20px; }
    .contact-form { padding: 28px 20px; }
    .gallery-track { padding: 0 20px; gap: 12px; }
    .gallery-item { width: 260px; height: 195px; }
    .subscribe-form { flex-direction: column; }
}
