/* vyyhti.lsx.fi
   Design system (ui-ux-pro-max, "developer portfolio personal minimal editorial", variance 6 / motion 3 / density 3):
   pattern Portfolio Grid (hero → work → about → contact), editorial brutalism: sharp corners, visible rules,
   large blocks, monochrome with one blue accent. Type: Playfair Display + Source Serif 4 + JetBrains Mono. */

@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(/fonts/playfairdisplay-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(/fonts/playfairdisplay-italic.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 300 600; font-display: swap; src: url(/fonts/sourceserif4-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 300 600; font-display: swap; src: url(/fonts/sourceserif4-italic.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url(/fonts/jetbrainsmono-normal.woff2) format("woff2"); }

/* ---------- tokens ---------- */
:root {
    --color-background: #FAFAFA;
    --color-foreground: #09090B;
    --color-card: #FFFFFF;
    --color-muted: #E8ECF0;
    --color-muted-foreground: #475569;
    --color-border: #E4E4E7;
    --color-primary: #18181B;
    --color-on-primary: #FFFFFF;
    --color-accent: #2563EB;
    --color-on-accent: #FFFFFF;
    --color-ring: #2563EB;

    --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

    /* spacious scale (density 3) */
    --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px;
    --space-5: 32px; --space-6: 48px; --space-7: 64px; --space-8: 96px; --space-9: 128px;

    --rule: 1px solid var(--color-border);
    --rule-strong: 2px solid var(--color-foreground);
    --container: 1200px;
    --gutter: clamp(20px, 4vw, 48px);

    --dur-fast: 150ms;
    --dur: 200ms;
    --ease-out: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #09090B;
        --color-foreground: #FAFAFA;
        --color-card: #131316;
        --color-muted: #1C1C21;
        --color-muted-foreground: #A1A1AA;
        --color-border: #27272A;
        --color-primary: #FAFAFA;
        --color-on-primary: #09090B;
        --color-accent: #60A5FA;
        --color-on-accent: #09090B;
        --color-ring: #60A5FA;
    }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--space-4); }
body {
    margin: 0;
    background: var(--color-background);
    color: var(--color-foreground);
    font: 400 1.125rem/1.6 var(--font-body);
    font-optical-sizing: auto;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; transition: color var(--dur-fast) ease-out, text-decoration-color var(--dur-fast) ease-out; }
a:hover { color: var(--color-accent); }
:focus-visible { outline: 3px solid var(--color-ring); outline-offset: 3px; }
::selection { background: var(--color-accent); color: var(--color-on-accent); }

.wrap { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 1em; height: 1em; flex: none; }

.skip {
    position: absolute; left: var(--space-3); top: var(--space-3); z-index: 100;
    padding: var(--space-2) var(--space-3); background: var(--color-primary); color: var(--color-on-primary);
    font: 500 0.875rem/1.4 var(--font-mono); transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

/* mono label style (eyebrows, meta, nav) */
.eyebrow, .nav, .langs, .num, .project-type, .tag, .facts dt, .bar, figcaption, .label, .foot, .section-head p, .btn, .visit, h4 {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- header ---------- */
.top {
    display: flex; align-items: center; gap: var(--space-4);
    padding-block: var(--space-4);
    border-bottom: var(--rule-strong);
}
.mark { font: 900 1.5rem/1 var(--font-display); text-decoration: none; letter-spacing: -0.01em; margin-right: auto; }
.nav, .langs { display: flex; align-items: center; }
.nav { gap: var(--space-1); }
.nav a, .langs a {
    display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--space-2);
    text-decoration: none;
}
.nav a:hover, .langs a:hover { text-decoration: underline; }
.langs { border-left: var(--rule); padding-left: var(--space-2); }
.langs a { color: var(--color-muted-foreground); }
.langs a[aria-current] { color: var(--color-foreground); text-decoration: underline; text-decoration-thickness: 2px; }
.langs .sep { color: var(--color-border); }

/* ---------- hero ---------- */
.hero {
    display: grid; gap: var(--space-6);
    padding-block: var(--space-8) var(--space-8);
    align-items: center;
}
.hero .eyebrow { color: var(--color-muted-foreground); margin-bottom: var(--space-4); }
.hero h1 {
    font-weight: 900;
    font-size: clamp(4.25rem, 15vw, 10.5rem);
    line-height: 0.9;
    letter-spacing: -0.035em;
    padding-bottom: 0.12em; /* room for the descenders of "yy" */
}
.tagline {
    font: italic 400 clamp(1.625rem, 3.4vw, 2.5rem)/1.2 var(--font-display);
    margin-top: var(--space-5);
    max-width: 20ch;
}
.lede { margin-top: var(--space-5); max-width: 58ch; color: var(--color-muted-foreground); font-size: 1.1875rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); margin-top: var(--space-6); }

.btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: 48px; padding: 0 var(--space-4);
    background: var(--color-primary); color: var(--color-on-primary);
    border: 2px solid var(--color-primary);
    font-weight: 500; text-decoration: none;
    transition: background-color var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
}
.btn:hover { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.btn:active { transform: translateY(1px); }
.textlink { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-decoration-thickness: 1px; }
.textlink:hover { text-decoration-thickness: 2px; }

.tangle { width: min(100%, 420px); justify-self: center; overflow: visible; }
.thread {
    fill: none; stroke: var(--color-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* ---------- sections ---------- */
.section { padding-block: var(--space-8); }
.section-head {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-3) var(--space-5);
    border-top: var(--rule-strong); padding-top: var(--space-4); margin-bottom: var(--space-7);
}
.section-head h2 { font-weight: 900; font-size: clamp(2.5rem, 6.5vw, 4.5rem); line-height: 1; letter-spacing: -0.03em; }
.section-head p { color: var(--color-muted-foreground); max-width: 46ch; text-transform: none; letter-spacing: 0.02em; font-size: 0.875rem; line-height: 1.5; }

/* ---------- projects ---------- */
.project + .project { margin-top: var(--space-9); }
.project-head {
    display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: var(--space-2) var(--space-4);
    padding-bottom: var(--space-4); border-bottom: var(--rule);
}
.num { color: var(--color-accent); font-weight: 500; }
.project-head h3 { font-weight: 800; font-size: clamp(2.25rem, 5.5vw, 4rem); line-height: 1; letter-spacing: -0.025em; }
.project-type { grid-column: 2; color: var(--color-muted-foreground); }
.project-link { grid-column: 2; }
.visit {
    display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px;
    font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px;
}
.visit:hover { text-decoration-thickness: 2px; }
.tag { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--space-2); border: var(--rule); color: var(--color-muted-foreground); }

.shots { position: relative; margin: var(--space-5) 0 0; }
.browser { border: var(--rule-strong); background: var(--color-card); }
.bar {
    display: flex; align-items: center; gap: var(--space-3);
    height: 36px; padding: 0 var(--space-3);
    border-bottom: var(--rule-strong);
    color: var(--color-muted-foreground);
    text-transform: none; letter-spacing: 0.02em; font-size: 0.75rem;
}
.bar::before { content: ""; width: 10px; height: 10px; border: 1.5px solid currentColor; flex: none; }
.browser img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; background: #0d0d0d; }
.phone { display: none; }
figcaption { margin-top: var(--space-3); color: var(--color-muted-foreground); text-transform: none; letter-spacing: 0.02em; }

.project-body { display: grid; gap: var(--space-6); margin-top: var(--space-6); }
.summary { font-size: clamp(1.25rem, 2.2vw, 1.5rem); line-height: 1.45; max-width: 40ch; }
h4 { font-weight: 500; color: var(--color-muted-foreground); margin-top: var(--space-6); margin-bottom: var(--space-3); }
.points li { position: relative; padding: var(--space-3) 0 var(--space-3) var(--space-5); border-top: var(--rule); max-width: 66ch; }
.points li:last-child { border-bottom: var(--rule); }
.points li::before { content: ""; position: absolute; left: 0; top: calc(var(--space-3) + 0.6em); width: 8px; height: 8px; background: var(--color-accent); }

.facts { margin: 0; border-top: var(--rule-strong); align-self: start; }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: var(--rule); }
.facts dt { color: var(--color-muted-foreground); padding-top: 0.2em; }
.facts dd { margin: 0; }

/* ---------- about ---------- */
.about { display: grid; gap: var(--space-7); }
.about-text p { font-size: clamp(1.25rem, 2.2vw, 1.5rem); line-height: 1.5; max-width: 40ch; }
.about-text p + p { margin-top: var(--space-4); font-size: 1.125rem; color: var(--color-muted-foreground); max-width: 58ch; }
.services h3 { font-size: 1.5rem; font-weight: 700; padding-bottom: var(--space-3); border-bottom: var(--rule-strong); }
.services li { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-bottom: var(--rule); }
.services strong { font-weight: 600; }
.services span { color: var(--color-muted-foreground); }
.services ul + h3 { margin-top: var(--space-7); }
.tools { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.tools li { padding: var(--space-1) var(--space-3); border: var(--rule-strong); font: 500 0.875rem/1.6 var(--font-mono); }
.exploring { margin-top: var(--space-4); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); }
.exploring .label::after { content: " →"; }

/* ---------- contact ---------- */
.contact-lead { font: 900 clamp(2.25rem, 6vw, 4.25rem)/1.05 var(--font-display); letter-spacing: -0.03em; max-width: 16ch; margin-bottom: var(--space-4); }
.contact-body > p:not(.contact-lead) { color: var(--color-muted-foreground); }
.contact-list { margin-top: var(--space-6); border-top: var(--rule-strong); max-width: 720px; }
.contact-list li { display: grid; grid-template-columns: 9rem 1fr; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: var(--rule); }
.label { color: var(--color-muted-foreground); }
.contact-list a {
    display: inline-flex; align-items: center; gap: var(--space-2); min-height: 48px;
    font: 600 clamp(1.125rem, 2.4vw, 1.5rem)/1.2 var(--font-body);
    text-decoration: none; overflow-wrap: anywhere;
}
.contact-list a:hover { text-decoration: underline; }

/* ---------- footer ---------- */
.foot {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) var(--space-4);
    padding-block: var(--space-5) var(--space-6);
    border-top: var(--rule-strong);
    color: var(--color-muted-foreground);
    text-transform: none; letter-spacing: 0.02em;
}

/* ---------- 404 ---------- */
.nf { min-height: 100dvh; display: grid; align-content: center; gap: var(--space-6); padding-block: var(--space-8); }
.nf h1 { font-weight: 900; font-size: clamp(5rem, 18vw, 10rem); line-height: 0.9; letter-spacing: -0.04em; }
.nf .tagline { max-width: none; }
.nf .tagline + p { margin-top: var(--space-1); margin-bottom: var(--space-4); }
.tangle-small { width: 180px; justify-self: start; }

/* ---------- breakpoints: 768 / 1024 ---------- */
@media (max-width: 559px) {
    .top { flex-wrap: wrap; row-gap: 0; }
    .nav { order: 3; width: 100%; margin-left: calc(-1 * var(--space-2)); }
    .facts div, .contact-list li { grid-template-columns: 1fr; gap: var(--space-1); }
    .tangle { width: min(70%, 260px); }
    .hero { padding-block: var(--space-7); }
}

@media (min-width: 768px) {
    .project-head { grid-template-columns: 3rem 1fr auto; }
    .project-type { grid-column: 2; grid-row: 2; }
    .project-link { grid-column: 3; grid-row: 1 / span 2; align-self: end; }
    .shots.has-phone { margin-bottom: var(--space-6); }
    .has-phone .phone {
        display: block; position: absolute; right: calc(-1 * var(--space-3)); bottom: calc(-1 * var(--space-6));
        width: 20%; max-width: 240px;
        border: var(--rule-strong); border-radius: 0; background: var(--color-card);
        padding: 6px;
    }
    .phone img { width: 100%; aspect-ratio: 390 / 700; object-fit: cover; object-position: top; background: #0d0d0d; }
}

@media (min-width: 1024px) {
    .hero { grid-template-columns: 7fr 5fr; gap: var(--space-7); min-height: min(86dvh, 820px); padding-block: var(--space-7); }
    .tangle { justify-self: end; }
    .project-body { grid-template-columns: 7fr 4fr; gap: var(--space-8); }
    .about { grid-template-columns: 7fr 5fr; gap: var(--space-8); }
    .nf { grid-template-columns: auto 1fr; align-items: center; }
}

/* ---------- motion (subtle, motion 3) ---------- */
@media (prefers-reduced-motion: no-preference) {
    .thread { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s var(--ease-out) 0.15s forwards; }
    @keyframes draw { to { stroke-dashoffset: 0; } }

    /* Scroll reveal only where the browser can drive it from CSS; everywhere else content is simply visible. */
    @supports (animation-timeline: view()) {
        .reveal { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 30%; }
        @keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
    }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}

@media print {
    .skip, .langs, .nav, .tangle, .actions { display: none; }
    body { background: #fff; color: #000; }
}
