/* ==========================================================================
   site.css — shared styles for the home page, about page and every case study.
   Layout: sticky left column (bio / case-study nav) + scrolling right column.

   Direction (unslop pass, see unslop by Damir Sokolovsky, @heydamir, CC BY 4.0):
   a designer's desk at night. Light grey neutrals, one ember accent used
   rarely, the live London clock as the signature, a lamp pull-cord for dark mode.
   Five reading themes, four reading fonts and text size come from the
   accessibility panel (site.js).
   Spacing sits on a 4px grid. Weights 400 and 500 only.
   ========================================================================== */

@font-face {
    font-family: "Google Sans";
    src: url("Fonts/GoogleSans-VariableFont_GRAD,opsz,wght.ttf") format("truetype");
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Graphite ramp, light grey (default theme) */
    --bg: #f2f2f3;
    --surface: #e6e6e8;      /* image tiles, raised rows */
    --card: #fafafa;
    --ink: #171717;          /* primary text */
    --ink-2: #4f4f52;        /* secondary text */
    --muted: #6e6e73;        /* meta, captions, icons */
    --line: rgba(23, 23, 23, .08);
    --line-strong: rgba(23, 23, 23, .16);
    --accent: #c2410c;       /* ember: live dot, current section, cord */
    --on-ink: #f2f2f3;
    --header-bg: rgba(242, 242, 243, .88);
    --logo-filter: grayscale(1);
    --cord: rgba(23, 23, 23, .4);
    --verified: #3897f0;

    --font: "Google Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    --gutter: clamp(20px, 3vw, 48px);
    --side-w: clamp(280px, 24vw, 360px);
    --col-gap: clamp(40px, 5vw, 96px);
    --header-h: 64px;
    --radius: 12px;          /* cards, images */
    --radius-ctl: 8px;       /* buttons, rows, tabs */
    --ease: cubic-bezier(.22, 1, .36, 1);
    --fast: 160ms;
    --slow: 400ms;

    color-scheme: light;
}

/* Reading themes, picked in the accessibility panel.
   "dark" is also what the pull cord switches to. */
:root[data-theme="sage"] {
    --bg: #c5cac3;
    --surface: #b8beb6;
    --card: #ced3cc;
    --ink: #262a25;
    --ink-2: #3c4139;
    --muted: #50554e;
    --line: rgba(38, 42, 37, .12);
    --line-strong: rgba(38, 42, 37, .22);
    --accent: #9a3412;
    --on-ink: #c5cac3;
    --header-bg: rgba(197, 202, 195, .9);
    --cord: rgba(38, 42, 37, .45);
}

:root[data-theme="slate"] {
    --bg: #686868;
    --surface: #5d5d5d;
    --card: #727272;
    --ink: #f4f4f4;
    --ink-2: #e2e2e2;
    --muted: #d0d0d0;
    --line: rgba(255, 255, 255, .14);
    --line-strong: rgba(255, 255, 255, .26);
    --accent: #ffb38a;
    --on-ink: #2a2a2a;
    --header-bg: rgba(104, 104, 104, .9);
    --logo-filter: grayscale(1) invert(1);
    --cord: rgba(255, 255, 255, .5);
    color-scheme: dark;
}

:root[data-theme="dark"] {
    --bg: #2b2b2b;
    --surface: #353535;
    --card: #313131;
    --ink: #e6e6e6;
    --ink-2: #c2c2c2;
    --muted: #9e9e9e;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --accent: #f0884f;
    --on-ink: #2b2b2b;
    --header-bg: rgba(43, 43, 43, .88);
    --logo-filter: grayscale(1) invert(1);
    --cord: rgba(255, 255, 255, .36);
    color-scheme: dark;
}

/* Pure black for OLED screens */
:root[data-theme="oled"] {
    --bg: #000000;
    --surface: #111111;
    --card: #0b0b0b;
    --ink: #ededed;
    --ink-2: #b0b0b0;
    --muted: #8c8c8c;
    --line: rgba(255, 255, 255, .1);
    --line-strong: rgba(255, 255, 255, .2);
    --accent: #f0884f;
    --on-ink: #000000;
    --header-bg: rgba(0, 0, 0, .88);
    --logo-filter: grayscale(1) invert(1);
    --cord: rgba(255, 255, 255, .36);
    color-scheme: dark;
}

/* Reading fonts */
:root[data-font="serif"] { --font: "Literata", Georgia, serif; }
:root[data-font="hyperlegible"] { --font: "Atkinson Hyperlegible", ui-sans-serif, system-ui, sans-serif; }
:root[data-font="lexend"] { --font: "Lexend", ui-sans-serif, system-ui, sans-serif; }
:root[data-font="dyslexic"] { --font: "OpenDyslexic", ui-sans-serif, system-ui, sans-serif; }
:root[data-font="dyslexic"] body { line-height: 1.6; word-spacing: .08em; }

/* Text size: scales the page content, not the floating controls */
:root[data-size="l"] :is(.site-header, .shell, .about) { zoom: 1.125; }
:root[data-size="xl"] :is(.site-header, .shell, .about) { zoom: 1.25; }

/* Reduced motion, chosen in the panel */
:root[data-motion="reduce"] *,
:root[data-motion="reduce"] *::before,
:root[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color var(--slow) var(--ease), color var(--slow) var(--ease);
}

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

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

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

.u-link {
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: text-decoration-color var(--fast) var(--ease);
}
.u-link:hover { text-decoration-color: var(--ink); }

/* --------------------------------------------------------------------------
   Icons — Kubai duotone (MIT), added by site.js. They take the muted text
   colour and play their own motion when the parent link is hovered.
   -------------------------------------------------------------------------- */

kubai-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    vertical-align: -3px;
    color: var(--muted);
    transition: color var(--fast) var(--ease);
}
.arrow-out kubai-icon { margin-left: 4px; }
a:hover kubai-icon { color: var(--ink); }

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    /* the right side leaves room for the pull cord */
    padding: 0 calc(var(--gutter) + 32px) 0 var(--gutter);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background-color var(--slow) var(--ease);
        margin-top: 30px;
}

.site-name { font-size: 16px; font-weight: 500; }

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(16px, 2.2vw, 40px);
    font-size: 15px;
    color: var(--ink-2);
}
.site-nav a { transition: color var(--fast) var(--ease); }
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); }

/* Signature: the live London clock with an ember dot */
.site-clock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin-left: clamp(0px, 1.4vw, 20px);
}
.site-clock::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.site-clock time { color: var(--ink); }

/* --------------------------------------------------------------------------
   Two-column shell
   -------------------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    gap: var(--col-gap);
    padding: 24px calc(var(--gutter) + 32px) 80px var(--gutter);
    align-items: start;
}

.side {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    padding-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Home — bio column
   -------------------------------------------------------------------------- */

.bio-title {
    margin: 0 0 32px;
    font-size: clamp(32px, 2.8vw, 48px);
    font-weight: 400;
    letter-spacing: -.02em;
    line-height: 1.08;
    text-wrap: balance;
}

.bio-copy {
    margin: 0;
    font-size: clamp(15px, 1.05vw, 17px);
    line-height: 1.65;
    color: var(--ink-2);
}

.bio-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin: 40px 0 32px;
    font-size: 15px;
    color: var(--ink-2);
}
.bio-links a { transition: color var(--fast) var(--ease); }
.bio-links a:hover { color: var(--ink); }

.bio-status {
    margin: 0 0 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--muted);
}

.bio-credit {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Home — filter + project grid
   -------------------------------------------------------------------------- */

.work-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.filter {
    position: relative;
    display: inline-flex;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface);
}

.filter-thumb {
    position: absolute;
    top: 4px;
    left: 0;
    height: calc(100% - 8px);
    border-radius: var(--radius-ctl);
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), inset 0 0 0 1px var(--line);
    transition: transform var(--slow) var(--ease), width var(--slow) var(--ease);
    pointer-events: none;
}

.filter button {
    position: relative;
    z-index: 1;
    appearance: none;
    border: 0;
    background: none;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-ctl);
    font: inherit;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: color var(--fast) var(--ease);
}
.filter button:hover { color: var(--ink-2); }
.filter button[aria-pressed="true"] { color: var(--ink); }

.work-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.project-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 56px 32px;
}

.project-grid > li[hidden] { display: none; }
.project-grid > li.is-entering { animation: card-in var(--slow) var(--ease) both; }

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

.card { display: block; }

.card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    display: grid;
    place-items: center;
}
/* hover: a quiet surface step, no zoom */
.card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px var(--line);
    background: rgba(0, 0, 0, 0);
    transition: background-color var(--fast) var(--ease);
    pointer-events: none;
}
.card:hover .card-media::after { background: rgba(0, 0, 0, .04); }

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-media.is-contain img {
    width: 72%;
    height: 76%;
    object-fit: contain;
}

.card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--card);
    font-size: 12px;
    color: var(--ink-2);
    opacity: 0;
    transition: opacity var(--fast) var(--ease);
}
.card:hover .card-badge,
.card:focus-visible .card-badge { opacity: 1; }

.card-title {
    margin: 16px 0 12px;
    font-size: clamp(15px, 1.1vw, 18px);
    font-weight: 400;
    line-height: 1.4;
    color: var(--ink);
    text-wrap: pretty;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tags li {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px var(--line-strong);
    font-size: 12px;
    color: var(--ink-2);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Case study — sidebar
   -------------------------------------------------------------------------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--ink-2);
    transition: color var(--fast) var(--ease);
}
.back-link:hover { color: var(--ink); }

.case-side .tags { margin: 32px 0 24px; }

.case-title {
    margin: 0 0 20px;
    font-size: clamp(36px, 3.2vw, 56px);
    font-weight: 400;
    letter-spacing: -.025em;
    line-height: 1.05;
}

.case-lede {
    margin: 0 0 40px;
    font-size: clamp(15px, 1.05vw, 17px);
    line-height: 1.6;
    color: var(--ink-2);
}

.toc {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--line-strong);
}
.toc a {
    display: flex;
    align-items: center;
    height: 36px;
    margin-left: -1px;
    padding-left: 16px;
    border-left: 2px solid transparent;
    font-size: 15px;
    color: var(--muted);
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.toc li + li { margin-top: 4px; }
.toc a:hover { color: var(--ink-2); }
.toc a.is-active { color: var(--ink); border-left-color: var(--accent); }

/* --------------------------------------------------------------------------
   Case study — body
   -------------------------------------------------------------------------- */

.case-body { max-width: 880px; }

.case-section {
    padding-bottom: 64px;
    margin-bottom: 64px;
    border-bottom: 1px solid var(--line);
}
.case-section:last-child { border-bottom: 0; margin-bottom: 0; }

.case-body h2 {
    margin: 0 0 32px;
    font-size: clamp(28px, 2.2vw, 36px);
    font-weight: 400;
    letter-spacing: -.015em;
    line-height: 1.15;
}

.case-body h3 {
    margin: 48px 0 16px;
    font-size: clamp(17px, 1.25vw, 20px);
    font-weight: 500;
    line-height: 1.35;
}
.case-body h2 + h3 { margin-top: 0; }

.case-body p,
.case-body li {
    font-size: clamp(15px, 1.05vw, 17px);
    line-height: 1.65;
    color: var(--ink-2);
}
.case-body p { margin: 0 0 1em; max-width: 68ch; }
.case-body p:last-child { margin-bottom: 0; }
.case-body strong { color: var(--ink); font-weight: 500; }

.meta-list { margin: 32px 0 0; }
.meta-list dt {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}
.meta-list dd {
    margin: 0 0 20px;
    font-size: clamp(15px, 1.05vw, 17px);
    color: var(--ink);
}

.case-cta {
    display: inline-flex;
    align-items: center;
    font-size: clamp(15px, 1.05vw, 17px);
    color: var(--ink-2);
    transition: color var(--fast) var(--ease);
}
.case-cta:hover { color: var(--ink); }

.case-figure { margin: 40px 0; }
.case-figure img {
    width: 100%;
    border-radius: var(--radius);
    background: var(--surface);
}
.case-figure figcaption {
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
}

.image-stack { display: grid; gap: 24px; margin-top: 32px; }
.image-stack img { width: 100%; border-radius: var(--radius); background: var(--surface); }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 32px 0 0;
}
.metric {
    padding: 20px;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: inset 0 0 0 1px var(--line);
}
.metric .n {
    display: block;
    font-size: clamp(24px, 2vw, 32px);
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
}
.metric .d { display: block; margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }

.note {
    margin-top: 32px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink-2);
}

/* Stage selector (interactive pipeline) */
.stages {
    margin: 0 0 12px;
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    overflow: hidden;
}
.stage-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.stage-tabs::-webkit-scrollbar { display: none; }
.stage-tab {
    flex: 0 0 auto;
    appearance: none;
    border: 0;
    background: none;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-ctl);
    font: inherit;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.stage-tab:hover { color: var(--ink); }
.stage-tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), inset 0 0 0 1px var(--line); }
.stage-panel { padding: 20px 24px 24px; }
.stage-panel h4 { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.case-body .stage-panel p { font-size: 15px; }
.stage-panel.is-entering { animation: card-in var(--slow) var(--ease) both; }

/* Next case study */
.next-case {
    display: block;
    margin-top: 80px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.next-case small { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.next-case span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(20px, 1.7vw, 28px);
    letter-spacing: -.01em;
}
.next-case kubai-icon { width: 20px; height: 20px; }

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

.about {
    max-width: 1440px;
    margin: 0 auto;
    padding: 48px calc(var(--gutter) + 32px) 40px var(--gutter);
}

.about-hero {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(32px, 8vw, 120px);
    align-items: center;
}
.about-portrait {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 20px;
    background: var(--surface);
}
.about-carousel {
    position: relative;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.about-carousel.is-dragging { cursor: grabbing; }
.about-carousel-track {
    display: flex;
    height: 100%;
    transition: transform 600ms var(--ease);
}
.about-carousel.is-dragging .about-carousel-track { transition: none; }
.about-carousel-track img {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.about-carousel-dots {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
}
.about-carousel-dots span {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .4);
    transition: background-color var(--slow) var(--ease);
}
.about-carousel-dots span.is-active { background: #fff; }

.about-intro {
    margin: 0;
    font-size: clamp(20px, 2vw, 32px);
    line-height: 1.4;
    letter-spacing: -.01em;
    color: var(--ink-2);
    text-wrap: pretty;
}
.about-intro strong { font-weight: 400; color: var(--ink); }

.about-logos {
    margin: 96px 0 72px;
    overflow: hidden;
}
.about-logos img {
    width: 100%;
    height: auto;
    opacity: .45;
    filter: var(--logo-filter);
}

.about-section { margin-bottom: 72px; }
.about-heading {
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-strong);
    font-size: clamp(16px, 1.2vw, 20px);
    font-weight: 500;
}
.about-section .exp-list li { font-size: clamp(15px, 1.1vw, 18px); }

.about-copy p {
    margin: 0 0 1.4em;
    max-width: 64ch;
    font-size: clamp(16px, 1.4vw, 22px);
    line-height: 1.55;
    color: var(--ink-2);
}
.about-copy p:last-child { margin-bottom: 0; }
.about-copy strong { font-weight: 400; color: var(--ink); }

.about-photos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    margin: 96px 0;
}
/* Hidden until real photos replace the placeholders */
.about-photos:has(.is-placeholder) { display: none; }
.about-photo {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 20px;
    background: var(--surface);
}

.about-connect {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding-bottom: 72px;
    border-bottom: 1px solid var(--line);
}
.connect-title {
    margin: 0 0 20px;
    font-size: clamp(32px, 3.6vw, 56px);
    font-weight: 400;
    letter-spacing: -.025em;
    line-height: 1.1;
}
.connect-title span { color: var(--muted); }
.connect-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 15px;
    color: var(--ink-2);
}
.btn-dark {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 20px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--on-ink);
    font-size: 15px;
    transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn-dark kubai-icon { color: inherit; opacity: .72; }
.btn-dark:hover { opacity: .9; }
.btn-dark:active { transform: scale(.98); }

.about-footer {
    padding-top: 24px;
    font-size: 14px;
    color: var(--ink);
}
.about-footer span { color: var(--muted); }

@media (max-width: 760px) {
    .about-hero { grid-template-columns: minmax(0, 1fr); }
    .about-portrait { max-width: 420px; }
    .about-photos { grid-template-columns: minmax(0, 1fr); }
    .about-logos { margin: 64px 0 48px; }
}

/* About page bits */
.exp-list { list-style: none; margin: 0; padding: 0; }
.exp-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}
.exp-list li:first-child { padding-top: 0; }
.exp-role { color: var(--ink); }
.exp-org { grid-column: 1; color: var(--muted); font-size: .85em; }
.exp-date { grid-row: 1; grid-column: 2; color: var(--muted); font-size: .85em; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Pull cord — the lamp switch. Toggles dark mode. Built by site.js.
   -------------------------------------------------------------------------- */

.pullcord {
    position: fixed;
    top: 0;
    right: 24px;
    width: 0;
    height: 0;
    z-index: 30;
}
.pullcord-rope {
    position: absolute;
    left: -100px;
    top: 0;
    width: 200px;
    height: 240px;
    overflow: visible;
    pointer-events: none;
}
.pullcord-rope path {
    fill: none;
    stroke: var(--cord);
    stroke-width: 1.5;
    stroke-linecap: round;
}
.pullcord-knob {
    position: absolute;
    left: 0;
    top: 0;
    width: 16px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: var(--card);
    box-shadow: inset 0 0 0 1px var(--line-strong), 0 2px 6px rgba(0, 0, 0, .12);
    cursor: grab;
    touch-action: none;
    will-change: transform;
}
.pullcord-knob::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: var(--accent);
}
:root:is([data-theme="dark"], [data-theme="oled"], [data-theme="slate"]) .pullcord-knob {
    background: #3a3631;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 0 0 1px var(--line-strong);
}
.pullcord-knob:active { cursor: grabbing; }
.pullcord-knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* --------------------------------------------------------------------------
   Header identity — avatar with a story ring, name, verified badge, location
   -------------------------------------------------------------------------- */

.site-id {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.site-id-text { display: grid; line-height: 1.25; }
.site-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.site-name kubai-icon,
.site-name .verified kubai-icon { color: var(--verified); width: 16px; height: 16px; }
.verified { display: inline-flex; }
.site-loc { font-size: 13px; color: var(--muted); }

.avatar-ring {
    --ring: linear-gradient(45deg, #feda75, #fa7e1e 30%, #d62976 60%, #962fbf 80%, #4f5bd5);
    position: relative;
    flex: none;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 2px;
    border: 0;
    border-radius: 50%;
    background: var(--ring);
    cursor: pointer;
    transition: transform var(--fast) var(--ease);
}
.avatar-ring.is-seen { --ring: var(--line-strong); }
.avatar-ring:active { transform: scale(.96); }
.avatar-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--bg);
    object-fit: cover;
    object-position: 62% 30%;
    background: var(--surface);
}
.avatar-ring:focus-visible { outline-offset: 2px; border-radius: 50%; }

/* --------------------------------------------------------------------------
   Stories viewer
   -------------------------------------------------------------------------- */

.stories {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    opacity: 0;
    transition: opacity 220ms var(--ease);
}
.stories[hidden] { display: none; }
.stories.is-open { opacity: 1; }

.story-stage {
    display: flex;
    align-items: center;
    gap: 16px;
}

.story-card {
    position: relative;
    height: min(86vh, 820px);
    aspect-ratio: 9 / 16;
    border-radius: 16px;
    overflow: hidden;
    background: #7a7a7a;
    color: #fff;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
    transform: translateY(8px) scale(.98);
    transition: transform 300ms var(--ease);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.stories.is-open .story-card { transform: none; }

.story-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
/* grey stand-in until real photos are added */
.story-media.is-empty { background: linear-gradient(180deg, #8c8c8c, #6c6c6c); }

.story-card::before {
    /* neutral scrim so the top text reads on any photo */
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 120px;
    z-index: 1;
    background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.story-bars {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    gap: 4px;
}
.story-bars span {
    flex: 1;
    height: 2px;
    border-radius: 1px;
    background: rgba(255, 255, 255, .35);
    overflow: hidden;
}
.story-bars i {
    display: block;
    height: 100%;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left;
}

.story-head {
    position: absolute;
    top: 24px;
    left: 16px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    font-size: 13px;
}
.story-head b { font-weight: 500; }
.story-head span {
    flex: 1;
    min-width: 0;
    color: rgba(255, 255, 255, .72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.story-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-ctl);
    background: none;
    color: #fff;
    cursor: pointer;
}
.story-close kubai-icon { color: #fff; width: 20px; height: 20px; }

.story-loc {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 12px 0 8px;
    border-radius: var(--radius-ctl);
    background: #fff;
    color: #171717;
    font-size: 13px;
    font-weight: 500;
}
.story-loc[hidden] { display: none; }
.story-loc kubai-icon { color: #e5484d; }

.story-nav {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--card);
    box-shadow: inset 0 0 0 1px var(--line), 0 2px 6px rgba(0, 0, 0, .08);
    color: var(--ink);
    cursor: pointer;
    transition: opacity var(--fast) var(--ease);
}
.story-nav:disabled { opacity: 0; pointer-events: none; }
.story-nav kubai-icon { color: var(--ink); width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   Accessibility panel — bottom right, always available
   -------------------------------------------------------------------------- */

.a11y-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
    cursor: pointer;
    transition: transform var(--fast) var(--ease);
}
.a11y-btn:active { transform: scale(.96); }
.a11y-btn kubai-icon { color: var(--on-ink); width: 24px; height: 24px; }

.a11y-panel {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 41;
    width: min(340px, calc(100vw - 40px));
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 16px;
    background: var(--card);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line), 0 16px 48px rgba(0, 0, 0, .16);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.a11y-panel[hidden] { display: none; }
.a11y-panel.is-open { opacity: 1; transform: none; }

.a11y-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.a11y-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.a11y-reset {
    margin: 0;
    padding: 0 8px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}
.a11y-reset:hover { color: var(--ink); }

.a11y-group { margin: 0 0 20px; padding: 0; border: 0; }
.a11y-group:last-child { margin-bottom: 0; }
.a11y-group legend { padding: 0; margin-bottom: 8px; font-size: 13px; color: var(--muted); }

.a11y-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.a11y-swatch { position: relative; display: grid; gap: 4px; justify-items: center; cursor: pointer; }
.a11y-swatch input,
.a11y-option input,
.a11y-seg input { position: absolute; opacity: 0; pointer-events: none; }
.a11y-swatch b {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    font-family: Georgia, serif;
    font-weight: 400;
    font-size: 16px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.a11y-swatch small { font-size: 11px; color: var(--ink-2); }
.a11y-swatch input:checked + b { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.a11y-swatch input:focus-visible + b { outline: 2px solid var(--accent); outline-offset: 4px; }

.a11y-options { display: grid; gap: 4px; }
.a11y-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-ctl);
    font-size: 15px;
    cursor: pointer;
    transition: background-color var(--fast) var(--ease);
}
.a11y-option:hover { background: var(--surface); }
.a11y-option small { font-family: var(--font-ui, inherit); font-size: 12px; color: var(--muted); }
.a11y-option:has(input:checked) { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.a11y-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.a11y-seg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface);
}
.a11y-seg label {
    position: relative;
    display: grid;
    place-items: center;
    height: 32px;
    border-radius: var(--radius-ctl);
    color: var(--muted);
    cursor: pointer;
}
.a11y-seg label:has(input:checked) { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), inset 0 0 0 1px var(--line); }
.a11y-seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

.a11y-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 15px;
    cursor: pointer;
}
.a11y-switch input {
    appearance: none;
    position: relative;
    flex: none;
    width: 40px;
    height: 24px;
    margin: 0;
    border-radius: 12px;
    background: var(--line-strong);
    cursor: pointer;
    transition: background-color var(--fast) var(--ease);
}
.a11y-switch input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform var(--fast) var(--ease);
}
.a11y-switch input:checked { background: var(--ink); }
.a11y-switch input:checked::after { transform: translateX(16px); background: var(--card); }

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

@media (max-width: 1600px) {
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    :root { --header-h: 56px; }

    .shell { grid-template-columns: minmax(0, 1fr); gap: 48px; }
    .side { position: static; padding-bottom: 0; }

    .site-clock span { display: none; }
    .site-nav { font-size: 14px; gap: 16px; }

    .case-side .toc { display: none; }
    .case-lede { margin-bottom: 0; }
}

@media (max-width: 600px) {
    .project-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .metric-grid { grid-template-columns: minmax(0, 1fr); }
    .filter button { padding: 0 12px; }
    .work-count { display: none; }
    .site-clock { display: none; }
    .exp-list li { grid-template-columns: minmax(0, 1fr); }
    .exp-date { grid-row: auto; grid-column: 1; }
    .pullcord { right: 12px; }
    .site-id { gap: 8px; }
    .avatar-ring { width: 36px; height: 36px; }
    .site-name { font-size: 15px; }
    .site-name, .site-nav a { white-space: nowrap; }
    .site-nav .arrow-out kubai-icon { display: none !important; }
    .site-header { gap: 12px; }
    .story-nav { display: none; }
    .story-card { height: 100dvh; width: 100vw; aspect-ratio: auto; border-radius: 0; }
    .a11y-btn { right: 16px; bottom: 16px; }
    .a11y-panel { right: 16px; bottom: 76px; width: calc(100vw - 32px); }
    .site-header,
    .shell,
    .about { padding-right: calc(var(--gutter) + 20px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}

/* Figma-style corner smoothing.
   Browsers without corner-shape keep the plain radii above. */
@supports (corner-shape: superellipse(2)) {
    :root {
        --smooth-shape: superellipse(1.6);
        --smooth-scale: 1.6;
        --radius-smooth: calc(var(--radius) * var(--smooth-scale));
    }
    .card-media,
    .case-figure img,
    .image-stack img,
    .metric,
    .note,
    .stages {
        border-radius: var(--radius-smooth);
        corner-shape: var(--smooth-shape);
    }
    .about-portrait,
    .about-photo {
        border-radius: calc(20px * var(--smooth-scale));
        corner-shape: var(--smooth-shape);
    }
}
