/* =========================================================================
   Ayub Khan — portfolio stylesheet
   Palette: deep space navy + cyan/indigo gradient
   Type: Sora (headings) / Inter (body)
   ========================================================================= */

:root {
    --bg: #05060a;
    --bg-soft: #080a11;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-2: #0c0f17;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #f3f6fb;
    --muted: #9aa6b8;
    --muted-2: #78849a;
    --accent: #22d3ee;
    --accent-2: #818cf8;
    --accent-3: #c084fc;
    --success: #34d399;
    --danger: #fb7185;
    --warning: #fbbf24;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
    --font-head: "Sora", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --container: 1160px;
    --gutter: clamp(1.15rem, 4vw, 2rem);
    --header-h: 74px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(60rem 40rem at 12% -8%, rgba(34, 211, 238, 0.14), transparent 60%),
        radial-gradient(50rem 36rem at 92% 4%, rgba(129, 140, 248, 0.15), transparent 62%),
        radial-gradient(46rem 34rem at 50% 108%, rgba(192, 132, 252, 0.1), transparent 65%),
        var(--bg);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
    background-size: 68px 68px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

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

img {
    height: auto;
}

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

a:hover {
    color: #67e8f9;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: var(--font-head);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 0.6em;
    text-wrap: balance;
}

p {
    margin: 0 0 1rem;
}

::selection {
    background: rgba(34, 211, 238, 0.28);
    color: #fff;
}

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

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

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #04121a;
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
    color: #04121a;
}

/* -------------------------------------------------------------------------
   Scroll progress + header
   ---------------------------------------------------------------------- */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    z-index: 120;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.65);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    display: flex;
    align-items: center;
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.site-header.is-scrolled {
    background: rgba(5, 6, 10, 0.82);
    border-bottom-color: var(--border);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    width: min(100% - (var(--gutter) * 2), var(--container));
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    min-width: 0;
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2) 60%, var(--accent-3));
    color: #04121a;
    font-family: var(--font-head);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    box-shadow: 0 8px 22px -8px rgba(34, 211, 238, 0.8);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

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

.brand-text small {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.primary-nav ul {
    display: flex;
    align-items: center;
    gap: 1.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.primary-nav ul a {
    position: relative;
    display: inline-block;
    padding: 0.4rem 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.primary-nav ul a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.primary-nav ul a:hover,
.primary-nav ul a.is-active {
    color: var(--text);
}

.primary-nav ul a:hover::after,
.primary-nav ul a.is-active::after {
    transform: scaleX(1);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.nav-toggle .icon {
    width: 22px;
    height: 22px;
}

.nav-toggle-close {
    display: none;
}

body.nav-open .nav-toggle-open {
    display: none;
}

body.nav-open .nav-toggle-close {
    display: block;
}

/* -------------------------------------------------------------------------
   Buttons, pills, eyebrow
   ---------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn .icon {
    width: 1.05em;
    height: 1.05em;
    transition: transform 0.2s ease;
}

.btn:hover .icon {
    transform: translate(1px, -1px);
}

.btn-primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #04121a;
    box-shadow: 0 14px 34px -14px rgba(34, 211, 238, 0.9);
}

.btn-primary:hover {
    color: #04121a;
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -16px rgba(129, 140, 248, 0.9);
}

.btn-ghost {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(34, 211, 238, 0.55);
    background: rgba(34, 211, 238, 0.08);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.62rem 1.05rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow .icon {
    width: 0.95rem;
    height: 0.95rem;
}

.availability {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: var(--radius-pill);
    background: rgba(52, 211, 153, 0.07);
    color: #6ee7b7;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.availability::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.13); }
    50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0.03); }
}

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

.hero {
    position: relative;
    padding: clamp(1.8rem, 4vw, 3rem) 0 clamp(2rem, 4.5vw, 3.5rem);
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 3.5rem);
}

.hero-copy {
    max-width: 39rem;
}

.hero-kicker {
    display: block;
    margin: 1rem 0 0.35rem;
    color: var(--accent);
    font-family: var(--font-head);
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(2.5rem, 6vw, 4.2rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.02;
}

.text-gradient {
    background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 52%, var(--accent-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-role {
    margin: 0 0 1rem;
    color: var(--text);
    font-family: var(--font-head);
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    font-weight: 500;
}

.hero-text {
    max-width: 34rem;
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.3vw, 1.075rem);
    line-height: 1.7;
}

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

.hero-socials {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.hero-socials span {
    margin-right: 0.35rem;
    color: var(--muted-2);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.social-links a {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.social-links a .icon {
    width: 1rem;
    height: 1rem;
}

.social-links a:hover {
    color: var(--accent);
    border-color: rgba(34, 211, 238, 0.5);
    background: rgba(34, 211, 238, 0.08);
    transform: translateY(-3px);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1.8rem 0 0;
    padding: 1.1rem 0 0;
    border-top: 1px solid var(--border);
}

.hero-stats div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-right: 0.75rem;
    border-right: 1px solid var(--border);
}

.hero-stats div:last-child {
    border-right: 0;
    padding-right: 0;
}

.hero-stats strong {
    font-family: var(--font-head);
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    background: linear-gradient(100deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-stats span {
    color: var(--muted-2);
    font-size: 0.76rem;
    line-height: 1.35;
}

/* Hero portrait */
.hero-visual {
    position: relative;
    justify-self: end;
    width: min(100%, 380px);
    isolation: isolate;
}

.hero-visual::before {
    content: "";
    position: absolute;
    inset: 12% 4% -6% 12%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.32), rgba(129, 140, 248, 0.18) 45%, transparent 70%);
    filter: blur(34px);
}

.portrait-frame {
    position: relative;
    overflow: hidden;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(160deg, rgba(34, 211, 238, 0.22), rgba(129, 140, 248, 0.12) 45%, rgba(5, 6, 10, 0.9) 100%);
    padding: 10px;
    box-shadow: var(--shadow);
    animation: float 7s ease-in-out infinite;
}

.portrait-frame::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.portrait-frame img {
    width: 100%;
    aspect-ratio: 4 / 4.7;
    object-fit: cover;
    object-position: center 22%;
    border-radius: 24px;
    filter: saturate(1.02) contrast(1.02);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.hero-chip {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: rgba(9, 12, 20, 0.86);
    box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
    animation: float 6s ease-in-out infinite;
}

.hero-chip .icon {
    width: 1.15rem;
    height: 1.15rem;
    color: var(--accent);
}

.hero-chip small {
    display: block;
    color: var(--muted-2);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-chip-stack {
    top: 8%;
    left: -8%;
    animation-delay: -1.5s;
}

.hero-chip-projects {
    right: -6%;
    bottom: 10%;
    animation-delay: -3s;
}

/* Tech marquee */
.tech-strip {
    position: relative;
    overflow: hidden;
    border-block: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
    padding: 0.95rem 0;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.tech-track {
    display: flex;
    width: max-content;
    gap: 2.5rem;
    animation: marquee 34s linear infinite;
}

.tech-group {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.tech-strip:hover .tech-track {
    animation-play-state: paused;
}

.tech-track span {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--muted);
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tech-track span::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.7;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

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

.section {
    padding: clamp(2.5rem, 5vw, 4rem) 0;
    scroll-margin-top: calc(var(--header-h) + 16px);
}

.section-tight {
    padding-top: clamp(1.25rem, 2.5vw, 2rem);
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: clamp(1.4rem, 2.5vw, 2rem);
}

.section-head > div {
    max-width: 40rem;
}

.section-head h2 {
    margin: 0.4rem 0 0;
    font-size: clamp(1.7rem, 3.4vw, 2.5rem);
    letter-spacing: -0.035em;
}

.section-head p {
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-size: 1rem;
}

.section-head .section-link {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-strong);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.section-head .section-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* About */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
}

.about-copy p {
    color: var(--muted);
    font-size: 1.03rem;
    line-height: 1.8;
}

.about-copy p:last-of-type {
    margin-bottom: 1rem;
}

.about-subhead {
    margin: 1.3rem 0 0.7rem;
    color: var(--muted-2);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.about-points {
    display: grid;
    gap: 0.7rem;
    margin: 0 0 2rem;
    padding: 0;
    list-style: none;
}

.about-points li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    color: var(--text);
    font-size: 0.94rem;
}

.about-points .icon {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.28rem;
    color: var(--accent);
}

.about-card {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    padding: 1.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    box-shadow: var(--shadow);
}

.about-card h3 {
    margin: 0 0 1.1rem;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.fact-list {
    display: grid;
    gap: 0.85rem;
    margin: 0 0 1.4rem;
    padding: 0;
    list-style: none;
}

.fact-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border);
    font-size: 0.88rem;
}

.fact-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.fact-list span {
    flex: none;
    color: var(--muted-2);
}

.fact-list strong {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    overflow-wrap: anywhere;
}

.fact-list a {
    color: var(--text);
}

.fact-list a:hover {
    color: var(--accent);
}

.about-card .availability {
    margin-bottom: 1rem;
}

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

.skill {
    padding: 0.55rem 0;
}

.skill-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
}

.skill-head strong {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.93rem;
    font-weight: 500;
}

.skill-head strong .icon {
    width: 0.95rem;
    height: 0.95rem;
    color: var(--accent);
}

.skill-head span {
    color: var(--muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.skill-bar {
    height: 7px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.07);
}

.skill-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.4);
    transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.is-visible .skill-fill {
    width: var(--level, 0%);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 500;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.skill-tag:hover {
    border-color: rgba(34, 211, 238, 0.4);
    background: rgba(34, 211, 238, 0.06);
}

.skill-tag .icon {
    width: 0.9rem;
    height: 0.9rem;
    color: var(--accent);
}

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: 0.9rem;
}

.service-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.service-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(20rem 14rem at 15% 0%, rgba(34, 211, 238, 0.13), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: rgba(34, 211, 238, 0.32);
    box-shadow: 0 26px 50px -30px rgba(34, 211, 238, 0.45);
}

.service-card:hover::before {
    opacity: 1;
}

.service-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 0.9rem;
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 12px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent);
}

.service-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.service-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
}

.service-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.service-card .text-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 600;
}

.service-card .text-link:hover {
    gap: 0.55rem;
}

/* Projects */
.project-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.8rem;
}

.filter-btn {
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.filter-btn.is-active {
    border-color: transparent;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #04121a;
    font-weight: 600;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 30px 60px -35px rgba(129, 140, 248, 0.5);
}

.project-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #0a0d14;
}

.project-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-card:hover .project-media img {
    transform: scale(1.06);
}

.project-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(5, 6, 10, 0.65), transparent 55%);
    pointer-events: none;
}

.project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1rem 1.1rem 1.15rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.project-body h3 {
    margin: 0 0 0.3rem;
    font-size: 1.02rem;
}

.project-body p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.project-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.project-links a:hover {
    color: var(--accent);
    border-color: rgba(34, 211, 238, 0.45);
    background: rgba(34, 211, 238, 0.07);
}

.project-links .icon {
    width: 0.9rem;
    height: 0.9rem;
}

.empty-state {
    padding: 3rem 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* -------------------------------------------------------------------------
   Blog cards
   ---------------------------------------------------------------------- */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
    gap: 1.2rem;
}

.post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    border-color: rgba(34, 211, 238, 0.3);
    box-shadow: 0 30px 60px -35px rgba(34, 211, 238, 0.4);
}

.post-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background:
        radial-gradient(20rem 12rem at 20% 10%, rgba(34, 211, 238, 0.35), transparent 65%),
        radial-gradient(16rem 10rem at 85% 90%, rgba(129, 140, 248, 0.35), transparent 65%),
        #0a0e18;
}

.post-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.post-card:hover .post-media img {
    transform: scale(1.05);
}

.post-media-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.04em;
}

.post-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.3rem 1.35rem 1.45rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
    margin-bottom: 0.6rem;
    color: var(--muted-2);
    font-size: 0.74rem;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.post-meta .icon {
    width: 0.85rem;
    height: 0.85rem;
}

.post-cat {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.post-body h3 {
    margin: 0 0 0.5rem;
    font-size: 1.07rem;
    line-height: 1.35;
}

.post-body h3 a {
    color: var(--text);
}

.post-body h3 a:hover {
    color: var(--accent);
}

.post-body p {
    margin: 0 0 1.2rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.62;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}

.read-more:hover {
    color: var(--accent);
    gap: 0.55rem;
}

.posts-grid-compact .post-media {
    aspect-ratio: 16 / 8;
}

.posts-grid-compact .post-body {
    padding: 1rem 1.1rem 1.1rem;
}

.posts-grid-compact .post-body p {
    display: none;
}

.posts-grid-compact .post-body h3 {
    margin-bottom: 0.65rem;
}

.writing-list {
    border-top: 1px solid var(--border);
}

.writing-item {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: color 0.2s ease, padding 0.2s ease;
}

.writing-item:hover {
    padding-left: 0.6rem;
    color: var(--accent);
}

.writing-meta {
    color: var(--muted-2);
    font-size: 0.78rem;
}

.writing-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 500;
}

.writing-item .icon {
    width: 1rem;
    height: 1rem;
    color: var(--muted-2);
}

.writing-item:hover .icon {
    color: var(--accent);
}

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

.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: clamp(1.2rem, 3vw, 2rem);
    align-items: start;
}

.contact-card {
    padding: 1.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
}

.contact-card > p {
    margin: 0 0 1.4rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.contact-lines {
    display: grid;
    gap: 0.6rem;
    margin: 0 0 1.4rem;
}

.contact-line {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.contact-line:hover {
    background: rgba(34, 211, 238, 0.05);
    border-color: rgba(34, 211, 238, 0.2);
    color: var(--text);
}

.contact-line-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    background: rgba(34, 211, 238, 0.09);
    color: var(--accent);
}

.contact-line-icon .icon {
    width: 1.1rem;
    height: 1.1rem;
}

.contact-line small {
    display: block;
    color: var(--muted-2);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.contact-line strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.contact-card .btn {
    margin-top: 0.2rem;
}

.contact-form {
    padding: 1.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    box-shadow: var(--shadow);
}

.contact-form h3 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.contact-form > p {
    margin: 0 0 1.4rem;
    color: var(--muted);
    font-size: 0.88rem;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.form-field label .req {
    color: var(--accent);
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.92rem;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.form-field textarea {
    min-height: 132px;
    resize: vertical;
}

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

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.6);
    background: rgba(34, 211, 238, 0.035);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
    border-color: rgba(251, 113, 133, 0.7);
}

.field-error {
    color: #fda4af;
    font-size: 0.76rem;
}

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 1rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(251, 113, 133, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(251, 113, 133, 0.08);
    color: #fecdd3;
    font-size: 0.84rem;
}

.form-alert .icon {
    width: 1rem;
    height: 1rem;
    margin-top: 0.15rem;
    color: var(--danger);
}

.form-alert ul {
    margin: 0;
    padding-left: 1rem;
}

.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-note {
    margin: 0.9rem 0 0;
    color: var(--muted-2);
    font-size: 0.74rem;
}

.form-note .icon {
    width: 0.8rem;
    height: 0.8rem;
    display: inline-block;
    vertical-align: -2px;
}

/* -------------------------------------------------------------------------
   CTA band + footer
   ---------------------------------------------------------------------- */

.cta-band {
    padding: 1rem 0 clamp(3rem, 6vw, 5rem);
}

.cta-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    overflow: hidden;
    padding: clamp(1.8rem, 4vw, 3rem);
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 26px;
    background:
        radial-gradient(30rem 18rem at 8% 0%, rgba(34, 211, 238, 0.16), transparent 65%),
        radial-gradient(26rem 16rem at 95% 100%, rgba(129, 140, 248, 0.18), transparent 65%),
        linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    box-shadow: var(--shadow);
}

.cta-copy h2 {
    margin: 0.5rem 0 0.5rem;
    font-size: clamp(1.6rem, 3.6vw, 2.4rem);
}

.cta-copy p {
    max-width: 34rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    flex: none;
}

.site-footer {
    padding: clamp(2rem, 4vw, 3rem) 0 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(5, 6, 10, 0.6);
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.7fr) minmax(0, 1fr);
    gap: clamp(1.8rem, 4vw, 3.5rem);
    padding-bottom: 2.4rem;
}

.footer-brand p {
    max-width: 28rem;
    margin: 1rem 0 1.2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

.footer-links h3 {
    margin: 0 0 0.35rem;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.footer-links a,
.footer-links span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

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

.footer-links .icon {
    width: 0.9rem;
    height: 0.9rem;
    color: var(--accent);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border);
    color: var(--muted-2);
    font-size: 0.78rem;
}

.footer-bottom p {
    margin: 0;
}

.back-to-top {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--muted);
}

.back-to-top .icon {
    width: 0.95rem;
    height: 0.95rem;
    transform: rotate(-45deg);
}

.back-to-top:hover {
    color: var(--accent);
    border-color: rgba(34, 211, 238, 0.4);
}

/* -------------------------------------------------------------------------
   Page intro (blog / 404)
   ---------------------------------------------------------------------- */

.page-intro {
    position: relative;
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}

.page-intro .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
    color: var(--muted-2);
    font-size: 0.8rem;
}

.page-intro .breadcrumb a {
    color: var(--muted);
}

.page-intro .breadcrumb a:hover {
    color: var(--accent);
}

.page-intro .breadcrumb .icon {
    width: 0.8rem;
    height: 0.8rem;
}

.page-intro h1 {
    max-width: 44rem;
    margin: 0.5rem 0 0.8rem;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    letter-spacing: -0.04em;
}

.page-intro p {
    max-width: 40rem;
    margin: 0;
    color: var(--muted);
    font-size: 1.02rem;
}

/* Blog controls */
.blog-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.8rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tag-list a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag-list a:hover,
.tag-list a.is-active {
    color: var(--accent);
    border-color: rgba(34, 211, 238, 0.4);
    background: rgba(34, 211, 238, 0.07);
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: min(100%, 280px);
}

.search-form input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
}

.search-form input:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.55);
}

.search-form button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #04121a;
    cursor: pointer;
}

.search-empty {
    margin: 2rem 0;
    padding: 2.5rem 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2.5rem;
}

.pagination a,
.pagination span {
    display: inline-grid;
    place-items: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.pagination a:hover {
    color: var(--accent);
    border-color: rgba(34, 211, 238, 0.4);
}

.pagination .is-current {
    border-color: transparent;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #04121a;
    font-weight: 600;
}

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

.article-wrap {
    padding-bottom: clamp(3rem, 6vw, 5rem);
}

.article-head {
    padding: clamp(2rem, 5vw, 4rem) 0 2rem;
}

.article-head h1 {
    max-width: 52rem;
    margin: 0.8rem 0 1rem;
    font-size: clamp(2.1rem, 5vw, 3.5rem);
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.article-meta .icon {
    width: 0.9rem;
    height: 0.9rem;
    color: var(--accent);
}

.article-cover {
    margin: 0 0 2.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #0a0d14;
}

.article-cover img {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
}

.prose {
    min-width: 0;
    color: #cfd8e5;
    font-size: 1.05rem;
    line-height: 1.85;
}

.prose > *:first-child {
    margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
    margin: 2.2em 0 0.7em;
    color: var(--text);
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.prose h2 {
    font-size: 1.55rem;
}

.prose h3 {
    font-size: 1.25rem;
}

.prose p {
    margin: 0 0 1.35em;
}

.prose strong {
    color: var(--text);
    font-weight: 600;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(34, 211, 238, 0.35);
    text-underline-offset: 3px;
}

.prose a:hover {
    text-decoration-color: var(--accent);
}

.prose ul,
.prose ol {
    margin: 0 0 1.35em;
    padding-left: 1.4rem;
}

.prose li {
    margin-bottom: 0.45em;
}

.prose li::marker {
    color: var(--accent);
}

.prose blockquote {
    margin: 1.8em 0;
    padding: 1rem 1.3rem;
    border-left: 3px solid var(--accent);
    border-radius: 0 12px 12px 0;
    background: rgba(34, 211, 238, 0.06);
    color: var(--text);
    font-size: 1.05rem;
}

.prose blockquote p:last-child {
    margin-bottom: 0;
}

.prose img {
    width: 100%;
    margin: 1.8em 0;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.prose code {
    padding: 0.15em 0.4em;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: #7dd3fc;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.88em;
}

.prose pre {
    margin: 1.8em 0;
    padding: 1.1rem 1.2rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #080a10;
}

.prose pre code {
    padding: 0;
    border: 0;
    background: none;
    color: #d6e2f0;
    font-size: 0.86rem;
}

.prose hr {
    margin: 2.4em 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.prose table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.prose th,
.prose td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

.prose th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.article-side {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    display: grid;
    gap: 1rem;
}

.article-side-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.article-side-card h2 {
    margin: 0 0 0.7rem;
    font-size: 0.95rem;
}

.article-side-card p {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.article-side-card .btn {
    width: 100%;
}

.article-side-card ul {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.article-side-card ul a {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.article-side-card ul a:hover {
    color: var(--accent);
}

.post-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--border);
}

.post-nav a {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.post-nav a:hover {
    border-color: rgba(34, 211, 238, 0.35);
    background: rgba(34, 211, 238, 0.04);
}

.post-nav small {
    color: var(--muted-2);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.post-nav strong {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.4;
}

.post-nav .next {
    text-align: right;
}

/* -------------------------------------------------------------------------
   Flash messages
   ---------------------------------------------------------------------- */

.flash-stack {
    position: fixed;
    top: calc(var(--header-h) + 0.6rem);
    left: 0;
    right: 0;
    z-index: 110;
}

.flash-stack .container {
    display: grid;
    gap: 0.5rem;
}

.flash {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: rgba(12, 15, 23, 0.94);
    box-shadow: var(--shadow);
    font-size: 0.86rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.flash .icon {
    width: 1.05rem;
    height: 1.05rem;
    flex: none;
}

.flash-success {
    border-color: rgba(52, 211, 153, 0.35);
    color: #a7f3d0;
}

.flash-success .icon {
    color: var(--success);
}

.flash-error {
    border-color: rgba(251, 113, 133, 0.35);
    color: #fecdd3;
}

.flash-error .icon {
    color: var(--danger);
}

.flash-close {
    margin-left: auto;
    padding: 0.2rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    line-height: 0;
}

.flash-close .icon {
    width: 1rem;
    height: 1rem;
}

/* -------------------------------------------------------------------------
   404
   ---------------------------------------------------------------------- */

.error-page {
    display: grid;
    place-items: center;
    min-height: 62vh;
    padding: 3rem 0;
    text-align: center;
}

.error-code {
    margin: 0;
    font-family: var(--font-head);
    font-size: clamp(5rem, 18vw, 10rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.06em;
    background: linear-gradient(120deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.error-page h1 {
    margin: 0.5rem 0 0.7rem;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.error-page p {
    max-width: 30rem;
    margin: 0 auto 1.7rem;
    color: var(--muted);
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.7rem;
}

/* -------------------------------------------------------------------------
   Reveal animation
   ---------------------------------------------------------------------- */

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* -------------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
        gap: 2rem;
    }

    .hero-chip-stack {
        left: 0;
    }

    .hero-chip-projects {
        right: 0;
    }

    .about-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr);
    }

    .article-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-side {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 900px) {
    .nav-toggle {
        display: inline-flex;
    }

    .primary-nav {
        position: fixed;
        inset: var(--header-h) 0 auto;
        display: grid;
        gap: 0.5rem;
        padding: 1rem var(--gutter) 1.4rem;
        border-bottom: 1px solid var(--border);
        background: rgba(5, 6, 10, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transform: translateY(-110%);
        visibility: hidden;
        opacity: 0;
        transition: transform 0.28s ease, opacity 0.28s ease, visibility 0.28s;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
    }

    body.nav-open .primary-nav {
        transform: none;
        visibility: visible;
        opacity: 1;
    }

    .primary-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .primary-nav ul li {
        border-bottom: 1px solid var(--border);
    }

    .primary-nav ul a {
        display: block;
        padding: 0.85rem 0.2rem;
        font-size: 1rem;
    }

    .primary-nav ul a::after {
        display: none;
    }

    .nav-cta {
        margin-top: 0.6rem;
        justify-self: start;
    }

    body.nav-open {
        overflow: hidden;
    }

    .hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.8rem;
    }

    .hero-copy {
        max-width: none;
    }

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

    .hero-chip-stack {
        left: -4%;
    }

    .hero-chip-projects {
        right: -4%;
    }

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

    .about-card {
        position: static;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

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

    .cta-card {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    :root {
        --header-h: 66px;
    }

    .brand-text small {
        display: none;
    }

    .hero {
        padding-top: 1.5rem;
    }

    .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .hero-stats div {
        border-right: 0;
        padding-right: 0;
    }

    .hero-stats div:nth-child(odd) {
        border-right: 1px solid var(--border);
    }

    .hero-actions .btn {
        flex: 1 1 auto;
    }

    .hero-chip {
        padding: 0.55rem 0.7rem;
        font-size: 0.72rem;
    }

    .hero-chip .icon {
        width: 1rem;
        height: 1rem;
    }

    .hero-visual {
        width: min(100%, 290px);
    }

    .services-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .service-card {
        padding: 0.9rem;
    }

    .service-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 0.55rem;
    }

    .service-icon .icon {
        width: 1rem;
        height: 1rem;
    }

    .service-card h3 {
        font-size: 0.9rem;
    }

    .service-card p {
        font-size: 0.8rem;
        line-height: 1.45;
    }

    .writing-item {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.2rem 0.75rem;
        padding: 0.8rem 0.25rem;
    }

    .writing-meta {
        grid-column: 1 / -1;
    }

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

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

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

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

    .post-nav {
        grid-template-columns: minmax(0, 1fr);
    }

    .post-nav .next {
        text-align: left;
    }

    .blog-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        min-width: 0;
    }

    .cta-actions {
        width: 100%;
    }

    .cta-actions .btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .skill-fill {
        width: var(--level, 0%);
    }
}

@media print {
    body::before,
    body::after,
    .site-header,
    .scroll-progress,
    .cta-band,
    .site-footer,
    .article-side,
    .post-nav {
        display: none !important;
    }

    body {
        background: #fff;
        color: #111;
    }

    .prose {
        color: #222;
    }
}
