/* Public site. One typeface (Schibsted Grotesk, self-hosted for the CSP), one accent, light and dark themes. */

@font-face {
    font-family: "Schibsted Grotesk";
    src: url("/fonts/schibsted-grotesk.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    --paper: #f3f4f1;
    --surface: #ffffff;
    --ink: #15181b;
    --muted: #5a6168;
    --line: #d9ddd8;
    --line-strong: #b9bfb9;
    --accent: #1d6b4e;
    --accent-ink: #ffffff;
    --accent-soft: #dcebe3;
    --shadow: 0 1px 2px rgba(21, 24, 27, .05), 0 12px 32px rgba(21, 24, 27, .07);

    --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --step--1: .875rem;
    --step-0: 1.0625rem;
    --step-1: 1.25rem;
    --step-2: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    --step-3: clamp(2.1rem, 1.5rem + 2.6vw, 3.25rem);
    --step-4: clamp(2.5rem, 1.6rem + 3.9vw, 4.5rem);

    --space-1: .5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2.5rem;
    --space-5: clamp(3.5rem, 2.5rem + 4vw, 6rem);
    --space-6: clamp(4.5rem, 3rem + 6vw, 8.5rem);
    --radius: .875rem;
    --radius-small: .5rem;
    --width: 72rem;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #0e1011;
    --surface: #16191b;
    --ink: #e9ece8;
    --muted: #9aa2a7;
    --line: #272b2e;
    --line-strong: #3a3f43;
    --accent: #72d3a6;
    --accent-ink: #0b1712;
    --accent-soft: #17302a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
}

/* Base */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--step-0);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-weight: 650; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

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

.container {
    width: min(100% - 2.5rem, var(--width));
    margin-inline: auto;
}

.skip-link {
    position: absolute;
    z-index: 100;
    top: .75rem;
    left: .75rem;
    padding: .6rem 1rem;
    border-radius: var(--radius-small);
    background: var(--ink);
    color: var(--paper);
    transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
    width: 1em;
    height: 1em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Header */

.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper), transparent 12%);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: min(100% - 2.5rem, var(--width));
    min-height: 4rem;
    margin-inline: auto;
}

.brand {
    margin-right: auto;
    font-size: var(--step-0);
    font-weight: 700;
    letter-spacing: -.01em;
}

.site-nav {
    display: flex;
    gap: var(--space-3);
    font-size: var(--step--1);
}

.site-nav a,
.header-cv {
    color: var(--muted);
    transition: color .2s;
}

.site-nav a:hover,
.header-cv:hover { color: var(--ink); }

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-cv {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: var(--step--1);
    font-weight: 600;
}

.theme-toggle {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: border-color .2s;
}

.theme-toggle:hover { border-color: var(--line-strong); }
.theme-toggle .icon { width: 1.1rem; height: 1.1rem; grid-area: 1 / 1; }
.theme-toggle .icon-moon,
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Buttons and links */

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1.25rem;
}

.button {
    display: inline-flex;
    min-height: 2.875rem;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .65rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: var(--step--1);
    font-weight: 650;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}

.button-primary {
    background: var(--ink);
    color: var(--paper);
}

.button-primary:hover { background: var(--accent); color: var(--accent-ink); }

.button-secondary {
    border-color: var(--line-strong);
    color: var(--ink);
}

.button-secondary:hover { border-color: var(--ink); }

.text-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 2.75rem;
    font-size: var(--step--1);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: .3em;
    transition: text-decoration-color .2s;
}

.text-link:hover { text-decoration-color: currentColor; }

/* Shared pieces */

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-3) var(--space-4);
    margin: 0;
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
}

.facts dt {
    margin-bottom: .25rem;
    color: var(--muted);
    font-size: var(--step--1);
}

.facts dd {
    margin: 0;
    font-weight: 550;
}

.title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
}

.status {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .8125rem;
    font-weight: 650;
    line-height: 1.4;
    white-space: nowrap;
}

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

.tags li {
    padding: .2rem .65rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .8125rem;
    line-height: 1.5;
}

.tags-small li { font-size: .78rem; }

/* Hero */

.hero {
    padding: var(--space-5) 0 var(--space-5);
}

.hero h1 {
    max-width: 18ch;
    font-size: var(--step-4);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.04;
}

.hero-lead {
    max-width: 38rem;
    margin-top: var(--space-3);
    color: var(--muted);
    font-size: var(--step-1);
    line-height: 1.55;
}

.hero .actions { margin-top: var(--space-4); }
.hero .facts { margin-top: var(--space-5); }

/* Work */

.work { padding-bottom: var(--space-5); }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem var(--space-4);
    margin-bottom: var(--space-4);
}

.section-head h2,
.about h2,
.contact h2 {
    font-size: var(--step-3);
    font-weight: 700;
    letter-spacing: -.03em;
}

.section-head p {
    max-width: 30rem;
    color: var(--muted);
}

.feature {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.feature + .feature { margin-top: var(--space-3); }

.feature-media {
    display: block;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: var(--paper);
}

.feature-media img {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top left;
    transition: transform .6s var(--ease);
}

.feature:hover .feature-media img { transform: scale(1.02); }

.media-placeholder {
    display: grid;
    height: 100%;
    min-height: 16rem;
    place-items: center;
    color: var(--muted);
    font-size: var(--step-2);
    font-weight: 700;
}

.feature-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.feature-body h3 {
    font-size: var(--step-2);
    font-weight: 700;
    letter-spacing: -.03em;
}

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

.feature-desc { color: var(--muted); }

.feature-role {
    font-size: var(--step--1);
}

.feature-role span:first-child {
    margin-right: .35rem;
    color: var(--muted);
}

.feature-body .actions { margin-top: auto; padding-top: var(--space-2); }

.more { margin-top: var(--space-5); }

.more-title {
    margin-bottom: var(--space-2);
    font-size: var(--step-1);
    font-weight: 650;
}

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

.project-row {
    position: relative;
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line);
}

.row-media {
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
}

.row-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
}

.row-body {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.row-body h4 {
    font-size: var(--step-1);
    font-weight: 650;
}

.row-body p {
    max-width: 44rem;
    color: var(--muted);
    font-size: .975rem;
}

.row-body .tags { margin-top: .25rem; }

/* The title link covers the whole row; the row has no other links. */
.row-link::after {
    position: absolute;
    inset: 0;
    content: "";
}

.row-link:focus-visible { outline: none; }
.project-row:has(.row-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-small); }

.row-arrow {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--muted);
    transition: transform .25s var(--ease), color .25s;
}

.project-row:hover .row-arrow { color: var(--accent); transform: translateX(4px); }
.project-row:hover h4 { color: var(--accent); }

.empty-note { color: var(--muted); }
.empty-note a { text-decoration: underline; text-underline-offset: .25em; }

/* About */

.about {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: var(--space-4) var(--space-5);
    padding: var(--space-5) 0;
    border-top: 1px solid var(--line);
}

.about-text h2 { margin-bottom: var(--space-3); }

.about-text p {
    max-width: 38rem;
    color: var(--ink);
    font-size: var(--step-1);
    line-height: 1.6;
}

.about-text p + p { margin-top: var(--space-2); }

.about-side h3 {
    margin-bottom: var(--space-2);
    color: var(--muted);
    font-size: var(--step--1);
    font-weight: 600;
    letter-spacing: 0;
}

.about-side .tags li {
    color: var(--ink);
    font-size: .875rem;
}

.portrait {
    width: min(100%, 16rem);
    aspect-ratio: 4 / 5;
    margin-bottom: var(--space-4);
    border-radius: var(--radius);
    object-fit: cover;
}

/* Contact */

.contact {
    padding: var(--space-5) 0 var(--space-6);
    border-top: 1px solid var(--line);
}

.contact > p {
    margin-top: var(--space-2);
    color: var(--muted);
}

.contact-email {
    display: inline-block;
    margin: var(--space-3) 0 var(--space-3);
    font-size: clamp(1.4rem, 1rem + 2.4vw, 2.5rem);
    font-weight: 650;
    letter-spacing: -.03em;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: .2em;
}

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

/* Footer */

.site-footer { border-top: 1px solid var(--line); }

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    width: min(100% - 2.5rem, var(--width));
    margin-inline: auto;
    padding: var(--space-3) 0;
    color: var(--muted);
    font-size: var(--step--1);
}

.footer-inner ul { display: flex; gap: var(--space-3); }
.footer-inner a { display: inline-block; padding: .5rem 0; }
.footer-inner a:hover { color: var(--ink); }

/* Project page */

.case { padding: var(--space-4) 0 var(--space-6); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.75rem;
    color: var(--muted);
    font-size: var(--step--1);
    font-weight: 600;
}

.back-link:hover { color: var(--ink); }
.back-link .icon { transition: transform .2s var(--ease); }
.back-link:hover .icon { transform: translateX(-3px); }

.case-head { padding: var(--space-4) 0 var(--space-4); }

.case-head h1 {
    font-size: var(--step-4);
    font-weight: 700;
    letter-spacing: -.035em;
}

.case-lead {
    max-width: 40rem;
    margin-top: var(--space-2);
    color: var(--muted);
    font-size: var(--step-1);
    line-height: 1.55;
}

.case-head .actions { margin-top: var(--space-3); }
.case-head .facts { margin-top: var(--space-4); }

.case-cover {
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.case-cover img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top left;
}

.case-story { margin-top: var(--space-5); }

.case-block {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: var(--space-2) var(--space-5);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--line);
}

.case-block h2 {
    font-size: var(--step-2);
    font-weight: 650;
    letter-spacing: -.025em;
}

.case-block div { max-width: 40rem; }

.case-block p {
    font-size: var(--step-0);
    line-height: 1.7;
}

.case-block p + p { margin-top: var(--space-2); }

.case-gallery { margin-top: var(--space-5); }

.case-gallery h2 {
    margin-bottom: var(--space-3);
    font-size: var(--step-2);
    font-weight: 650;
    letter-spacing: -.025em;
}

.case-gallery ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: var(--space-2);
}

.case-gallery a {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
    cursor: zoom-in;
}

.case-gallery img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top left;
    transition: transform .5s var(--ease);
}

.case-gallery a:hover img { transform: scale(1.02); }

.case-next {
    margin-top: var(--space-6);
    border-top: 1px solid var(--line);
}

.case-next a {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: .25rem var(--space-3);
    padding-top: var(--space-4);
}

.case-next span {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: var(--step--1);
}

.case-next strong {
    font-size: var(--step-3);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.05;
    transition: color .25s;
}

.case-next .icon {
    width: clamp(1.5rem, 1rem + 2vw, 2.5rem);
    height: clamp(1.5rem, 1rem + 2vw, 2.5rem);
    margin-bottom: .3rem;
    transition: transform .25s var(--ease);
}

.case-next a:hover strong { color: var(--accent); }
.case-next a:hover .icon { transform: translateX(6px); }

.preview-banner {
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: max-content;
    max-width: calc(100% - 2rem);
    padding: .6rem .6rem .6rem 1.1rem;
    transform: translateX(-50%);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: var(--step--1);
}

.preview-banner a {
    flex: none;
    padding: .45rem .9rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-weight: 650;
}

/* Lightbox */

.lightbox {
    width: min(100% - 2rem, 75rem);
    max-width: none;
    max-height: calc(100vh - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
}

.lightbox::backdrop {
    background: rgba(8, 10, 11, .78);
    backdrop-filter: blur(4px);
}

.lightbox[open] { animation: lightbox-in .25s var(--ease); }

@keyframes lightbox-in {
    from { opacity: 0; transform: scale(.98); }
}

.lightbox img {
    width: 100%;
    max-height: calc(100vh - 6.5rem);
    object-fit: contain;
    background: var(--paper);
}

.lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 4.25rem;
    border-top: 1px solid var(--line);
}

.lightbox-count {
    min-width: 4.5rem;
    color: var(--muted);
    font-size: var(--step--1);
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.lightbox button {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox button:hover { border-color: var(--ink); }

.lightbox-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    box-shadow: var(--shadow);
}

.lightbox[data-single] .lightbox-nav,
.lightbox[data-single] .lightbox-count { visibility: hidden; }

/* Error page */

.error-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 2rem 1.25rem;
}

.error-shell { width: min(100%, 36rem); }

.error-code {
    margin-bottom: var(--space-2);
    color: var(--muted);
    font-size: var(--step--1);
    font-weight: 600;
}

.error-shell h1 {
    font-size: var(--step-3);
    font-weight: 700;
    letter-spacing: -.03em;
}

.error-detail {
    margin: var(--space-2) 0 var(--space-4);
    color: var(--muted);
}

/* Responsive */

@media (max-width: 900px) {
    .feature { grid-template-columns: 1fr; }
    .feature-media { border-right: 0; border-bottom: 1px solid var(--line); }
    .about { grid-template-columns: 1fr; }
    .case-block { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .container,
    .header-inner,
    .footer-inner { width: min(100% - 2rem, var(--width)); }

    .header-inner { gap: var(--space-2); min-height: 3.5rem; }
    .site-nav { gap: var(--space-2); }
    .header-cv { display: none; }
    .theme-toggle { width: 2.5rem; height: 2.5rem; }

    .project-row {
        grid-template-columns: 6rem minmax(0, 1fr);
        align-items: start;
        gap: var(--space-2);
    }

    .row-arrow { display: none; }
    .row-body p { font-size: .9375rem; }
    .case-next strong { font-size: var(--step-2); }

    .preview-banner {
        flex-wrap: wrap;
        gap: .5rem;
        border-radius: var(--radius);
    }
}

@media (max-width: 380px) {
    .site-nav { display: none; }
}

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

    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
