/* ==========================================================================
   MK Tech Portfolio — site.css
   Public theme: dark canvas, electric-blue accent, BEM class names matching
   templates/layouts/public.php + templates/partials/*.

   Colour tokens (--bg, --surface, --surface-alt, --accent, --accent-soft,
   --text, --muted) are overridden per-request by the inline <style> block in
   the layout, which loads AFTER this file. The values below are fallbacks.
   ========================================================================== */

:root {
    color-scheme: dark;

    --bg: #05070B;
    --surface: #0B1018;
    --surface-alt: #101722;
    --accent: #2583FF;
    --accent-soft: #5EA8FF;
    --text: #F5F7FB;
    --muted: #9AA6B5;

    --border: rgba(154, 166, 181, 0.16);
    --border-strong: rgba(154, 166, 181, 0.30);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 10px 60px rgba(37, 131, 255, 0.18);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
        "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
        sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;
    --nav-h: 68px;
    --container: 1140px;
}

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

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

* {
    margin: 0;
}

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

body {
    min-height: 100vh;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background:
        radial-gradient(1100px 700px at 85% -10%, rgba(37, 131, 255, 0.12), transparent 60%),
        radial-gradient(900px 600px at -10% 10%, rgba(94, 168, 255, 0.07), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    counter-reset: mk-section;
}

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

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

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

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

input,
textarea,
select {
    font: inherit;
}

ul,
ol {
    list-style: none;
    padding: 0;
}

h1,
h2,
h3,
h4 {
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

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

::selection {
    background: rgba(37, 131, 255, 0.35);
    color: #fff;
}

[id] {
    scroll-margin-top: calc(var(--nav-h) + 24px);
}

/* --- Utilities ----------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(1.1rem, 4vw, 2rem);
}

.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: absolute;
    top: -60px;
    left: 1rem;
    z-index: 200;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #03101f;
    font-weight: 600;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    color: #03101f;
}

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    stroke-width: 1.7;
    vertical-align: -0.2em;
}

.icon--lg {
    width: 2.4rem;
    height: 2.4rem;
}

.hl {
    color: var(--accent-soft);
    background: linear-gradient(120deg, var(--accent), var(--accent-soft));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--accent-soft);
}

.eyebrow::before {
    content: "";
    width: 2rem;
    height: 1px;
    background: var(--accent);
}

.prose {
    color: var(--muted);
    max-width: 68ch;
}

.prose p + p {
    margin-top: 1rem;
}

.prose a {
    color: var(--accent-soft);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose--tight p + p {
    margin-top: 0.6rem;
}

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

/* Word-by-word title reveal (site.js splits .section__title into .title-word).
   Punchy pop: rise + scale-down from slightly oversized, per word. */
.title-word {
    display: inline-block;
}

html:not(.no-js) .section__title .title-word {
    opacity: 0;
    transform: translateY(0.55em) scale(1.25);
    transform-origin: 50% 100%;
    transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html:not(.no-js) .section__title .title-word.title-in {
    opacity: 1;
    transform: none;
}

.section {
    position: relative;
    padding-block: clamp(3.5rem, 8vw, 6rem);
}

/* Giant ghost index behind each section number, Reference-style. */
.section__label {
    position: relative;
}

.section__label::before {
    content: attr(data-index);
    position: absolute;
    left: 3.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font);
    font-weight: 900;
    font-size: 0.72rem; /* real number stays readable */
    color: var(--accent);
    letter-spacing: 0.1em;
}

.section--alt {
    background: linear-gradient(180deg, rgba(16, 23, 34, 0.55), rgba(16, 23, 34, 0.18));
    border-block: 1px solid var(--border);
}

.section--cta {
    text-align: center;
    background:
        radial-gradient(600px 300px at 50% 0%, rgba(37, 131, 255, 0.14), transparent 70%);
    border-top: 1px solid var(--border);
}

.section--cta .section__intro {
    margin-inline: auto;
}

.section__head {
    margin-bottom: clamp(2rem, 5vw, 3.2rem);
    max-width: 46rem;
    position: relative;
}

.section__head--split {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem 2rem;
    flex-wrap: wrap;
    max-width: none;
}

.section__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--muted);
}

.section__index {
    color: var(--accent);
    font-weight: 700;
}

.section__title {
    font-size: clamp(1.7rem, 4vw, 2.7rem);
    color: var(--text);
}

.section__title--sm {
    font-size: clamp(1.25rem, 2.6vw, 1.6rem);
}

.section__intro {
    margin-top: 1rem;
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 52ch;
}

/* Giant ghost index above each section header (Jobexe-style "01", "02"…).
   Drawn from the same number the small label shows — no template change. */
.section__head::after {
    counter-increment: mk-section;
    content: counter(mk-section, decimal-leading-zero);
    position: absolute;
    top: -0.52em;
    left: -0.04em;
    z-index: -1;
    font-size: clamp(4.5rem, 11vw, 8.5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(37, 131, 255, 0.35);
    background: linear-gradient(180deg, rgba(37, 131, 255, 0.16), rgba(37, 131, 255, 0) 78%);
    -webkit-background-clip: text;
    background-clip: text;
    pointer-events: none;
    user-select: none;
    animation: ghost-drift 9s ease-in-out infinite;
}

@keyframes ghost-drift {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}

.section__head > * {
    position: relative;
    z-index: 1;
}

.section--alt .section__head::after {
    -webkit-text-stroke-color: rgba(94, 168, 255, 0.28);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.78rem 1.35rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease,
        border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

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

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

.btn--primary {
    background: var(--accent);
    color: #03101f;
    box-shadow: 0 8px 30px rgba(37, 131, 255, 0.35);
}

.btn--primary:hover {
    background: var(--accent-soft);
    color: #03101f;
    box-shadow: 0 12px 36px rgba(37, 131, 255, 0.45);
}

.btn--ghost {
    color: var(--text);
    border-color: var(--border-strong);
    background: rgba(11, 16, 24, 0.4);
}

.btn--ghost:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(37, 131, 255, 0.08);
}

.btn--quiet {
    color: var(--muted);
    padding-inline: 0.6rem;
}

.btn--quiet:hover {
    color: var(--accent-soft);
}

.btn--sm {
    padding: 0.5rem 0.95rem;
    font-size: 0.86rem;
}

.btn--lg {
    padding: 0.95rem 1.7rem;
    font-size: 1rem;
}

/* --- Navigation ---------------------------------------------------------- */

.nav {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    background: rgba(5, 7, 11, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.nav.is-scrolled {
    background: rgba(5, 7, 11, 0.9);
    border-bottom-color: var(--border);
}

.nav__inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: var(--nav-h);
}

.nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    margin-right: auto;
}

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

.nav__monogram {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--accent), #1157c9);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    box-shadow: 0 6px 20px rgba(37, 131, 255, 0.35);
}

.nav__wordmark {
    font-weight: 800;
    letter-spacing: 0.14em;
    font-size: 0.92rem;
    text-transform: uppercase;
}

.nav__links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav__link {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.nav__link:hover {
    color: var(--text);
    background: rgba(154, 166, 181, 0.1);
}

.nav__link.is-active {
    color: var(--accent-soft);
    background: rgba(37, 131, 255, 0.12);
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 42px;
    height: 42px;
    padding: 10px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: rgba(11, 16, 24, 0.6);
}

.nav__toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:first-child {
    transform: translateY(4px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:last-child {
    transform: translateY(-4px) rotate(-45deg);
}

.nav__scrim {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(3, 5, 9, 0.6);
    backdrop-filter: blur(2px);
}

.nav__scrim[hidden] {
    display: none;
}

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

.hero {
    position: relative;
    padding-top: calc(var(--nav-h) + clamp(2.5rem, 7vw, 5rem));
    padding-bottom: clamp(3rem, 8vw, 6rem);
    overflow: hidden;
}

/* --- Load-in choreography (plays once, on page open) ---------------------- */

@keyframes rise-in {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
}

html:not(.no-js) .hero .eyebrow  { animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }
html:not(.no-js) .hero__title    { animation: rise-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }

/* rise-in must not fight the ::before shimmer (which is on a child pseudo-element
   of .hero__title, so the two compose fine — but .hl keeps its static gradient). */
html:not(.no-js) .hero__role     { animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both; }
html:not(.no-js) .hero__message  { animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both; }
html:not(.no-js) .hero__support  { animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.62s both; }
html:not(.no-js) .hero__actions  { animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.75s both; }
html:not(.no-js) .hero__meta     { animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.88s both; }
html:not(.no-js) .hero__visual   { animation: rise-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both; }

/* Hero title shimmer — animate a clipped overlay so nested .hl spans keep
   their own solid gradient (background-clip on the parent breaks them). */
.hero__title {
    position: relative;
    z-index: 0;
}

.hero__title::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(100deg,
        transparent 25%,
        rgba(255, 255, 255, 0.55) 48%,
        transparent 62%);
    background-size: 250% 100%;
    mix-blend-mode: overlay;
    animation: title-shimmer 6s ease-in-out infinite;
}

@keyframes title-shimmer {
    0%, 100% { background-position: 0% 50%; opacity: 0.25; }
    50%      { background-position: 100% 50%; opacity: 1; }
}

/* Typewriter caret after the rotating role text */
.hero__role-text::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 3px;
    background: var(--accent);
    vertical-align: -0.15em;
    animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Ambient floating glow orbs around the hero */
.hero__grid::before,
.hero__grid::after {
    content: "";
    position: absolute;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.35;
    pointer-events: none;
}

.hero__grid::before {
    top: -140px;
    left: -120px;
    background: radial-gradient(circle, rgba(37, 131, 255, 0.5), transparent 65%);
    animation: drift-a 16s ease-in-out infinite alternate;
}

.hero__grid::after {
    bottom: -160px;
    right: -100px;
    background: radial-gradient(circle, rgba(94, 168, 255, 0.35), transparent 65%);
    animation: drift-b 21s ease-in-out infinite alternate;
}

@keyframes drift-a {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(70px, 60px) scale(1.15); }
}

@keyframes drift-b {
    from { transform: translate(0, 0) scale(1.1); }
    to   { transform: translate(-60px, -50px) scale(0.92); }
}

/* Portrait: slow rotating gradient ring */
.portrait::before {
    animation: ring-spin 9s linear infinite;
}

@keyframes ring-spin {
    from { filter: blur(28px) hue-rotate(0deg); opacity: 0.3; }
    50%  { filter: blur(34px) hue-rotate(40deg); opacity: 0.5; }
    to   { filter: blur(28px) hue-rotate(0deg); opacity: 0.3; }
}

/* Terminal card: gentle float */
.code-card {
    animation: card-float 7s ease-in-out infinite;
}

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

/* code-card terminal dots pulse */
.code-card__dot { animation: dot-pulse 3s ease-in-out infinite; }
.code-card__dot:nth-child(1) { animation-delay: 0s; }
.code-card__dot:nth-child(2) { animation-delay: 0.4s; }
.code-card__dot:nth-child(3) { animation-delay: 0.8s; }

@keyframes dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.75); }
}

/* Nav underline sweep on hover */
.nav__link {
    position: relative;
}

.nav__link::after {
    content: "";
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    bottom: 0.28rem;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav__link:hover::after,
.nav__link.is-active::after {
    transform: scaleX(1);
}

/* --- Hero grid (unchanged) ----------------------------------------------- */

.hero__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(154, 166, 181, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(154, 166, 181, 0.07) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 40%, transparent 100%);
    pointer-events: none;
}

.hero__inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: clamp(2rem, 5vw, 4rem);
}

.hero--stacked .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
}

.hero--stacked .hero__actions,
.hero--stacked .hero__meta {
    justify-content: center;
}

.hero__title {
    font-size: clamp(2.4rem, 6.5vw, 4.4rem);
    line-height: 1.04;
    margin-bottom: 0.9rem;
}

.hero__role {
    min-height: 1.6em;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2.4vw, 1.25rem);
    color: var(--accent-soft);
    letter-spacing: 0.04em;
}

.hero__role-text {
    display: inline-block;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.hero__role-text.is-swapping {
    opacity: 0;
    transform: translateY(8px);
}

.hero__message {
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.hero__support {
    color: var(--muted);
    max-width: 52ch;
    margin-bottom: 1.6rem;
}

.hero--stacked .hero__support {
    margin-inline: auto;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.8rem;
}

.hero__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem 1.6rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero__location {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.hero__location .icon {
    color: var(--accent-soft);
}

/* Portrait + terminal card */

.hero__visual {
    position: relative;
    display: grid;
    gap: 1.4rem;
    justify-items: center;
}

.portrait {
    position: relative;
    width: min(340px, 78%);
    aspect-ratio: 1;
}

.portrait::before {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: conic-gradient(from 180deg, var(--accent), transparent 55%, var(--accent-soft));
    filter: blur(28px);
    opacity: 0.35;
    z-index: 0;
}

.portrait__img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}

.portrait__placeholder {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: grid;
    place-content: center;
    gap: 0.3rem;
    text-align: center;
    border-radius: 50%;
    border: 1px dashed var(--border-strong);
    background: var(--surface);
    color: var(--muted);
}

.portrait__placeholder span {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-soft);
}

.portrait__placeholder small {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Code card */

.code-card {
    width: min(430px, 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(11, 16, 24, 0.92);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.code-card__bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.9rem;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}

.code-card__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(154, 166, 181, 0.35);
}

.code-card__dot:nth-child(1) { background: #f2657a; }
.code-card__dot:nth-child(2) { background: #f5b83d; }
.code-card__dot:nth-child(3) { background: #3ecf8e; }

.code-card__file {
    margin-left: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--muted);
}

.code-card__body {
    margin: 0;
    padding: 1rem 1.1rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.tok-key  { color: var(--accent-soft); font-weight: 600; }
.tok-var  { color: var(--text); font-weight: 600; }
.tok-prop { color: #8ab4ff; }
.tok-str  { color: #7ee2a8; }

/* --- Hero: terminal typing ------------------------------------------------ */

.hero__support,
.hero__message {
    position: relative;
}

/* --- Status, tags, chips ------------------------------------------------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 500;
    color: var(--text);
}

.status__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3ecf8e;
    box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.5);
    animation: pulse-dot 2.2s infinite;
}

@keyframes pulse-dot {
    0%   { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.45); }
    70%  { box-shadow: 0 0 0 8px rgba(62, 207, 142, 0); }
    100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0); }
}

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

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(154, 166, 181, 0.08);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.tag--category {
    border-color: rgba(37, 131, 255, 0.4);
    background: rgba(37, 131, 255, 0.12);
    color: var(--accent-soft);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
}

.tag--notice {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
    color: #f7c65e;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: rgba(11, 16, 24, 0.5);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
    transition: all 0.18s ease;
}

.chip:hover {
    color: var(--text);
    border-color: var(--accent);
}

.chip.is-active {
    background: rgba(37, 131, 255, 0.16);
    border-color: var(--accent);
    color: var(--accent-soft);
}

.chip__count {
    display: inline-grid;
    place-items: center;
    min-width: 1.4em;
    height: 1.4em;
    padding-inline: 0.35em;
    border-radius: 999px;
    background: rgba(154, 166, 181, 0.16);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text);
}

/* --- Cards --------------------------------------------------------------- */

.cards {
    display: grid;
    gap: clamp(1rem, 2.5vw, 1.5rem);
}

.cards--services,
.cards--projects,
.cards--related {
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(37, 131, 255, 0.5);
    box-shadow: var(--shadow-glow);
}

/* Services */

.service {
    padding: 1.6rem 1.5rem 3.6rem;
}

.service__media {
    margin: -1.6rem -1.5rem 1.3rem;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.service__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.service:hover .service__media img {
    transform: scale(1.04);
}

.service__icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: rgba(37, 131, 255, 0.14);
    border: 1px solid rgba(37, 131, 255, 0.35);
    color: var(--accent-soft);
    font-size: 1.3rem;
}

.service__title {
    font-size: 1.18rem;
    margin-bottom: 0.55rem;
}

.service__text {
    color: var(--muted);
    font-size: 0.94rem;
}

.service__index {
    position: absolute;
    right: 1.2rem;
    bottom: 0.8rem;
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: rgba(154, 166, 181, 0.16);
    pointer-events: none;
}

/* Projects */

.project__link {
    display: block;
    color: inherit;
    height: 100%;
}

.project__link:hover {
    color: inherit;
}

.project__media {
    aspect-ratio: 16 / 10;
    background: var(--surface-alt);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.project__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.card:hover .project__media img {
    transform: scale(1.05);
}

.project__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: rgba(154, 166, 181, 0.35);
    font-size: 2.2rem;
}

.project__body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.25rem 1.3rem 1.4rem;
}

.project__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.project__live {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #3ecf8e;
}

.project__title {
    font-size: 1.2rem;
}

.project__summary {
    color: var(--muted);
    font-size: 0.93rem;
}

.project__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.4rem;
    color: var(--accent-soft);
    font-size: 0.9rem;
    font-weight: 600;
}

.project__cta .icon {
    transition: transform 0.18s ease;
}

.project__link:hover .project__cta .icon {
    transform: translate(3px, -3px);
}

.project--mini .project__body {
    padding: 1rem 1.1rem 1.15rem;
}

.project--mini .project__title {
    font-size: 1.02rem;
}

/* --- About --------------------------------------------------------------- */

.about__grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: clamp(1.6rem, 4vw, 3rem);
    align-items: start;
}

.about__lead {
    font-size: clamp(1.1rem, 2.2vw, 1.35rem);
    line-height: 1.55;
    color: var(--text);
    margin-bottom: 1.2rem;
}

.quote {
    margin-top: 1.6rem;
    padding: 1.1rem 1.4rem;
    border-left: 3px solid var(--accent);
    background: rgba(37, 131, 255, 0.07);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
    font-style: italic;
}

.meta-grid {
    display: grid;
    gap: 0.8rem;
}

.meta-grid__item {
    display: grid;
    gap: 0.3rem;
    padding: 0.95rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.meta-grid__item dt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-soft);
}

.meta-grid__item dd {
    color: var(--muted);
    font-size: 0.95rem;
}

/* --- Skills marquee (always-running pill strip) --------------------------- */

.marquee {
    overflow: hidden;
    margin: -0.4rem 0 0.7rem;
    padding-block: 0.4rem;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee:last-of-type {
    margin-bottom: 2.2rem;
}

.marquee__track {
    display: flex;
    gap: 0.7rem;
    width: max-content;
    animation: marquee-scroll 22s linear infinite;
}

/* Second row drifts the opposite way, slightly slower, for depth */
.marquee--reverse .marquee__track {
    animation: marquee-scroll-reverse 27s linear infinite;
}

.marquee:hover .marquee__track {
    animation-play-state: paused;
}

.marquee__item {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(11, 16, 24, 0.85);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

/* Second row gets the accent-tinted treatment so the two rows read apart */
.marquee__item--alt {
    background: rgba(37, 131, 255, 0.1);
    border-color: rgba(37, 131, 255, 0.35);
    color: var(--accent-soft);
}

.marquee__item--alt .icon { color: inherit; }

.marquee__item .icon { color: var(--accent-soft); }

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

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

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

.skills {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: clamp(1.2rem, 3vw, 2rem);
}

.skills__group {
    padding: 1.3rem 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.skills__name {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-soft);
    margin-bottom: 1rem;
}

.skills__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.skill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.9rem;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.skill:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.skill__icon {
    color: var(--accent-soft);
    display: inline-flex;
}

.skill__level {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* --- Timeline ------------------------------------------------------------ */

.timeline {
    position: relative;
    display: grid;
    gap: clamp(1.4rem, 3vw, 2.2rem);
    padding-left: 0.4rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: linear-gradient(180deg, rgba(37, 131, 255, 0.25), rgba(37, 131, 255, 0.06));
}

/* Bright fill segment drawn by site.js: grows down the line as you scroll,
   visually connecting each marker to the next. */
.timeline__fill {
    position: absolute;
    left: 22.5px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent-soft));
    box-shadow: 0 0 12px rgba(37, 131, 255, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.timeline__item {
    position: relative;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 1.2rem;
    align-items: start;
}

.timeline__marker {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid rgba(37, 131, 255, 0.5);
    color: var(--accent-soft);
    box-shadow: 0 0 0 6px rgba(5, 7, 11, 0.9);
}

.timeline__content {
    padding: 1.1rem 1.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease;
}

.timeline__item:hover .timeline__content {
    border-color: rgba(37, 131, 255, 0.45);
}

.timeline__year {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.35rem;
}

.timeline__heading {
    font-size: 1.12rem;
    margin-bottom: 0.5rem;
}

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

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

.contact__methods {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1.3rem;
}

.contact__method {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1.05rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.contact__method:hover {
    border-color: var(--accent);
    transform: translateX(4px);
    color: var(--text);
}

.contact__method-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 11px;
    background: rgba(37, 131, 255, 0.14);
    border: 1px solid rgba(37, 131, 255, 0.35);
    color: var(--accent-soft);
}

.contact__method-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.contact__method-value {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
    word-break: break-word;
}

.contact__method-arrow {
    margin-left: auto;
    color: var(--muted);
}

.contact__form {
    padding: clamp(1.3rem, 3vw, 2rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* --- Forms --------------------------------------------------------------- */

.form {
    display: grid;
    gap: 1.1rem;
}

.form__row {
    display: grid;
    gap: 1.1rem;
}

.form__row--2 {
    grid-template-columns: 1fr 1fr;
}

.form__footnote {
    font-size: 0.84rem;
    color: var(--muted);
}

.form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder,
.field textarea::placeholder {
    color: rgba(154, 166, 181, 0.55);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 131, 255, 0.22);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: #f2657a;
}

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

.field__error {
    font-size: 0.85rem;
    color: #ff8ea0;
}

.req {
    color: #ff8ea0;
    font-weight: 700;
}

.optional {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: rgba(154, 166, 181, 0.7);
    margin-left: 0.35rem;
}

/* Honeypot: kept out of sight for humans, tempting for bots */
.hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* Very narrow phones: keep every block inside the viewport. */
@media (max-width: 360px) {
    .marquee {
        /* the track is width:max-content; clip it to the wrapper */
        contain: paint;
    }

    .marquee__item {
        font-size: 0.8rem;
        padding: 0.45rem 0.8rem;
    }

    .skills__group {
        padding: 1.1rem 1rem;
    }

    .section__title {
        overflow-wrap: break-word;
    }

    .hero__title {
        overflow-wrap: break-word;
    }
}

/* The marquee track is intentionally wider than the viewport; it must never
   contribute to document scroll width on any screen. */
.marquee__track {
    transform: translateZ(0); /* create its own layer */
}

.marquee {
    overflow: clip;
}

/* --- Notices, flash, empty states ---------------------------------------- */

.notice {
    display: flex;
    gap: 0.8rem;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(154, 166, 181, 0.07);
    color: var(--muted);
    font-size: 0.93rem;
}

.notice__icon {
    flex: none;
    color: var(--accent-soft);
    line-height: 1;
}

.notice--warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.09);
    color: #f4d18a;
}

.notice--warning .notice__icon {
    color: #f5b83d;
}

.notice--ok {
    border-color: rgba(62, 207, 142, 0.45);
    background: rgba(62, 207, 142, 0.09);
    color: #a7ecd0;
}

.notice--ok .notice__icon {
    color: #3ecf8e;
}

.flash-stack {
    position: relative;
    z-index: 80;
    display: grid;
    gap: 0.7rem;
    margin-top: calc(var(--nav-h) + 1rem);
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.95rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: flash-in 0.3s ease;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash__icon {
    flex: none;
    line-height: 1.4;
}

.flash__message {
    flex: 1;
    color: var(--text);
    font-size: 0.95rem;
}

.flash__close {
    flex: none;
    color: var(--muted);
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    line-height: 1;
}

.flash__close:hover {
    color: var(--text);
    background: rgba(154, 166, 181, 0.14);
}

.flash--success { border-color: rgba(62, 207, 142, 0.5); }
.flash--success .flash__icon { color: #3ecf8e; }
.flash--error   { border-color: rgba(242, 101, 122, 0.55); }
.flash--error .flash__icon   { color: #f2657a; }
.flash--warning { border-color: rgba(245, 158, 11, 0.5); }
.flash--warning .flash__icon { color: #f5b83d; }
.flash--info    { border-color: rgba(37, 131, 255, 0.5); }
.flash--info .flash__icon    { color: var(--accent-soft); }

.empty-state {
    color: var(--muted);
    max-width: 60ch;
}

.empty-state--panel {
    display: grid;
    justify-items: center;
    gap: 0.8rem;
    padding: clamp(2rem, 5vw, 3.2rem) 1.5rem;
    text-align: center;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: rgba(11, 16, 24, 0.5);
    color: var(--muted);
}

.empty-state--panel h3 {
    color: var(--text);
    font-size: 1.2rem;
}

.empty-state--panel .icon {
    color: var(--accent-soft);
}

.empty-state--compact {
    padding: 1.3rem 1.4rem;
    justify-items: start;
    text-align: left;
    font-size: 0.93rem;
}

/* --- Project detail ------------------------------------------------------ */

.project-page {
    padding-top: calc(var(--nav-h) + clamp(1.6rem, 4vw, 2.6rem));
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
}

.crumbs {
    margin-bottom: 1.8rem;
}

.crumbs a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.crumbs a:hover {
    color: var(--accent-soft);
}

.project-page__head {
    max-width: 52rem;
    margin-bottom: clamp(1.8rem, 4vw, 2.8rem);
}

.project-page__title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    margin-bottom: 1rem;
}

.project-page__summary {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--muted);
    max-width: 60ch;
    margin-bottom: 1.6rem;
}

.project-page__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2.4rem;
    margin-bottom: 1.4rem;
    padding-block: 1rem;
    border-block: 1px solid var(--border);
}

.project-page__facts dt {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.project-page__facts dd {
    color: var(--text);
    font-weight: 600;
}

.project-page__head .tags {
    margin-bottom: 1.6rem;
}

.project-page__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.project-page__cover {
    margin: 0 0 clamp(2rem, 5vw, 3rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.project-page__cover img {
    width: 100%;
    height: auto;
}

.project-page__body {
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.project-page__body .prose {
    font-size: 1.05rem;
    max-width: 72ch;
}

.project-page__chapters {
    display: grid;
    gap: clamp(1.4rem, 3vw, 2.2rem);
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.chapter {
    padding-left: 1.4rem;
    border-left: 2px solid rgba(37, 131, 255, 0.4);
}

.chapter__label {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-soft);
    margin-bottom: 0.7rem;
}

.chapter__label span {
    color: var(--muted);
}

.project-page__gallery,
.project-page__related {
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.project-page__gallery .section__title,
.project-page__related .section__title {
    margin-bottom: 1.4rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
    gap: 1.1rem;
}

.gallery__item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.gallery__item:hover {
    transform: translateY(-4px);
    border-color: rgba(37, 131, 255, 0.5);
}

.gallery__item img {
    width: 100%;
    height: auto;
}

/* --- Static pages (.page, .header) --------------------------------------- */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page__main {
    flex: 1;
    padding-top: calc(var(--nav-h) + clamp(1.6rem, 4vw, 2.6rem));
}

.header {
    padding-block: clamp(2rem, 5vw, 3.4rem) clamp(1.4rem, 3vw, 2rem);
    border-bottom: 1px solid var(--border);
    margin-bottom: clamp(1.6rem, 4vw, 2.6rem);
}

.header h1 {
    font-size: clamp(1.9rem, 4.5vw, 2.8rem);
}

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

.footer {
    margin-top: auto;
    padding-block: clamp(2.2rem, 5vw, 3.4rem);
    border-top: 1px solid var(--border);
    background: rgba(11, 16, 24, 0.6);
}

.footer__inner {
    display: grid;
    grid-template-columns: 1.4fr auto 1fr;
    align-items: center;
    gap: 1.6rem 2rem;
}

.footer__brand .nav__brand {
    margin-bottom: 0.6rem;
}

.footer__tagline {
    color: var(--muted);
    font-size: 0.92rem;
    max-width: 44ch;
}

.footer__socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}

.footer__socials a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    color: var(--muted);
    background: rgba(11, 16, 24, 0.6);
    transition: all 0.18s ease;
}

.footer__socials a:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(37, 131, 255, 0.12);
    transform: translateY(-3px);
}

.footer__meta {
    text-align: right;
    color: var(--muted);
    font-size: 0.88rem;
}

.footer__credit {
    color: rgba(154, 166, 181, 0.7);
    font-size: 0.8rem;
}

.footer__text {
    color: var(--muted);
    font-size: 0.9rem;
}

/* --- Timeline (Jobexe-style rich cards) ---------------------------------- */

.timeline__item {
    padding-bottom: 0.2rem;
}

.timeline__item::before {
    content: "";
    position: absolute;
    left: 47px;
    top: 48px;
    bottom: -2.2rem;
    width: 2px;
    background: linear-gradient(180deg, rgba(37, 131, 255, 0.5), rgba(37, 131, 255, 0.05));
}

.timeline__item:last-child::before {
    display: none;
}

.timeline__content {
    position: relative;
    padding: 1.4rem 1.6rem 1.5rem;
    background: linear-gradient(160deg, rgba(16, 23, 34, 0.9), rgba(11, 16, 24, 0.95));
    overflow: hidden;
}

/* sheen that sweeps across a card the first time it reveals */
.timeline__content::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 45%;
    background: linear-gradient(105deg, transparent, rgba(94, 168, 255, 0.07), transparent);
    transform: translateX(-120%) skewX(-12deg);
}

.timeline__item.is-revealed .timeline__content::before {
    animation: sheen 1.2s ease 0.35s 1 forwards;
}

@keyframes sheen {
    to { transform: translateX(320%) skewX(-12deg); }
}

.timeline__year {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.85rem;
    margin-bottom: 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(37, 131, 255, 0.5);
    background: rgba(37, 131, 255, 0.12);
    color: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* --- Skills group styling aligned with the reference --------------------- */

.skills__group {
    position: relative;
}

.skills__name::after {
    content: "";
    display: block;
    width: 34px;
    height: 2px;
    margin-top: 0.5rem;
    background: linear-gradient(90deg, var(--accent), transparent);
}

/* --- Section lead titles: gradient accents already via .hl; gives CTA section breathing room */
.section--cta .section__title {
    position: relative;
}

/* --- Buttons: shine sweep on hover --------------------------------------- */

.btn--primary {
    position: relative;
    overflow: hidden;
}

.btn--primary::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: linear-gradient(105deg, transparent 10%, rgba(255, 255, 255, 0.25) 50%, transparent 90%);
    transform: translateX(-140%) skewX(-14deg);
    transition: transform 0.7s ease;
    pointer-events: none;
}

.btn--primary:hover::after {
    transform: translateX(340%) skewX(-14deg);
    transition: transform 0.6s ease;
}

/* --- Cards: subtle 3D tilt prep (JS sets --tilt-x/--tilt-y) --------------- */

.card[data-reveal] {
    transform-style: preserve-3d;
    transition-property: transform, border-color, box-shadow, opacity;
    will-change: transform;
}

.card[data-reveal].is-revealed:hover {
    transform: perspective(800px)
        rotateX(var(--tilt-y, 0deg))
        rotateY(var(--tilt-x, 0deg))
        translateY(-5px);
}

/* --- Back to top --------------------------------------------------------- */

.to-top {
    position: fixed;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    z-index: 70;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: rgba(11, 16, 24, 0.85);
    backdrop-filter: blur(10px);
    color: var(--text);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

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

/* --- Reveal animations --------------------------------------------------- */

html:not(.no-js) [data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--i, 0) * 70ms);
    will-change: opacity, transform;
}

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

/* Section headers slide in with a subtle left drift instead of just fading */
html:not(.no-js) .section__head[data-reveal] {
    transform: translate(-14px, 18px);
}

/* Cards cascade their collapse-in: scale + rise */
html:not(.no-js) .card[data-reveal],
html:not(.no-js) .skills__group[data-reveal],
html:not(.no-js) .timeline__item[data-reveal],
html:not(.no-js) .contact__method {
    transform: translateY(30px) scale(0.97);
}

html:not(.no-js) .card[data-reveal].is-revealed,
html:not(.no-js) .skills__group[data-reveal].is-revealed,
html:not(.no-js) .timeline__item[data-reveal].is-revealed,
html:not(.no-js) .contact__method.is-revealed {
    transform: none;
}

html:not(.no-js) .contact__method:not([data-reveal]) {
    opacity: 1;
    transform: none;
}

/* Ghost section numbers draw themselves in when the header reveals */
html:not(.no-js) .section__head::after {
    opacity: 0;
    transition: opacity 0.9s ease 0.25s, letter-spacing 0.9s ease 0.25s;
    letter-spacing: 0.06em;
}

html:not(.no-js) .section__head.is-revealed::after {
    opacity: 1;
    letter-spacing: -0.04em;
}

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

@media (max-width: 1024px) {
    .hero__inner {
        grid-template-columns: 1fr;
    }

    .hero__text {
        text-align: center;
    }

    .hero__actions,
    .hero__meta {
        justify-content: center;
    }

    .hero__support {
        margin-inline: auto;
    }

    .about__grid,
    .contact {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .nav__links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        z-index: 95;
        flex-direction: column;
        align-items: stretch;
        gap: 0.2rem;
        padding: 0.9rem 1.1rem 1.2rem;
        background: rgba(5, 7, 11, 0.97);
        border-bottom: 1px solid var(--border);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s;
    }

    .nav__links[aria-expanded="true"] {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .nav__link {
        padding: 0.85rem 0.9rem;
        font-size: 1rem;
    }

    .nav__toggle {
        display: flex;
    }

    .nav__cv {
        display: none;
    }

    .footer__inner {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }

    .footer__brand {
        display: grid;
        justify-items: center;
    }

    .footer__brand .nav__brand {
        margin-right: 0;
    }

    .footer__tagline {
        margin-inline: auto;
    }

    .footer__meta {
        text-align: center;
    }
}

@media (max-width: 640px) {
    .form__row--2 {
        grid-template-columns: 1fr;
    }

    .hero__actions .btn {
        width: 100%;
    }

    .cards--services,
    .cards--projects,
    .cards--related {
        grid-template-columns: 1fr;
    }

    .section__head--split {
        align-items: flex-start;
    }

    .project-page__facts {
        gap: 0.9rem 1.6rem;
    }

    .timeline::before {
        left: 19px;
    }

    .timeline__fill {
        left: 18.5px;
    }

    .timeline__item {
        grid-template-columns: 40px 1fr;
        gap: 0.9rem;
    }

    .timeline__marker {
        width: 40px;
        height: 40px;
    }
}

/* --- Interactive polish: on-load + hover + scroll feedback ---------------- */

/* Scroll progress bar (element injected by site.js) */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    transform-origin: 0 50%;
    transform: scaleX(var(--progress, 0));
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
    box-shadow: 0 0 12px rgba(37, 131, 255, 0.55);
    z-index: 120; /* above the fixed nav */
    pointer-events: none;
}

/* Nav slides down into place on page open */
html:not(.no-js) .nav {
    animation: nav-drop 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes nav-drop {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Cursor spotlight that follows the pointer inside cards */
.card[data-reveal]::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%),
        rgba(37, 131, 255, 0.16), transparent 62%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.card[data-reveal]:hover::after {
    opacity: 1;
}

/* Magnetic buttons: JS nudges --mag-x/--mag-y toward the cursor (max ~5px).
   Uses the `translate` property so it composes with transform-based hovers. */
.btn {
    translate: var(--mag-x, 0px) var(--mag-y, 0px);
    transition: transform 0.18s ease, translate 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
        box-shadow 0.18s ease;
}

.btn:active {
    translate: var(--mag-x, 0px) var(--mag-y, 0px) scale(0.97);
}

@keyframes icon-wiggle {
    0%, 100% { transform: rotate(0) scale(1); }
    25%      { transform: rotate(-9deg) scale(1.12); }
    50%      { transform: rotate(7deg) scale(1.07); }
    75%      { transform: rotate(-4deg) scale(1.03); }
}

@keyframes bounce-in {
    40% { transform: translateY(-6px) scale(1.14); }
    70% { transform: translateY(0) scale(0.95); }
}

@keyframes marker-pulse {
    0%   { box-shadow: 0 0 0 6px rgba(5, 7, 11, 0.9), 0 0 0 0 rgba(37, 131, 255, 0.5); }
    100% { box-shadow: 0 0 0 6px rgba(5, 7, 11, 0.9), 0 0 0 16px rgba(37, 131, 255, 0); }
}

/* Service cards: icon wiggle + index brightens */
.service:hover .service__icon {
    animation: icon-wiggle 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(37, 131, 255, 0.22);
    border-color: rgba(37, 131, 255, 0.6);
}

.service:hover .service__index {
    color: rgba(37, 131, 255, 0.35);
    transform: translateY(-4px);
    transition: color 0.3s ease, transform 0.3s ease;
}

/* Skill chips pop when pointed at */
.skill {
    transition: border-color 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        background-color 0.18s ease;
}

.skill:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--accent-soft);
    background: rgba(37, 131, 255, 0.1);
}

.skill:hover .skill__icon {
    animation: icon-wiggle 0.5s ease;
}

/* Filter chips press down when clicked */
.chip {
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chip:hover {
    transform: translateY(-2px) scale(1.05);
}

.chip:active {
    transform: scale(0.95);
}

/* Timeline markers send out a pulse ring while the item is hovered */
.timeline__marker {
    transition: border-color 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.timeline__item:hover .timeline__marker {
    transform: scale(1.12);
    border-color: var(--accent-soft);
    color: var(--accent);
    animation: marker-pulse 1.4s ease-out infinite;
}

/* Nav links get a tiny lift to match the underline sweep */
.nav__link {
    transition: color 0.18s ease, background-color 0.18s ease, transform 0.2s ease;
}

.nav__link:hover {
    transform: translateY(-2px);
}

/* Portrait reacts to hover: zoom + saturate, ring gets brighter */
.portrait,
.portrait__img {
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease;
}

.portrait:hover {
    transform: scale(1.03) rotate(1deg);
}

.portrait:hover .portrait__img {
    transform: scale(1.05);
    filter: saturate(1.15) brightness(1.05);
}

/* Terminal card: float pauses on hover and the border lights up */
.code-card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.code-card:hover {
    animation-play-state: paused;
    border-color: rgba(37, 131, 255, 0.5);
    box-shadow: 0 22px 60px rgba(37, 131, 255, 0.22);
}

/* Contact methods: icon wiggle + external arrow slides out */
.contact__method:hover .contact__method-icon {
    animation: icon-wiggle 0.5s ease;
}

.contact__method-arrow {
    transition: transform 0.25s ease;
}

.contact__method:hover .contact__method-arrow {
    transform: translate(2px, -2px);
}

/* Footer socials bounce in place */
.footer__socials a {
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease,
        transform 0.2s ease;
}

.footer__socials a:hover {
    animation: bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Project category tag sharpens while its card is hovered */
.tag {
    transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.card:hover .tag--category {
    border-color: var(--accent-soft);
    color: var(--text);
}

/* --- Motion preferences --------------------------------------------------

   NOTE: many Windows laptops ship with OS animation effects OFF, so every
   browser on them reports prefers-reduced-motion: reduce. Treating that as
   "disable everything" made the whole portfolio look static. Instead:
     - vestibular/large movement (reveal slides, drifts) is disabled, and
     - the signature showpiece motion (marquee, typewriter caret, shimmer,
       card float) still runs — it is small, local, and non-parallax.
   ---------------------------------------------------------------------- */

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

    /* Large translations become gentle fades only */
    html:not(.no-js) [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    html:not(.no-js) .section__head::after {
        opacity: 1;
        letter-spacing: -0.04em;
        animation: none;
    }

    /* Ambient loopers (marquee, caret, dots, float) are untouched here:
       nothing above disables them, so they keep their base animation. */

    /* Kill only the big movement loops */
    .hero__grid::before,
    .hero__grid::after {
        animation: none;
    }

    /* New interactive layer: parallax-scale, pulses and bounces are off;
       colour/border hover feedback stays. JS also skips magnetic buttons,
       spotlight coords and hero parallax under this preference. */
    html:not(.no-js) .nav {
        animation: none;
    }

    .card[data-reveal]::after {
        display: none;
    }

    .skill:hover,
    .chip:hover,
    .chip:active,
    .nav__link:hover,
    .portrait:hover,
    .portrait:hover .portrait__img,
    .timeline__item:hover .timeline__marker,
    .btn:active {
        transform: none;
        translate: none;
    }

    .timeline__item:hover .timeline__marker,
    .service:hover .service__icon,
    .skill:hover .skill__icon,
    .contact__method:hover .contact__method-icon,
    .footer__socials a:hover {
        animation: none;
    }
}
