/* ============================================================
   M. Zaki Ramdhan — Portfolio
   Design system: "Engineering Dossier"
   Dark graphite ground · hairline rules · mono data readouts
   ============================================================ */

:root {
    /* Color */
    --bg: #0b0f14;
    --bg-raise: #0f141b;
    --surface: #111722;
    --ink: #e9eef4;
    --ink-soft: #aab6c2;
    --ink-mute: #76838f;
    --line: rgba(233, 238, 244, 0.09);
    --line-strong: rgba(233, 238, 244, 0.2);
    --accent: #3fd6ab;
    --accent-ink: #062019;
    --accent-dim: rgba(63, 214, 171, 0.14);
    --amber: #f0b243;

    /* Type */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Rhythm */
    --space-section: clamp(5.5rem, 11vw, 9rem);
    --container: 1200px;
    --gutter: clamp(20px, 4vw, 48px);
    --radius: 4px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset & base ---------- */

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

html {
    background: var(--bg);
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

::selection {
    background: rgba(63, 214, 171, 0.3);
    color: var(--ink);
}

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

ul,
ol {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.container {
    width: min(var(--container), 100% - 2 * var(--gutter));
    margin-inline: auto;
}

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

.skip-link {
    position: fixed;
    top: -100px;
    left: 16px;
    z-index: 3000;
    padding: 0.7rem 1.1rem;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    border-radius: var(--radius);
    transition: top 0.2s var(--ease-out);
}

.skip-link:focus {
    top: 16px;
}

/* ---------- Backdrop: faint blueprint grid ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(233, 238, 244, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(233, 238, 244, 0.025) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.25) 60%, transparent);
}

/* ---------- Reveal motion (JS adds .is-revealed; reduced-motion users skip) ---------- */

@media (prefers-reduced-motion: no-preference) {
    html.js [data-reveal] {
        opacity: 0;
        transform: translateY(22px);
        transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
        transition-delay: var(--reveal-delay, 0ms);
    }

    html.js [data-reveal].is-revealed {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}

/* ---------- Top bar ---------- */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    /* containing block for the absolutely positioned mobile menu */
    transform: translateZ(0);
    background: rgba(11, 15, 20, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, background 0.3s;
}

.topbar.scrolled {
    background: rgba(11, 15, 20, 0.94);
    border-bottom-color: var(--line);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.98rem;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-menu a {
    display: inline-block;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius);
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
}

.nav-menu a:hover {
    color: var(--ink);
    background: rgba(233, 238, 244, 0.06);
}

.nav-menu a[aria-current="true"] {
    color: var(--accent);
}

.nav-menu .nav-cta {
    margin-left: 0.5rem;
    border: 1px solid var(--line-strong);
    color: var(--ink);
}

.nav-menu .nav-cta:hover,
.nav-menu .nav-cta[aria-current="true"] {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
}

.nav-toggle-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--ink);
    transition: transform 0.25s var(--ease-out), top 0.25s var(--ease-out);
}

.nav-toggle-bar:nth-child(1) {
    top: 17px;
}

.nav-toggle-bar:nth-child(2) {
    top: 25px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    top: 21px;
    transform: rotate(-45deg);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 50px;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease-out);
}

.btn .arr {
    transition: transform 0.25s var(--ease-out);
}

.btn:hover .arr {
    transform: translateX(4px);
}

.btn-solid {
    background: var(--accent);
    color: var(--accent-ink);
}

.btn-solid:hover {
    background: #66e3c0;
}

.btn-line {
    border: 1px solid var(--line-strong);
    color: var(--ink);
}

.btn-line:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* ---------- Registration marks (engineering-drawing corner ticks) ---------- */

.rm {
    position: absolute;
    width: 13px;
    height: 13px;
    pointer-events: none;
    z-index: 3;
}

.rm::before,
.rm::after {
    content: '';
    position: absolute;
    background: var(--line-strong);
}

.rm::before {
    top: 6px;
    left: 0;
    width: 13px;
    height: 1px;
}

.rm::after {
    top: 0;
    left: 6px;
    width: 1px;
    height: 13px;
}

.rm-tl {
    top: -7px;
    left: -7px;
}

.rm-tr {
    top: -7px;
    right: -7px;
}

.rm-bl {
    bottom: -7px;
    left: -7px;
}

.rm-br {
    bottom: -7px;
    right: -7px;
}

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

.hero {
    padding-top: clamp(7.5rem, 16vh, 11rem);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    align-items: center;
    gap: clamp(2.5rem, 6vw, 5.5rem);
    padding-bottom: clamp(3.5rem, 7vw, 5.5rem);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink-soft);
    margin-bottom: 1.6rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-dim);
}

.hero h1 {
    font-size: clamp(2.7rem, 6.4vw, 5.1rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1.6rem;
    max-width: 14ch;
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero-lede {
    max-width: 56ch;
    color: var(--ink-soft);
    font-size: clamp(1.02rem, 1.6vw, 1.16rem);
    margin-bottom: 2.2rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.hero-status {
    color: var(--ink-mute);
}

.hero-portrait {
    justify-self: end;
    width: min(380px, 100%);
}

.hero-portrait .frame {
    position: relative;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    padding: 10px;
}

.hero-portrait img {
    width: 100%;
    aspect-ratio: 1 / 1.08;
    object-fit: cover;
    object-position: center 30%;
    filter: grayscale(18%) contrast(1.04);
}

.hero-portrait figcaption {
    margin-top: 0.9rem;
    color: var(--ink-mute);
    line-height: 1.7;
}

/* Spec strip */

.spec-strip {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(15, 20, 27, 0.55);
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.spec {
    display: flex;
    flex-direction: column;
    padding: 1.6rem 1.4rem 1.5rem 0;
}

.spec dt {
    flex-grow: 1;
}

.spec + .spec {
    padding-left: 1.4rem;
    border-left: 1px solid var(--line);
}

.spec dt {
    color: var(--ink-mute);
    margin-bottom: 0.55rem;
}

.spec dd {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.spec-sub {
    color: var(--ink-mute);
    font-size: 0.55em;
    font-weight: 500;
}

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

.section {
    padding-top: var(--space-section);
}

.section:last-of-type {
    padding-bottom: var(--space-section);
}

.section-head {
    display: grid;
    grid-template-columns: auto 1fr minmax(0, 380px);
    align-items: end;
    gap: 1.2rem 2.5rem;
    border-top: 1px solid var(--line-strong);
    padding-top: 1.4rem;
    margin-bottom: clamp(2.8rem, 6vw, 4.5rem);
}

.sec-index {
    color: var(--accent);
    font-size: 0.95rem;
    line-height: 1;
    padding-top: 0.4rem;
}

.section-head h2 {
    font-size: clamp(2rem, 4.4vw, 3.3rem);
    letter-spacing: -0.025em;
}

.sec-desc {
    color: var(--ink-mute);
    font-size: 0.95rem;
    line-height: 1.6;
    justify-self: end;
    text-align: right;
    max-width: 38ch;
}

.block-label {
    color: var(--accent);
    margin-bottom: 1.4rem;
}

/* ---------- 01 Profile ---------- */

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(2.5rem, 6vw, 5rem);
}

.about-lead {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.4vw, 1.6rem);
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.01em;
    margin-bottom: 1.4rem;
}

.about-main p + p {
    margin-top: 1.1rem;
}

.about-main p {
    color: var(--ink-soft);
}

.about-main .about-lead {
    color: var(--ink);
}

.edu-list {
    display: grid;
    gap: 1.8rem;
}

.edu-item {
    border-left: 1px solid var(--line-strong);
    padding-left: 1.4rem;
}

.edu-years {
    color: var(--ink-mute);
    margin-bottom: 0.5rem;
}

.edu-item h4 {
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
}

.edu-role {
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.edu-note {
    color: var(--ink-mute);
    font-size: 0.92rem;
}

/* ---------- 02 Selected work: case studies ---------- */

.case {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2.2rem, 5vw, 4.5rem);
    align-items: start;
    padding: clamp(2.2rem, 5vw, 3.6rem) 0;
}

.case + .case {
    border-top: 1px solid var(--line);
}

.case-flip .case-media {
    order: 2;
}

.case-media {
    position: sticky;
    top: 100px;
}

.media-btn {
    position: relative;
    display: block;
    width: 100%;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    padding: 10px;
    text-align: left;
    transition: border-color 0.25s;
}

.media-btn:hover {
    border-color: var(--accent);
}

.media-btn img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top center;
    transition: filter 0.3s;
}

.media-btn:hover img {
    filter: brightness(1.06);
}

.media-hint {
    display: inline-block;
    margin-top: 0.8rem;
    color: var(--ink-mute);
    transition: color 0.2s;
}

.media-btn:hover .media-hint {
    color: var(--accent);
}

.case-kicker {
    color: var(--accent);
    margin-bottom: 1rem;
}

.case h3 {
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    margin-bottom: 1rem;
    max-width: 22ch;
}

.case-summary {
    color: var(--ink-soft);
    font-size: 1.04rem;
    max-width: 58ch;
    margin-bottom: 1.8rem;
}

.case-cols {
    display: grid;
    gap: 1.1rem;
    margin-bottom: 1.8rem;
}

.case-cols > div {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 1.2rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.case-cols dt {
    color: var(--ink-mute);
    font-size: 0.72rem;
    padding-top: 0.25rem;
}

.case-cols dd {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.case-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.case-facts li {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 0.34rem 0.8rem;
    color: var(--ink);
    font-size: 0.72rem;
    background: rgba(233, 238, 244, 0.03);
}

.case-stack {
    color: var(--ink-mute);
}

.case-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.2rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.92rem;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.case-link:hover {
    border-bottom-color: var(--accent);
}

/* Further projects bench */

.bench {
    margin-top: clamp(2.5rem, 6vw, 4rem);
}

.bench-title {
    color: var(--ink-mute);
    border-top: 1px solid var(--line-strong);
    padding-top: 1.2rem;
    margin-bottom: 1.8rem;
}

.bench-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.proj {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--bg);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 1.6rem 1.5rem 1.4rem;
    transition: background 0.25s;
}

.proj:hover,
.proj:has(.cover-btn:focus-visible) {
    background: var(--bg-raise);
}

.cover-btn {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: pointer;
}

.cover-btn:focus-visible {
    outline-offset: -3px;
}

.proj-index {
    color: var(--ink-mute);
    font-size: 0.7rem;
}

.proj h4 {
    font-size: 1.06rem;
    line-height: 1.3;
    max-width: 26ch;
}

.proj p {
    color: var(--ink-mute);
    font-size: 0.9rem;
    flex-grow: 1;
}

.proj-meta {
    color: var(--ink-soft);
    font-size: 0.68rem;
}

.proj-arrow {
    position: absolute;
    top: 1.4rem;
    right: 1.4rem;
    color: var(--ink-mute);
    font-size: 1.05rem;
    line-height: 1;
    transition: transform 0.25s var(--ease-out), color 0.25s;
}

.proj:hover .proj-arrow,
.proj:has(.cover-btn:focus-visible) .proj-arrow,
.lead-card-btn:hover .proj-arrow {
    color: var(--accent);
    transform: translateX(4px);
}

/* ---------- 03 Experience ---------- */

.xp-list {
    display: grid;
}

.xp-row {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 1.5rem 2.5rem;
    border-top: 1px solid var(--line);
    padding: 2rem 0;
}

.xp-date {
    color: var(--ink-mute);
    padding-top: 0.45rem;
}

.xp-main h3 {
    font-size: 1.3rem;
    margin-bottom: 0.4rem;
}

.xp-role {
    color: var(--accent);
    font-size: 0.94rem;
    font-weight: 500;
    margin-bottom: 0.9rem;
}

.xp-points {
    display: grid;
    gap: 0.55rem;
    max-width: 70ch;
}

.xp-points li {
    position: relative;
    padding-left: 1.2rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.xp-points li::before {
    content: '';
    position: absolute;
    top: 0.68em;
    left: 0;
    width: 6px;
    height: 1px;
    background: var(--accent);
}

.xp-points strong {
    color: var(--ink);
    font-weight: 600;
}

.lead-block {
    margin-top: clamp(2.5rem, 6vw, 4rem);
}

.lead-block .block-label {
    color: var(--ink-mute);
    border-top: 1px solid var(--line-strong);
    padding-top: 1.2rem;
}

.lead-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.lead-card {
    position: relative;
    background: var(--bg);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 1.6rem 1.5rem;
    transition: background 0.25s;
}

.lead-card-btn:hover,
.lead-card:has(.cover-btn:focus-visible) {
    background: var(--bg-raise);
}

.lead-years {
    color: var(--ink-mute);
    font-size: 0.7rem;
    margin-bottom: 0.7rem;
}

.lead-card h4 {
    font-size: 1.04rem;
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

.lead-role {
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
}

.lead-card > p:last-of-type {
    color: var(--ink-mute);
    font-size: 0.9rem;
}

/* ---------- 04 Skills ---------- */

.skills-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: clamp(2.5rem, 6vw, 4.5rem);
    align-items: start;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.2rem 2.5rem;
}

.skill-cluster h3 {
    color: var(--ink-soft);
    border-top: 1px solid var(--line-strong);
    padding-top: 1rem;
    margin-bottom: 1.1rem;
}

.chiplist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.chiplist li {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.32rem 0.75rem;
    font-size: 0.84rem;
    color: var(--ink-soft);
    background: rgba(233, 238, 244, 0.03);
    transition: border-color 0.2s, color 0.2s;
}

.chiplist li:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.applied {
    color: var(--ink-mute);
    font-size: 0.68rem;
}

.achievements {
    border: 1px solid var(--line);
    background: var(--bg-raise);
    padding: 1.8rem;
}

.ach-list {
    display: grid;
}

.ach-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.95rem 0;
    border-top: 1px solid var(--line);
}

.ach-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.ach-badge {
    flex: 0 0 64px;
    text-align: center;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 0.22rem 0;
    font-size: 0.62rem;
    color: var(--ink-soft);
}

.ach-gold {
    color: var(--amber);
    border-color: rgba(240, 178, 67, 0.5);
}

.ach-silver {
    color: #cdd6de;
    border-color: rgba(205, 214, 222, 0.45);
}

.ach-bronze {
    color: #d49a6a;
    border-color: rgba(212, 154, 106, 0.45);
}

.ach-list strong {
    display: block;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.4;
}

.ach-list span:not(.ach-badge) {
    color: var(--ink-mute);
    font-size: 0.85rem;
}

/* ---------- 05 Credentials ---------- */

.cred-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.cred-card {
    background: var(--bg);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background 0.25s;
}

.cred-card:hover {
    background: var(--bg-raise);
}

.cred-media {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.cred-media img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: left top;
    filter: saturate(0.9);
    transition: filter 0.3s;
}

.cred-card:hover .cred-media img {
    filter: saturate(1);
}

.cred-body {
    padding: 1.3rem 1.4rem 1.5rem;
}

.cred-tag {
    color: var(--accent);
    font-size: 0.66rem;
    margin-bottom: 0.55rem;
}

.cred-body h3 {
    font-size: 1.04rem;
    margin-bottom: 0.4rem;
}

.cred-body p {
    color: var(--ink-mute);
    font-size: 0.88rem;
}

/* ---------- 06 Contact ---------- */

.section-contact {
    padding-bottom: var(--space-section);
}

.contact-block {
    max-width: 760px;
}

.contact-title {
    font-size: clamp(2.3rem, 5.5vw, 4rem);
    letter-spacing: -0.03em;
    margin-bottom: 1.4rem;
}

.contact-lede {
    color: var(--ink-soft);
    font-size: 1.06rem;
    max-width: 52ch;
    margin-bottom: 2.2rem;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2.2rem;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 2rem;
    color: var(--ink-mute);
}

.contact-links a {
    color: var(--ink-soft);
    transition: color 0.2s;
}

.contact-links a:hover {
    color: var(--accent);
}

.contact-links .mono {
    font-size: 0.74rem;
}

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

.footer {
    border-top: 1px solid var(--line);
    padding: 1.8rem 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.footer .mono {
    color: var(--ink-mute);
    font-size: 0.68rem;
}

.to-top:hover {
    color: var(--accent);
}

/* ---------- Project modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(0.8rem, 3vw, 2rem);
    background: rgba(7, 10, 14, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-panel {
    position: relative;
    width: min(960px, 100%);
    max-height: calc(100vh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    overflow-y: auto;
    background: var(--bg-raise);
    border: 1px solid var(--line-strong);
    padding: clamp(1.2rem, 3vw, 2.2rem);
    transform: translateY(14px);
    transition: transform 0.25s var(--ease-out);
}

.modal.show .modal-panel {
    transform: none;
}

.modal-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    z-index: 20;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--bg-raise);
    font-size: 1.5rem;
    line-height: 1;
    transition: border-color 0.2s, color 0.2s;
}

.modal-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.modal-head {
    max-width: 700px;
    margin-bottom: 1.5rem;
    padding-right: 3.2rem;
}

.modal-role {
    color: var(--accent);
    margin-bottom: 0.6rem;
}

.modal-head h2 {
    font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.carousel {
    position: relative;
    border: 1px solid var(--line);
    background: #070a0e;
}

.carousel-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(58vh, 500px);
    min-height: 280px;
}

#modal-image,
#modal-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

#modal-video {
    display: none;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(11, 15, 20, 0.8);
    font-size: 1rem;
    transition: border-color 0.2s, color 0.2s;
}

.carousel-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.carousel-btn.prev {
    left: 0.9rem;
}

.carousel-btn.next {
    right: 0.9rem;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 1rem 0 1.4rem;
}

.indicator {
    width: 26px;
    height: 3px;
    border-radius: 999px;
    background: rgba(233, 238, 244, 0.18);
    transition: background 0.2s, width 0.2s;
}

.indicator.active {
    width: 42px;
    background: var(--accent);
}

.modal-description {
    max-width: 720px;
    margin: 0 auto;
    color: var(--ink-soft);
    font-size: 0.97rem;
}

.modal-description p {
    margin-bottom: 1rem;
}

.modal-description strong {
    color: var(--ink);
}

.modal-description ul {
    display: grid;
    gap: 0.55rem;
}

.modal-description li {
    position: relative;
    padding-left: 1.2rem;
}

.modal-description li::before {
    content: '';
    position: absolute;
    top: 0.7em;
    left: 0;
    width: 6px;
    height: 1px;
    background: var(--accent);
}

.modal-link-wrap {
    max-width: 720px;
    margin: 1.2rem auto 0;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1080px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .hero h1 {
        max-width: 17ch;
    }

    .hero-portrait {
        justify-self: start;
        width: min(340px, 100%);
    }

    .spec-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .spec {
        border-top: 1px solid var(--line);
        padding: 1.3rem 1.4rem 1.3rem 0;
    }

    .spec:nth-child(-n+2) {
        border-top: 0;
    }

    .spec + .spec:nth-child(odd) {
        border-left: 0;
        padding-left: 0;
    }

    .section-head {
        grid-template-columns: auto 1fr;
    }

    .sec-desc {
        grid-column: 2;
        justify-self: start;
        text-align: left;
    }

    .case {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .case-flip .case-media {
        order: 0;
    }

    .case-media {
        position: static;
        max-width: 640px;
    }

    .bench-grid,
    .lead-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skills-layout {
        grid-template-columns: 1fr;
    }

    .cred-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
        padding: 0.8rem var(--gutter) 1.1rem;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu a {
        display: block;
        padding: 0.85rem 0.9rem;
        font-size: 1rem;
    }

    .nav-menu .nav-cta {
        margin-left: 0;
        margin-top: 0.4rem;
        text-align: center;
    }

    .brand-name {
        font-size: 0.92rem;
    }

    .hero {
        padding-top: 6.5rem;
    }

    .hero h1 {
        font-size: clamp(2.3rem, 11vw, 3.2rem);
    }

    .case-cols > div {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .xp-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 1.6rem 0;
    }

    .xp-date {
        padding-top: 0;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .bench-grid,
    .lead-grid,
    .cred-grid {
        grid-template-columns: 1fr;
    }

    .carousel-stage {
        height: min(48vh, 380px);
        min-height: 220px;
    }

    .modal-head {
        padding-right: 2.6rem;
    }
}

@media (max-width: 430px) {
    .hero-actions .btn,
    .contact-actions .btn {
        width: 100%;
    }

    .hero-portrait {
        width: 100%;
    }

    .contact-links {
        flex-direction: column;
        align-items: flex-start;
    }
}
