:root {
    --background: #f7f8fa;
    --surface: #ffffff;
    --surface-muted: #edf2f6;
    --text: #18212f;
    --text-muted: #566473;
    --border: #d9e1e8;
    --accent: #1769aa;
    --accent-dark: #104f82;
    --accent-soft: #e7f1f8;
    --max-width: 1120px;
    --radius: 14px;
    --shadow: 0 12px 32px rgba(20, 30, 45, 0.055);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
}
a { color: inherit; }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: 0.6rem 1rem; border: 1px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.container { width: min(calc(100% - 3rem), var(--max-width)); margin: 0 auto; }

/* Shared type and navigation */
.eyebrow {
    margin: 0 0 1.15rem;
    color: var(--accent-dark);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { font-size: 1.05rem; font-weight: 750; letter-spacing: -0.025em; text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.site-nav a { color: var(--text-muted); font-size: 0.94rem; font-weight: 550; text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--accent-dark); }
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.7rem;
    min-height: 46px; padding: 0.75rem 1.15rem;
    border: 1px solid transparent; border-radius: 8px;
    font-weight: 700; text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--accent-dark); color: #fff; }
.button-primary:hover { background: #0b3b62; }
.button-secondary { background: var(--surface); border-color: var(--border); }
.button-secondary:hover { border-color: var(--accent); }
.text-link, .project-link { color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.text-link:hover, .project-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Home */
.hero { padding: clamp(4.5rem, 9vw, 7.5rem) 0; background: #eaf1f6; border-bottom: 1px solid var(--border); }
.hero-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: clamp(3rem, 7vw, 7rem); align-items: end; }
.hero h1 { max-width: 840px; margin: 0; font-size: clamp(3rem, 5.9vw, 5.3rem); line-height: 1.04; letter-spacing: -0.055em; }
.hero-copy { max-width: 710px; margin: 1.8rem 0 0; color: #3e5060; font-size: clamp(1.1rem, 1.5vw, 1.25rem); line-height: 1.65; }
.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 2.3rem; }
.hero-actions > .text-link { align-self: center; }
.hero-aside { padding: 1.35rem 0 0 1.4rem; border-left: 2px solid var(--accent); }
.hero-aside .eyebrow { margin-bottom: 0.8rem; }
.hero-aside > p:not(.eyebrow) { margin: 0 0 1rem; font-size: 1.12rem; font-weight: 700; line-height: 1.45; letter-spacing: -0.02em; }
.hero-aside span { color: var(--text-muted); font-size: 0.9rem; }
.section { padding: clamp(4.5rem, 7vw, 6.5rem) 0; }
.section-muted { background: var(--surface-muted); border-block: 1px solid var(--border); }
.section-heading { display: grid; grid-template-columns: 1fr 0.75fr; gap: 3rem; align-items: end; margin-bottom: 2.5rem; }
.section-heading h2 { max-width: 720px; margin: 0; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.12; letter-spacing: -0.042em; }
.section-heading > p { max-width: 420px; margin: 0; color: var(--text-muted); font-size: 1.06rem; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.project-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    transition: border-color 150ms ease, transform 150ms ease;
}
.project-card:hover { border-color: #b4c8d9; transform: translateY(-3px); }
.project-card:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.project-card-link {
    display: flex; flex-direction: column; min-height: 300px; height: 100%;
    padding: clamp(1.5rem, 3vw, 2.15rem); text-decoration: none;
}
.project-card-link:focus-visible { outline: none; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 2.6rem; }
.capability-index { color: #627383; font-size: 0.77rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.project-kind { display: inline-flex; color: var(--text-muted); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
.project-kind-personal { color: #785d20; }
.project-kind-learning { color: #5741a3; }
.project-card h3 { margin: 0 0 0.8rem; font-size: clamp(1.5rem, 2.3vw, 1.85rem); line-height: 1.23; letter-spacing: -0.035em; }
.project-card:hover h3, .project-card:focus-within h3 { color: var(--accent-dark); }
.project-card p { margin: 0; color: var(--text-muted); }
.project-link { align-self: flex-start; margin-top: auto; padding-top: 2rem; }
.project-card:hover .project-link, .project-card:focus-within .project-link { text-decoration: underline; text-underline-offset: 4px; }
.empty-state { grid-column: 1 / -1; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); }
.status { display: inline-flex; padding: 0.3rem 0.7rem; border-radius: 100px; background: var(--accent-soft); color: var(--accent-dark); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.05em; line-height: 1.5; text-transform: uppercase; }
.status-learning { background: #fff3d6; color: #805600; }
.status-prototype { background: #eee9ff; color: #5741a3; }
.capability-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.capability { min-height: 245px; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.capability h3 { margin: 2.4rem 0 0.65rem; font-size: 1.15rem; line-height: 1.3; letter-spacing: -0.025em; }
.capability p { margin: 0; color: var(--text-muted); font-size: 0.94rem; }
.lab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.lab-item { padding: 1.5rem; border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.lab-item h3 { margin: 0 0 0.7rem; font-size: 1.15rem; line-height: 1.3; letter-spacing: -0.025em; }
.lab-item p { margin: 0; color: var(--text-muted); font-size: 0.94rem; }
.lab-link { display: inline-block; margin-top: 1.75rem; font-size: 0.97rem; }
.about-layout { grid-template-columns: 1fr 1.1fr; align-items: start; margin-bottom: 0; }
.about-copy { max-width: 650px; color: var(--text-muted); font-size: 1.06rem; }
.about-copy p { margin: 0 0 1rem; }
.about-copy p:last-child { margin-bottom: 0; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

/* Portfolio assistant */
.assistant-launcher { position: fixed; right: calc(1.25rem + env(safe-area-inset-right)); bottom: calc(1.25rem + env(safe-area-inset-bottom)); z-index: 10; display: inline-flex; align-items: center; gap: 0.7rem; min-height: 54px; padding: 0.45rem 1rem 0.45rem 0.45rem; border: 1px solid #0b3b62; border-radius: 100px; background: var(--accent-dark); color: #fff; box-shadow: 0 9px 26px rgba(20, 30, 45, 0.2); font: inherit; font-size: 0.91rem; font-weight: 700; cursor: pointer; }
.assistant-launcher:hover { background: #0b3b62; }
.assistant-launcher-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 2.35rem; width: 2.35rem; height: 2.35rem; overflow: hidden; border-radius: 50%; }
.assistant-avatar { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: center; }
.assistant-launcher:focus-visible, .assistant-close:focus-visible, .assistant-suggestion:focus-visible, .assistant-form input:focus-visible, .assistant-form button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.assistant-drawer:not([open]) { display: none; }
.assistant-drawer[open] { position: fixed; inset: 0 0 0 auto; display: flex; flex-direction: column; width: min(100vw, 420px); height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; border-left: 1px solid #bacbd8; border-radius: 0; background: var(--surface); color: var(--text); box-shadow: -18px 0 45px rgba(20, 30, 45, 0.16); animation: assistant-drawer-enter 180ms ease-out; }
.assistant-drawer::backdrop { background: rgba(20, 30, 45, 0.38); }
.assistant-panel-header { display: flex; align-items: center; gap: 0.7rem; min-height: 68px; padding: 0.85rem 1.2rem; border-bottom: 1px solid var(--border); }
.assistant-panel-header h2 { margin: 0; font-size: 1rem; line-height: 1.3; letter-spacing: -0.025em; }
.assistant-panel-icon, .assistant-message-marker { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1.9rem; width: 1.9rem; height: 1.9rem; overflow: hidden; border-radius: 50%; }
.assistant-close { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-left: auto; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-muted); font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.assistant-close:hover { border-color: var(--border); background: var(--surface-muted); color: var(--text); }
.assistant-description { margin: 0; padding: 1rem 1.2rem 0.8rem; color: var(--text-muted); font-size: 0.91rem; line-height: 1.5; }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; max-height: 120px; padding: 0 1.2rem 1rem; overflow-y: auto; border-bottom: 1px solid var(--border); }
.assistant-suggestion { padding: 0.38rem 0.68rem; border: 1px solid #bed0dd; border-radius: 100px; background: var(--surface); color: var(--accent-dark); font: inherit; font-size: 0.8rem; font-weight: 650; line-height: 1.4; cursor: pointer; }
.assistant-suggestion:hover { border-color: var(--accent); background: var(--accent-soft); }
.assistant-conversation { display: flex; flex: 1; flex-direction: column; gap: 0.9rem; min-height: 0; margin: 0; padding: 1.15rem 1.2rem; overflow-y: auto; background: #f7f9fb; list-style: none; }
.assistant-message { display: flex; align-items: flex-start; gap: 0.55rem; max-width: 94%; font-size: 0.92rem; }
.assistant-message--user { align-self: flex-end; }
.assistant-message-body { padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.assistant-message--user .assistant-message-body { border-color: #bdd8ea; background: var(--accent-soft); color: var(--text); }
.assistant-compose { padding: 0.85rem 1.2rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.assistant-status, .assistant-error { margin: 0 0 0.5rem; font-size: 0.84rem; line-height: 1.4; }
.assistant-status { color: var(--text-muted); }
.assistant-status:empty { display: none; }
.assistant-error { color: #9a302f; }
.assistant-error[hidden] { display: none; }
.assistant-form label { display: block; margin-bottom: 0.45rem; font-size: 0.84rem; font-weight: 700; }
.assistant-form-row { display: flex; gap: 0.55rem; }
.assistant-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0.65rem 0.75rem; border: 1px solid #aabdc9; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 0.91rem; }
.assistant-form button { min-height: 44px; cursor: pointer; }
.assistant-form button:disabled, .assistant-suggestion:disabled { opacity: 0.55; cursor: wait; }
.assistant-privacy { margin: 0.7rem 0 0; color: var(--text-muted); font-size: 0.75rem; line-height: 1.4; }
@keyframes assistant-drawer-enter { from { transform: translateX(20px); opacity: 0.8; } to { transform: translateX(0); opacity: 1; } }

/* Case studies */
.case-study-header { padding: clamp(2.5rem, 5vw, 4.5rem) 0 clamp(3.5rem, 6vw, 5rem); background: var(--surface); border-bottom: 1px solid var(--border); }
.back-link { display: inline-flex; gap: 0.5rem; align-items: center; color: var(--text-muted); font-size: 0.91rem; font-weight: 650; text-decoration: none; }
.back-link:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 4px; }
.case-study-heading { display: flex; align-items: start; justify-content: space-between; gap: 2rem; margin-top: clamp(3rem, 6vw, 5rem); }
.case-study-heading .eyebrow { margin-bottom: 0.9rem; }
.case-study-heading h1 { max-width: 890px; margin: 0; font-size: clamp(2.7rem, 5.5vw, 4.8rem); line-height: 1.06; letter-spacing: -0.05em; }
.case-study-tags { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.75rem; flex-shrink: 0; margin-top: 0.2rem; }
.case-study-intro { display: grid; grid-template-columns: 180px minmax(0, 720px); gap: 2rem; margin-top: clamp(2.5rem, 5vw, 4rem); padding-top: 1.75rem; border-top: 1px solid var(--border); }
.case-study-label { margin: 0; color: var(--accent-dark); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.11em; text-transform: uppercase; }
.case-study-summary { color: #435263; font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.7; overflow-wrap: anywhere; }
.case-study-summary p { margin: 0 0 1em; }
.case-study-summary p:last-child { margin-bottom: 0; }
.case-study-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.case-study { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.case-study-layout { display: grid; grid-template-columns: 180px minmax(0, 720px); gap: clamp(2rem, 6vw, 5rem); justify-content: center; }
.case-study-layout--visual { grid-template-columns: 180px minmax(0, 1fr); }
.case-study-nav { display: flex; flex-direction: column; gap: 0.55rem; align-self: start; position: sticky; top: 2rem; padding-left: 1rem; border-left: 1px solid var(--border); }
.case-study-nav span { margin-bottom: 0.45rem; color: #627383; font-size: 0.74rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.case-study-nav a { color: var(--text-muted); font-size: 0.93rem; text-decoration: none; }
.case-study-nav a:hover, .case-study-nav a:focus-visible { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 4px; }
.case-study-content { min-width: 0; }
.case-study-section { margin-bottom: clamp(3rem, 6vw, 5rem); padding-bottom: clamp(3rem, 6vw, 5rem); border-bottom: 1px solid var(--border); scroll-margin-top: 2rem; }
.case-study-section .eyebrow { margin-bottom: 0.8rem; }
.case-study-section h2 { margin: 0 0 1.45rem; font-size: clamp(2rem, 3.2vw, 2.7rem); line-height: 1.15; letter-spacing: -0.04em; }
.case-study-copy { color: #435263; font-size: 1.08rem; line-height: 1.8; overflow-wrap: anywhere; }
.case-study-layout--visual .case-study-copy { max-width: 720px; }
.case-study-copy p { margin: 0 0 1.15rem; }
.case-study-copy p:last-child { margin-bottom: 0; }
.screenshot-intro { margin: -0.55rem 0 2rem; color: var(--text-muted); font-size: 0.94rem; }
.screenshot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 4vw, 3rem) 1.5rem; }
.screenshot { margin: 0; }
.screenshot:first-child { grid-column: 1 / -1; }
.screenshot-link { display: block; border-radius: 8px; text-decoration: none; }
.screenshot-link img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); box-shadow: var(--shadow); }
.screenshot-link:hover img, .screenshot-link:focus-visible img { border-color: var(--accent); }
.screenshot figcaption { margin-top: 0.85rem; color: var(--text-muted); font-size: 0.91rem; line-height: 1.55; }
.screenshot-dialog { width: min(96vw, 1440px); max-width: none; max-height: calc(100dvh - 2rem); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(20, 30, 45, 0.25); }
.screenshot-dialog::backdrop { background: rgba(20, 30, 45, 0.75); }
.screenshot-dialog-panel { padding: clamp(1rem, 2vw, 1.5rem); }
.screenshot-dialog-controls { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.screenshot-dialog-close { padding: 0.3rem 0.5rem; border: 0; border-radius: 4px; background: transparent; color: var(--accent-dark); font: inherit; font-weight: 700; cursor: pointer; }
.screenshot-dialog-close:hover { background: var(--accent-soft); }
.screenshot-dialog-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.screenshot-dialog-image { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 9rem); margin: 0 auto; object-fit: contain; }
.screenshot-dialog-caption { margin: 1rem 0 0; color: var(--text-muted); font-size: 0.94rem; text-align: center; }
.screenshot-dialog-caption:empty { display: none; }
.case-study-end-link { margin-top: 0.2rem; }
.site-footer { padding: 2.5rem 0; background: var(--surface); border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; }
.site-footer p { margin: 0; }

@media (max-width: 900px) {
    .hero-layout { grid-template-columns: 1fr; gap: 3rem; }
    .hero-aside { max-width: 530px; }
    .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .capability { min-height: 210px; }
    .screenshot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .container { width: min(calc(100% - 2rem), var(--max-width)); }
    .section-heading, .about-layout, .case-study-layout, .case-study-layout--visual, .case-study-intro { grid-template-columns: 1fr; gap: 1.5rem; }
    .section-heading { margin-bottom: 2rem; }
    .about-layout { margin-bottom: 0; }
    .lab-grid { grid-template-columns: 1fr; }
    .project-grid { grid-template-columns: 1fr; }
    .project-card-link { min-height: 260px; }
    .case-study-heading { flex-direction: column-reverse; gap: 1.2rem; }
    .case-study-tags { justify-content: flex-start; }
    .case-study-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0 0 1.25rem; border-left: 0; border-bottom: 1px solid var(--border); }
    .case-study-nav span { flex-basis: 100%; margin: 0; }
    .case-study-nav a { padding: 0.15rem 0; }
}
@media (max-width: 520px) {
    .header-inner { align-items: flex-start; flex-direction: column; gap: 0.4rem; padding-block: 1rem; }
    .site-nav { gap: 0.5rem 1.25rem; }
    .hero h1 { font-size: clamp(2.65rem, 12vw, 3.3rem); }
    .capability-grid { grid-template-columns: 1fr; }
    .capability { min-height: 0; }
    .capability h3 { margin-top: 1.2rem; }
    .assistant-launcher { right: calc(0.9rem + env(safe-area-inset-right)); bottom: calc(0.9rem + env(safe-area-inset-bottom)); }
    .assistant-drawer[open] { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .button, .project-card { transition: none; }
    .assistant-drawer[open] { animation: none; }
}
