/* ==========================================================================
   about.emanueldan.ro · 2026
   ========================================================================== */

:root {
    --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --font-serif: 'Instrument Serif', ui-serif, Georgia, serif;

    --radius: 20px;
    --radius-sm: 12px;
    --gutter: clamp(16px, 4vw, 32px);
    --container: 1160px;
    --header-h: 68px;
    --ease: cubic-bezier(.2, .7, .2, 1);

    --bg: #0b0d0c;
    --bg-2: #101311;
    --surface: rgba(255, 255, 255, .028);
    --surface-solid: #131715;
    --border: rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .16);
    --text: #e9ede9;
    --muted: #97a299;
    --faint: #69736c;
    --accent: #9be07a;
    --accent-ink: #0b130a;
    --accent-soft: rgba(155, 224, 122, .12);
    --logo-inner: #0b0d0c;
    --glow-a: rgba(123, 191, 106, .22);
    --glow-b: rgba(64, 140, 160, .16);
    --shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);
    --danger: #ff8a7a;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f5f6f2;
    --bg-2: #ecefe8;
    --surface: rgba(255, 255, 255, .7);
    --surface-solid: #ffffff;
    --border: rgba(16, 22, 16, .09);
    --border-strong: rgba(16, 22, 16, .18);
    --text: #121512;
    --muted: #59625b;
    --faint: #879088;
    --accent: #3a8a28;
    --accent-ink: #ffffff;
    --accent-soft: rgba(58, 138, 40, .1);
    --logo-inner: #f5f6f2;
    --glow-a: rgba(123, 191, 106, .32);
    --glow-b: rgba(64, 140, 160, .16);
    --shadow: 0 30px 60px -34px rgba(20, 40, 20, .28);
    --danger: #c0392b;
    color-scheme: light;
}

/* ---------- Base ---------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.container {
    width: 100%;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.icon { width: 1.1em; height: 1.1em; flex: none; }
.icon.flip { transform: rotate(180deg); }

.skip-link {
    position: fixed; left: 16px; top: -60px; z-index: 100;
    padding: 10px 16px; border-radius: 10px;
    background: var(--accent); color: var(--accent-ink); font-weight: 600;
    transition: top .2s;
}
.skip-link:focus { top: 12px; }

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

.btn {
    display: inline-flex; align-items: center; gap: .55em;
    height: 48px; padding: 0 22px;
    border-radius: 999px; border: 1px solid transparent;
    font-size: 15px; font-weight: 550; letter-spacing: -.005em; white-space: nowrap;
    cursor: pointer;
    transition: transform .2s var(--ease), background-color .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn-small { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -10px var(--accent); }
.btn-primary:hover { box-shadow: 0 10px 30px -8px var(--accent); }
.btn-primary .icon:last-child { transition: transform .2s var(--ease); }
.btn-primary:hover .icon:last-child { transform: translateX(3px); }
.btn-ghost { border-color: var(--border-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--text); }
.btn-link { padding-inline: 8px; color: var(--muted); }
.btn-link:hover { color: var(--text); }
.btn[disabled] { opacity: .6; pointer-events: none; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface);
    cursor: pointer; transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn .icon { width: 18px; height: 18px; }

:root[data-theme="dark"] .when-light,
:root[data-theme="light"] .when-dark { display: none; }

/* ---------- Header ---------- */

.site-header {
    position: sticky; top: 0; z-index: 50;
    height: var(--header-h);
    border-bottom: 1px solid transparent;
    transition: background-color .3s, border-color .3s, backdrop-filter .3s;
}
.is-scrolled .site-header,
.is-menu-open .site-header {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border-bottom-color: var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.02em; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); }
.brand-mark svg { width: 30px; height: 30px; }
.brand-mark path[fill="#7bbf6a"] { fill: var(--accent); }
.brand-mark path[fill="#2c2b2b"] { fill: transparent; }

.site-nav { display: flex; gap: 4px; margin-inline: auto; }
.site-nav a {
    position: relative; padding: 8px 14px; border-radius: 999px;
    font-size: 15px; color: var(--muted); transition: color .2s, background-color .2s;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; }
.menu-toggle .when-open, .is-menu-open .menu-toggle .when-closed { display: none; }
.is-menu-open .menu-toggle .when-open { display: block; }

@media (max-width: 860px) {
    .menu-toggle { display: inline-grid; }
    .header-inner { gap: 12px; }
    .header-actions { margin-left: auto; }
    .site-nav {
        position: fixed; inset: var(--header-h) 0 auto 0;
        flex-direction: column; gap: 0; margin: 0;
        padding: 8px var(--gutter) 20px;
        background: var(--bg); border-bottom: 1px solid var(--border);
        opacity: 0; transform: translateY(-8px); pointer-events: none;
        transition: opacity .2s, transform .2s var(--ease);
    }
    .is-menu-open .site-nav { opacity: 1; transform: none; pointer-events: auto; }
    .site-nav a { padding: 14px 4px; border-radius: 0; font-size: 20px; border-bottom: 1px solid var(--border); }
    .site-nav a.active { background: none; box-shadow: none; color: var(--accent); }
}
@media (max-width: 420px) {
    .brand-name { display: none; }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    margin-top: calc(var(--header-h) * -1);
    padding: calc(var(--header-h) + clamp(56px, 11vh, 120px)) 0 clamp(64px, 9vw, 110px);
    overflow: hidden;
    isolation: isolate;
}
.hero-bg {
    position: absolute; inset: 0; z-index: -1;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
}
.glow { position: absolute; border-radius: 50%; filter: blur(70px); }
.glow-a { width: 46vw; height: 46vw; max-width: 620px; max-height: 620px; top: -12%; right: -6%; background: var(--glow-a); animation: drift 18s ease-in-out infinite alternate; }
.glow-b { width: 34vw; height: 34vw; max-width: 460px; max-height: 460px; top: 30%; left: -8%; background: var(--glow-b); animation: drift 22s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate3d(-6%, 8%, 0) scale(1.08); } }

.status-pill {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 14px 6px 10px; margin-bottom: 28px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
    font-size: 14px; color: var(--muted);
}
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: ping 2s var(--ease) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.eyebrow, .kicker, .project-meta, .timeline-period {
    font-family: var(--font-mono); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.hero-title {
    max-width: 15ch; margin: 14px 0 24px;
    font-size: clamp(2.5rem, 6.6vw, 5.6rem);
    line-height: 1.02; letter-spacing: -.045em; font-weight: 600;
    text-wrap: balance;
}
.hero-title em, .section-head h2 em {
    font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -.02em;
    color: var(--accent);
}
.hero-lead { max-width: 58ch; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    margin: clamp(56px, 8vw, 96px) 0 0;
    border-top: 1px solid var(--border);
}
.stat { padding: 24px 24px 0 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--border); }
.stat dt { display: flex; align-items: baseline; gap: 6px; }
.stat-value { font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-suffix { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.stat dd { margin: 10px 0 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
@media (max-width: 760px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .stat, .stat + .stat { padding: 20px 16px 20px 0; border-left: 0; }
    .stat:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--border); }
    .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(72px, 11vw, 136px); border-top: 1px solid var(--border); }
.section-head { margin-bottom: clamp(36px, 5vw, 56px); }
.kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.kicker span { color: var(--accent); }
.section-head h2, .contact-copy h2 {
    max-width: 20ch; font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.05; letter-spacing: -.035em; text-wrap: balance;
}

.card {
    position: relative; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface);
    padding: clamp(22px, 3vw, 32px);
}
[data-spotlight]::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 60%);
    opacity: 0; transition: opacity .3s;
}
[data-spotlight]:hover::before { opacity: 1; }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.about-grid .section-head { grid-column: 1 / -1; margin-bottom: 0; }
.about-text { display: grid; gap: 1.1em; font-size: clamp(1.05rem, 1.4vw, 1.18rem); color: var(--muted); }
.about-text p:first-child { color: var(--text); }
.offline-card h3 { font-size: 15px; font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 18px; }
.offline-card li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.offline-card li .icon { margin-top: 4px; color: var(--accent); }
.offline-card a { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); }
.offline-card a .icon { width: .9em; height: .9em; margin: 0; }
.award { display: flex; gap: 12px; align-items: center; margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 15px; }
.award .icon { color: var(--accent); width: 22px; height: 22px; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }

/* Work */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.project { display: flex; flex-direction: column; gap: 28px; grid-column: span 2; }
.project h3 { font-size: clamp(1.35rem, 2vw, 1.6rem); margin: 8px 0 10px; }
.project-copy > p { color: var(--muted); }
.project-meta { font-size: 12px; }
.project-visual { margin-top: auto; }
.project-kiosk { grid-column: 1 / -1; flex-direction: row; align-items: stretch; gap: clamp(24px, 4vw, 56px); }
.project-kiosk .project-copy { flex: 1 1 56%; }
.project-kiosk .project-copy > p:not(.project-meta) { font-size: 1.08rem; max-width: 56ch; }
.project-kiosk .project-visual {
    flex: 1 1 44%; margin: 0; display: grid; place-items: center;
    border-radius: var(--radius-sm); background: radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 70%);
    padding: 20px 0 0;
}
@media (max-width: 960px) {
    .project { grid-column: 1 / -1; }
    .project-kiosk { flex-direction: column; }
}
@media (min-width: 960px) {
    .project-platform, .project-mcp { grid-column: span 3; }
}

.checks { display: grid; gap: 10px; margin: 20px 0 0; }
.checks li { display: flex; gap: 10px; font-size: 15.5px; }
.checks .icon { margin-top: 4px; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tags li {
    padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px;
    font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); background: var(--surface);
}

/* Kiosk mock */
.kiosk { display: grid; justify-items: center; }
.kiosk-screen {
    width: 250px; padding: 16px; border-radius: 22px 22px 8px 8px;
    border: 1px solid var(--border-strong); background: var(--surface-solid);
    box-shadow: var(--shadow);
    font-size: 12.5px;
}
.kiosk-stand { width: 70px; height: 54px; background: linear-gradient(var(--border-strong), transparent); clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%); }
.kiosk-top { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.kiosk-steps { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0 16px; padding-bottom: 10px; font-size: 10.5px; color: var(--faint); text-align: center; }
.kiosk-steps::before, .kiosk-steps::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 3px; }
.kiosk-steps::before { right: 0; background: var(--border); }
.kiosk-steps::after { width: 25%; background: var(--accent); animation: kiosk-progress 9s steps(1) infinite; }
@keyframes kiosk-progress { 0% { width: 25%; } 25% { width: 50%; } 50% { width: 75%; } 75% { width: 100%; } }
.kiosk-lines li, .kiosk-total { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.kiosk-lines b, .kiosk-total b { font-family: var(--font-mono); font-weight: 500; }
.kiosk-lines li:nth-child(2) { color: var(--muted); }
.kiosk-total { border: 0; font-weight: 600; font-size: 14px; }
.kiosk-pay { position: relative; display: flex; align-items: center; gap: 8px; height: 40px; margin-top: 8px; padding: 0 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; overflow: hidden; }
.kiosk-pay .icon { transform: rotate(90deg); }
.pay-ok, .pay-wait { position: absolute; left: 38px; transition: opacity .3s; }
.pay-wait { animation: pay-wait 9s steps(1) infinite; }
.pay-ok { opacity: 0; animation: pay-ok 9s steps(1) infinite; }
@keyframes pay-wait { 0% { opacity: 1; } 75% { opacity: 0; } }
@keyframes pay-ok { 0% { opacity: 0; } 75% { opacity: 1; } }

/* Project groups */
.bento-group { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; font-family: var(--font-mono); font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bento-group::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.bento-group:not(:first-child) { margin-top: clamp(32px, 5vw, 56px); }

/* Autonomous house */
.project-home { grid-column: 1 / -1; gap: clamp(28px, 4vw, 44px); }
.home-top { display: flex; gap: clamp(24px, 4vw, 56px); align-items: stretch; }
.home-top .project-copy { flex: 1 1 56%; }
.home-top .project-copy > p:not(.project-meta) { font-size: 1.08rem; max-width: 58ch; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0 0; }
.home-stats div { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.home-stats dt { font-size: 1.6rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.home-stats dd { margin: 4px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--muted); }

.home-log { flex: 1 1 44%; margin: 0; padding: 18px 20px; border-radius: var(--radius-sm); background: #070908; border: 1px solid rgba(255, 255, 255, .08); color: #d5ddd6; }
.home-log-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: #8b968d; }
.home-log ol { display: grid; gap: 2px; }
.home-log li { display: grid; grid-template-columns: 46px 10px 1fr; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px dashed rgba(255, 255, 255, .07); font-size: 13.5px; line-height: 1.4; }
.home-log li:first-child { border-top: 0; }
.home-log li::before { content: ''; grid-column: 2; grid-row: 1; width: 8px; height: 8px; border-radius: 50%; background: #9be07a; align-self: center; }
.home-log time { grid-column: 1; grid-row: 1; font-family: var(--font-mono); font-size: 12px; color: #8b968d; }
.home-log span { grid-column: 3; grid-row: 1; }
.home-log .log-heat::before { background: #ff9f6b; }
.home-log .log-sun::before { background: #ffd166; }
.home-log .log-rain::before { background: #7fb6ff; }
.home-log .log-shade::before { background: #b9a4ff; }
.js .home-log li { opacity: 0; transform: translateX(-6px); }
.js .is-visible .home-log li { opacity: 1; transform: none; transition: opacity .5s, transform .5s var(--ease); }
.js .is-visible .home-log li:nth-child(2) { transition-delay: .25s; }
.js .is-visible .home-log li:nth-child(3) { transition-delay: .5s; }
.js .is-visible .home-log li:nth-child(4) { transition-delay: .75s; }
.js .is-visible .home-log li:nth-child(5) { transition-delay: 1s; }
.js .is-visible .home-log li:nth-child(6) { transition-delay: 1.25s; }
.js .is-visible .home-log li:nth-child(7) { transition-delay: 1.5s; }

.home-subtitle { margin: 0 0 16px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.decisions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.decisions li { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.decision-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.decisions h5 { margin: 0 0 6px; font-size: 1.02rem; font-weight: 600; letter-spacing: -.01em; }
.decisions p { font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.home-built { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); padding-top: clamp(24px, 3vw, 32px); border-top: 1px solid var(--border); }
.home-built .checks { margin-top: 0; }
.home-aside p { color: var(--muted); font-size: 15px; }
@media (max-width: 960px) {
    .home-top { flex-direction: column; }
    .decisions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-built { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .decisions { grid-template-columns: 1fr; }
}

/* Platform flow */
.flow { position: relative; display: grid; gap: 8px; }
.flow::before { content: ''; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 2px; background: linear-gradient(var(--accent), var(--border)); border-radius: 2px; }
.flow li { position: relative; display: grid; grid-template-columns: 76px 1fr; column-gap: 12px; padding: 10px 14px 10px 34px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.flow li::before { content: ''; position: absolute; left: 7px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.flow-step { grid-row: 1 / 3; align-self: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.flow b, .flow-base b { font-weight: 600; font-size: 15px; }
.flow small, .flow-base small { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; }
.flow-base { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent); }
.flow-base b { color: var(--accent); }

/* MCP terminal */
.terminal {
    display: grid; gap: 4px; padding: 16px; border-radius: var(--radius-sm);
    background: #070908; border: 1px solid rgba(255, 255, 255, .08); color: #d5ddd6;
    font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; overflow: hidden;
}
.terminal span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.terminal i { font-style: normal; }
.t-dim { color: #6a756d; }
.t-acc { color: #7fb6ff; }
.t-ok { color: #9be07a; }
.caret { display: inline-block; width: 7px; height: 14px; margin-left: 4px; vertical-align: -2px; background: #9be07a; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.js .terminal span { opacity: 0; transform: translateY(4px); }
.js .is-visible .terminal span { opacity: 1; transform: none; transition: opacity .4s, transform .4s var(--ease); }
.js .is-visible .terminal span:nth-child(2) { transition-delay: .5s; }
.js .is-visible .terminal span:nth-child(3) { transition-delay: 1s; }
.js .is-visible .terminal span:nth-child(4) { transition-delay: 1.6s; }

/* Archive */
.archive { margin-top: clamp(56px, 8vw, 88px); }
.archive-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px 32px; margin-bottom: 24px; }
.archive-head h3 { font-size: 1.35rem; }
.archive-head p { color: var(--muted); max-width: 52ch; font-size: 15px; }
.archive-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.archive-grid a { position: relative; display: grid; gap: 2px; padding: 10px 10px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); overflow: hidden; transition: border-color .2s, transform .3s var(--ease); }
.archive-grid a:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.archive-grid img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 10px; margin-bottom: 10px; filter: grayscale(.85) contrast(.95); opacity: .85; transition: filter .4s, opacity .4s; }
.archive-grid a:hover img { filter: none; opacity: 1; }
.archive-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-inline: 4px; font-weight: 550; font-size: 15px; }
.archive-name .icon { color: var(--faint); width: 16px; height: 16px; transition: color .2s, transform .2s var(--ease); }
.archive-grid a:hover .archive-name .icon { color: var(--accent); transform: translate(2px, -2px); }
.archive-type { padding-inline: 4px; font-size: 13px; color: var(--muted); }
@media (max-width: 960px) { .archive-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Experience */
.timeline { position: relative; display: grid; }
.timeline-item {
    display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px;
    padding: 28px 0; border-top: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: 1px solid var(--border); }
.timeline-period { align-self: start; padding-top: 6px; display: flex; align-items: center; gap: 10px; }
.timeline-period::before { content: ''; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--faint); }
.is-current .timeline-period { color: var(--accent); }
.is-current .timeline-period::before { border: 0; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-body h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); }
.timeline-body .at { font-weight: 400; color: var(--faint); }
.timeline-body a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s var(--ease); }
.timeline-body a:hover { background-size: 100% 1px; }
.timeline-body p { margin-top: 8px; color: var(--muted); max-width: 70ch; }
@media (max-width: 640px) { .timeline-item { grid-template-columns: 1fr; gap: 6px; } }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.skill-group h3 { font-size: 1.1rem; }
.skill-group .tags { margin-top: 16px; }
.skill-group .tags li { color: var(--text); }
.skills-also { margin-top: 24px; color: var(--muted); font-size: 15px; }
@media (max-width: 960px) { .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .skills-grid { grid-template-columns: 1fr; } }

/* Contact */
.contact-section { position: relative; overflow: hidden; }
.contact-section::before {
    content: ''; position: absolute; z-index: -1; width: 700px; height: 700px; left: -200px; bottom: -350px;
    border-radius: 50%; background: var(--glow-a); filter: blur(90px); opacity: .6;
}
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.contact-lead { margin-top: 20px; max-width: 46ch; color: var(--muted); font-size: 1.1rem; }
.contact-links { display: grid; gap: 8px; margin-top: 32px; max-width: 360px; }
.contact-links a {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
    transition: border-color .2s, transform .2s var(--ease);
}
.contact-links a:hover { border-color: var(--border-strong); transform: translateX(3px); }
.contact-links .icon { color: var(--accent); }
.contact-location { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: var(--muted); font-size: 15px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-form { display: grid; gap: 14px; background: var(--surface-solid); box-shadow: var(--shadow); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.field { position: relative; }
.input {
    width: 100%; padding: 24px 16px 10px; border-radius: 14px;
    border: 1px solid var(--border-strong); background: var(--bg);
    color: var(--text); font: inherit; font-size: 16px; resize: vertical;
    transition: border-color .2s, box-shadow .2s;
}
textarea.input { min-height: 140px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field label {
    position: absolute; left: 17px; top: 17px; color: var(--muted); font-size: 16px; pointer-events: none;
    transform-origin: left top; transition: transform .18s var(--ease), color .18s;
}
.input:focus + label, .input:not(:placeholder-shown) + label { transform: translateY(-10px) scale(.75); }
.input:focus + label { color: var(--accent); }
.field.err .input { border-color: var(--danger); }
.field.err label { color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check.err { color: var(--danger); }
.check a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 4px; }
.form-status { font-size: 14.5px; }
.form-status i { display: none; }
.form-status .success-color { color: var(--accent); }
.form-status .alert-color { color: var(--danger); }

/* ---------- Practice, principles, debug loop, AI, personal ---------- */

.section-lead { max-width: 62ch; margin-top: 18px; color: var(--muted); font-size: 1.08rem; }
.ai-title em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -.02em; }

/* Principles */
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: none; }
.principles li { display: grid; align-content: start; gap: 10px; }
.principle-n { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.principles h3 { font-size: 1.2rem; }
.principles p { color: var(--muted); font-size: 15.5px; }
@media (max-width: 960px) { .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .principles { grid-template-columns: 1fr; } }

/* Debug loop */
.loop { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; position: relative; }
.loop li:not(:last-child)::after { content: ''; position: absolute; left: 40px; right: -12px; top: 19px; height: 2px; background: var(--border-strong); }
.loop li { position: relative; display: grid; gap: 8px; align-content: start; }
.loop-n {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--accent); color: var(--accent);
    font-family: var(--font-mono); font-weight: 500; position: relative;
}
.loop li:last-child .loop-n { background: var(--accent); color: var(--accent-ink); }
.loop h3 { margin-top: 6px; font-size: 1.1rem; }
.loop p { color: var(--muted); font-size: 15px; padding-right: 8px; }
@media (max-width: 860px) {
    .loop { grid-template-columns: 1fr; gap: 18px; }
    .loop li:not(:last-child)::after { left: 19px; right: auto; top: 40px; bottom: -18px; width: 2px; height: auto; }
    .loop li { grid-template-columns: 40px 1fr; column-gap: 16px; }
    .loop-n { grid-row: 1 / 3; }
    .loop h3 { margin-top: 8px; }
}

/* AI */
.ai-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.ai-title { max-width: 18ch; font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.05; letter-spacing: -.035em; }
.ai-note { margin-top: 20px; font-family: var(--font-serif); font-style: italic; font-size: 1.25rem; color: var(--muted); }
.ai-terminal { font-size: 13px; padding: 20px; gap: 6px; }
.js .is-visible.ai-terminal span { opacity: 1; transform: none; transition: opacity .4s, transform .4s var(--ease); }
.js .is-visible.ai-terminal span:nth-child(2) { transition-delay: .5s; }
.js .is-visible.ai-terminal span:nth-child(3) { transition-delay: 1s; }
.js .is-visible.ai-terminal span:nth-child(4) { transition-delay: 1.5s; }
.js .is-visible.ai-terminal span:nth-child(5) { transition-delay: 2.1s; }
@media (max-width: 860px) { .ai-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .js .ai-terminal span { opacity: 1; transform: none; } }

/* Practice areas */
.practice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.practice-area { display: flex; flex-direction: column; }
.practice-area h3 { font-size: 1.25rem; margin-bottom: 10px; }
.practice-area > p { color: var(--muted); font-size: 15.5px; }
.practice-proof-label { margin-top: 20px !important; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint) !important; }
.practice-area .checks { margin-top: 10px; }
.practice-area .checks li { font-size: 14.5px; }
@media (max-width: 960px) { .practice { grid-template-columns: 1fr; } }

/* AI */
.ai-uses { margin: 24px 0 12px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ai-grid .checks { margin-top: 0; }

/* Personal */
.personal-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.personal-values { padding-left: 16px; border-left: 2px solid var(--accent); color: var(--text) !important; }
.traits-title { margin: clamp(40px, 6vw, 64px) 0 16px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--border); }
.traits li { display: grid; gap: 4px; padding: 18px 20px 18px 0; border-bottom: 1px solid var(--border); }
.traits b { font-weight: 600; }
.traits span { color: var(--muted); font-size: 15px; }
@media (max-width: 860px) { .personal-grid { grid-template-columns: 1fr; } .traits { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .traits { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); padding: 32px 0 calc(32px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-links a:hover { color: var(--text); }
.footer-note { width: 100%; font-family: var(--font-mono); font-size: 12px; color: var(--faint); }

/* ---------- Legal pages ---------- */

.legal-wrap { padding-block: clamp(48px, 8vw, 96px); }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; margin-bottom: 32px; }
.back-link:hover { color: var(--text); }
.legal { max-width: 72ch; }
.legal h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.035em; margin-bottom: 32px; }
.legal-text { display: grid; gap: 14px; color: var(--muted); }
.legal-text h2 { margin-top: 20px; font-size: 1.2rem; color: var(--text); }
.not-found .kicker { color: var(--accent); }
.not-found p { color: var(--muted); }

/* ---------- Modals ---------- */

.modal {
    width: min(440px, calc(100vw - 32px)); padding: 0;
    border: 1px solid var(--border-strong); border-radius: 24px;
    background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow);
}
.modal[open] { animation: modal-in .3s var(--ease); }
.modal::backdrop { background: rgba(5, 8, 6, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-body { display: grid; justify-items: start; gap: 14px; padding: 32px; }
.modal-body h2 { font-size: 1.5rem; padding-right: 40px; }
.modal-body p { color: var(--muted); font-size: 15.5px; }
.modal-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.modal-icon .icon { width: 24px; height: 24px; }
.g-button { min-height: 44px; }
.auth-in { display: none !important; }
.is-logged .auth-in { display: inline-flex !important; align-items: center; gap: 8px; }
.is-logged .auth-out { display: none; }
.contact-card { display: grid; gap: 10px; width: 100%; }
.contact-card .muted { color: var(--muted); margin-bottom: 8px; }
.contact-row { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); font-family: var(--font-mono); font-size: 15px; transition: border-color .2s; }
.contact-row:hover { border-color: var(--accent); }
.contact-card .btn { justify-content: center; margin-top: 8px; }

/* ---------- Reveal on scroll ---------- */

.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal, .js .terminal span, .js .home-log li { opacity: 1; transform: none; }
}

@media print {
    .site-header, .site-footer, .hero-bg, .contact-form, .modal { display: none !important; }
    .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Experience menu: a small button that opens the list of experiences ---------- */

.xp { position: fixed; left: 16px; bottom: 16px; z-index: 70; font-family: var(--font-sans); }
.xp-toggle {
    display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0;
    border: 1px solid var(--border-strong); border-radius: 999px;
    background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .5);
    transition: color .2s, border-color .2s, transform .3s var(--ease);
}
.xp-toggle .icon { width: 18px; height: 18px; color: var(--accent); transition: transform .4s var(--ease); }
.xp-toggle:hover { color: var(--text); border-color: var(--text); }
.xp-toggle[aria-expanded="true"] { color: var(--text); }
.xp-toggle[aria-expanded="true"] .icon { transform: rotate(-90deg); }
.xp-panel {
    position: absolute; left: 0; bottom: calc(100% + 10px); width: min(340px, calc(100vw - 32px));
    padding: 8px; border: 1px solid var(--border-strong); border-radius: 18px;
    background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6);
    transform-origin: bottom left; animation: xp-in .32s cubic-bezier(.2, 1.3, .4, 1);
}
.xp-panel[hidden] { display: none; }
@keyframes xp-in { from { opacity: 0; transform: translateY(8px) scale(.94); } }
.xp-title { padding: 8px 10px 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.xp-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: var(--text); transition: background-color .2s; }
.xp-item:hover { background: var(--surface); }
.xp-item i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.xp-item i .icon { width: 18px; height: 18px; }
.xp-item b { display: block; font-size: 14.5px; font-weight: 600; }
.xp-item small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.xp-item > .icon { width: 16px; height: 16px; color: var(--faint); transition: transform .2s var(--ease), color .2s; }
.xp-item:hover > .icon { color: var(--accent); transform: translateX(3px); }
.xp-item em { font-style: normal; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.xp-item.is-current { background: var(--accent-soft); }
.xp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
.xp-foot .xp-back { margin-top: 0; border-top: 0; }
.xp-bonus { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12.5px; color: var(--muted); transition: color .2s, background-color .2s; }
.xp-bonus .icon { width: 14px; height: 14px; color: #e0a82e; }
.xp-bonus:hover, .xp-bonus[aria-current] { color: var(--text); background: var(--surface); }
.xp-back { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.xp-back:hover { color: var(--text); }
.xp-back .icon { width: 15px; height: 15px; }
@media (max-width: 600px) { .xp-toggle span { display: none; } .xp-toggle { width: 44px; justify-content: center; padding: 0; } }
@media print { .xp { display: none; } }

/* Debug loop shown inside "How I decide" */
.loop-title { margin: clamp(40px, 6vw, 60px) 0 20px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.loop-compact h4 { margin: 6px 0 0; font-size: 1.02rem; font-weight: 600; letter-spacing: -.01em; }
.loop-compact p { font-size: 14px; }
@media (max-width: 860px) { .loop-compact h4 { margin-top: 8px; } }

/* Language switch */
.lang-switch { width: auto; padding: 0 12px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--muted); }
.lang-switch:hover { color: var(--text); }
