/* pawmadsen.dk — one stylesheet, no fonts or scripts from anywhere else. */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1d1a17;
  --muted: #5f5850;
  --line: #e6e0d8;
  --accent: #c2410c;
  --accent-soft: #fdeee4;
  --shadow: 0 1px 2px rgb(29 26 23 / 0.04), 0 8px 24px rgb(29 26 23 / 0.06);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --surface: #1d1a17;
    --text: #f2ede7;
    --muted: #a99f94;
    --line: #2f2a25;
    --accent: #fb923c;
    --accent-soft: #2c1d12;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* Anchor jumps land below the sticky header, which grows to two rows on narrow screens */
[id] { scroll-margin-top: 4.5rem; }
@media (max-width: 62rem) { [id] { scroll-margin-top: 6.5rem; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

.wrap { width: min(100% - 2rem, 62rem); margin-inline: auto; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 1rem; min-height: 3.75rem; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; margin-right: auto; }
.brand span { color: var(--accent); }
.top nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.lang { border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.lang:hover { color: var(--text); border-color: var(--muted); }
/* Narrow screens: the menu gets its own row under the name and scrolls sideways, so every page stays one tap away */
@media (max-width: 62rem) {
  .top .wrap { flex-wrap: wrap; row-gap: 0.4rem; min-height: 0; padding-top: 0.7rem; }
  .top nav { order: 3; width: 100%; flex-wrap: nowrap; gap: 1.1rem; overflow-x: auto; padding-bottom: 0.65rem; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a { white-space: nowrap; font-size: 0.9rem; }
}

/* Hero */
.hero { padding: clamp(3.5rem, 10vw, 7rem) 0 clamp(2.5rem, 6vw, 4rem); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; margin: 0 0 1rem; }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 1.25rem; max-width: 18ch; }
.lead { font-size: clamp(1.1rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 40rem; margin: 0 0 2rem; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.2rem; border-radius: 0.6rem; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); color: var(--text); background: var(--surface);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #1d1a17; } }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 2.5rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.95rem; }
.facts li::before { content: "•"; color: var(--accent); margin-right: 0.5rem; }

/* Sections */
section { padding: clamp(2.5rem, 6vw, 4rem) 0; border-top: 1px solid var(--line); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 0.5rem; }
.sub { color: var(--muted); margin: 0 0 2rem; max-width: 40rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; padding: 1.5rem; box-shadow: var(--shadow); }
.card .icon { width: 2.5rem; height: 2.5rem; border-radius: 0.6rem; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 1rem; }
.card .icon svg { width: 1.3rem; height: 1.3rem; }
.card p { margin: 0 0 0.75rem; color: var(--muted); }
.card ul { margin: 0; padding-left: 1.1rem; }
.card li { margin: 0.2rem 0; }

/* Experience */
.timeline { display: grid; gap: 1.75rem; }
.role { display: grid; grid-template-columns: 11rem 1fr; gap: 0.25rem 2rem; }
.role .when { color: var(--muted); font-size: 0.95rem; padding-top: 0.15rem; font-variant-numeric: tabular-nums; }
.role p { margin: 0.25rem 0 0; color: var(--muted); }
.role ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.role li { margin: 0.25rem 0; }
@media (max-width: 40rem) { .role { grid-template-columns: 1fr; } }

/* Technology */
.stack { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.stack h3 { font-size: 0.95rem; color: var(--muted); font-weight: 600; margin-bottom: 0.6rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.chips li { font-size: 0.875rem; padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }

/* Side projects */
.side { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin: 0; padding: 0; list-style: none; }
.side li { border-left: 3px solid var(--accent); padding: 0.25rem 0 0.25rem 1rem; }
.side strong { display: block; }
.side span { color: var(--muted); font-size: 0.95rem; }
.side-more { margin-top: 1.5rem; }

/* Gallery: square thumbnails linking to the full image; a tag says photo or AI */
.gallery { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); margin: 0; padding: 0; list-style: none; }
.gallery figure { margin: 0; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; overflow: hidden; box-shadow: var(--shadow); }
.gallery a { display: block; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.gallery a:hover img { filter: brightness(1.06); }
.gallery figcaption { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem 0.7rem; font-size: 0.9rem; }
.tag { flex: none; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; padding: 0 0.55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ai { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.gallery + .actions { margin-top: 1.5rem; }
@media (max-width: 40rem) {
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .gallery figcaption { padding: 0.5rem 0.6rem 0.6rem; font-size: 0.85rem; }
}

/* Image viewer (js/viewer.js): the dialog covers the viewport; the page underneath stays put */
.viewer { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0c0a09; color: #f2ede7; }
.viewer::backdrop { background: transparent; }
/* Vertical scroll and pinch-zoom stay the browser's; a sideways drag is ours, so swipes aren't taken as a pan or back gesture */
.viewer { touch-action: pan-y pinch-zoom; }
/* The viewer is dark in both themes, so the plain tag can't use the light theme's muted colours */
.viewer .tag:not(.ai) { color: #a99f94; border-color: #3a342e; }
.viewer[open] { display: grid; place-items: center; }
html:has(.viewer[open]) { overflow: hidden; }
.viewer figure { margin: 0; display: grid; justify-items: center; gap: 0.75rem; padding: 4rem 1rem 1.5rem; }
.viewer img { display: block; max-width: min(92vw, 70rem); max-height: calc(100dvh - 10rem); width: auto; height: auto; border-radius: 0.5rem; }
.viewer figcaption { display: flex; align-items: center; gap: 0.75rem; font-size: 0.95rem; text-align: center; }
.viewer-count { color: #a99f94; font-variant-numeric: tabular-nums; }
.viewer button { position: absolute; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0 0 0.15rem; border: 0; border-radius: 999px; background: rgb(255 255 255 / 0.12); color: inherit; font: 400 1.75rem/1 system-ui, sans-serif; cursor: pointer; }
.viewer button:hover { background: rgb(255 255 255 / 0.22); }
.viewer button[hidden] { display: none; }
.viewer-close { top: 1rem; right: 1rem; }
.viewer-prev, .viewer-next { top: 50%; translate: 0 -50%; }
.viewer-prev { left: 1rem; }
.viewer-next { right: 1rem; }
@media (max-width: 40rem) { .viewer-prev, .viewer-next { top: auto; bottom: 1rem; translate: none; } }

/* Projects: a featured project with its picture beside the text */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; }
.feature-media { display: grid; gap: 1rem; }
.feature-media a { display: block; }
.feature-media img { display: block; width: 100%; height: auto; border-radius: 0.9rem; border: 1px solid var(--line); box-shadow: var(--shadow); }
.feature ul { margin: 0 0 1.5rem; padding-left: 1.1rem; }
.feature li { margin: 0.25rem 0; }
.feature p:not(.eyebrow) { color: var(--muted); }
@media (max-width: 48rem) { .feature { grid-template-columns: 1fr; } }

/* Cases: one article per job, with before → after figures up front */
.case { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1.5rem, 4vw, 2.5rem); box-shadow: var(--shadow); }
.case + .case { margin-top: 2rem; }
.case > p:not(.eyebrow) { color: var(--muted); max-width: 46rem; }
.case-meta { font-size: 0.95rem; margin: 0 0 1rem; }
.stats { display: grid; gap: 0.75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 1.75rem 0; padding: 0; list-style: none; }
.stats li { background: var(--bg); border-radius: 0.7rem; padding: 0.9rem 1rem; }
.stats strong { display: block; font-size: 1.35rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.stats span { display: block; font-size: 0.875rem; line-height: 1.4; color: var(--muted); margin-top: 0.2rem; hyphens: auto; overflow-wrap: break-word; }
@media (max-width: 40rem) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; } .stats li { padding: 0.75rem 0.8rem; } .stats strong { font-size: 1.05rem; white-space: normal; } }
.case-parts { display: grid; gap: 1.5rem 2rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.case-parts h3 { margin-bottom: 0.4rem; }
.case-parts ul { margin: 0; padding-left: 1.1rem; }
.case-parts li { margin: 0.3rem 0; font-size: 0.975rem; }
.case .chips { margin-top: 1.25rem; }

/* Story pages: the text in a readable column, pictures in a grid under the text they belong to */
.story > :is(p, ul:not(.figs), ol, h3) { max-width: 44rem; }
.story > :is(ul:not(.figs), ol) { padding-left: 1.2rem; }
.story li { margin: 0.35rem 0; }
.story > h3 { margin-top: 1.75rem; }
.figs { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin: 1.75rem 0 0.5rem; padding: 0; list-style: none; }
.figs li { margin: 0; min-width: 0; }
.figs .wide { grid-column: 1 / -1; }
.figs figure { margin: 0; height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; overflow: hidden; box-shadow: var(--shadow); }
/* Renders sit on the dark backdrop they were made on, so a small animation isn't stretched to fill the frame */
.figs a { display: grid; place-items: center; flex: 1; background: #181a20; }
.figs img { display: block; width: 100%; height: auto; }
.figs .small img { width: auto; max-width: 100%; }
/* An animation shows its still on the page; the play mark says a click plays it in the viewer */
.figs a.play { position: relative; }
.figs a.play::after {
  content: "\25B6\FE0E"; content: "\25B6\FE0E" / "";
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 3rem; height: 3rem; padding-left: 0.2rem; border-radius: 999px;
  background: rgb(0 0 0 / 0.55); color: #fff; font: 1.1rem/1 system-ui, sans-serif;
}
.figs a.play:hover::after { background: var(--accent); }
.figs figcaption { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; padding: 0.6rem 0.9rem 0.7rem; font-size: 0.9rem; color: var(--muted); }
.hero .stats { margin: 2.5rem 0 0; }
.hero .stats li { background: var(--surface); border: 1px solid var(--line); }
.timeline.days { gap: 0.9rem; margin: 1.5rem 0 0; }
.timeline.days .role { grid-template-columns: 9rem 1fr; }
.timeline.days .role p { margin: 0; }
.timeline.days .when { padding-top: 0.1rem; }
@media (max-width: 40rem) { .timeline.days .role { grid-template-columns: 1fr; } }
/* An architecture sketch in plain HTML: the server on top, the apps under it, so it reads at any width */
.arch { max-width: 44rem; margin: 1.75rem 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; box-shadow: var(--shadow); text-align: center; }
.arch strong { display: block; }
.arch strong + span { display: block; color: var(--muted); font-size: 0.875rem; }
.arch-hub { padding: 0.8rem 1rem; border: 1px solid var(--accent); border-radius: 0.7rem; background: var(--accent-soft); }
.arch-link { margin: 0.7rem 0; color: var(--muted); font-size: 0.9rem; }
.arch-link.p2p { color: var(--accent); font-weight: 600; }
.arch-clients { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.arch-clients li { margin: 0; padding: 0.7rem 0.5rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--bg); }
.arch figcaption { margin-top: 0.9rem; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 40rem) { .arch-clients { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Text only screen readers get, such as "opens in a new tab" */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Contact */
.contact { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1.5rem, 4vw, 2.5rem); box-shadow: var(--shadow); }
.contact .actions { margin-top: 1.5rem; }
.note { color: var(--muted); font-size: 0.95rem; margin: 1.25rem 0 0; }

footer { padding: 2rem 0 3rem; color: var(--muted); font-size: 0.9rem; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

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