/* wanghulthen.com, shared by every page: paper, ink, amber; the header and the dock.
   After editing any CSS, run python3 scripts/build-pages.py: the home page carries it inline.
   office.css is the home page (the desk); pages.css is every page you pick up from it. Rules in docs/experience.md. */

/* Fonts live on this site (no third-party request): Latin subsets, licences in assets/fonts/LICENSE.txt. */
@font-face { font-family: "Familjen Grotesk"; src: url("../fonts/familjen-grotesk-v11.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Sora; src: url("../fonts/sora-v17.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Spectral; src: url("../fonts/spectral-800-v15.woff2") format("woff2"); font-weight: 800 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Geist; src: url("../fonts/geist-v5.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono-v6.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

picture { display: contents; } /* the img inside is what the layout sees */

:root {
  --paper: oklch(97.4% 0.011 84);
  --paper-2: oklch(94.2% 0.016 80);
  --paper-3: oklch(90.5% 0.019 78);
  --wall: oklch(91.5% 0.022 78);
  --ink: oklch(23.5% 0.022 52);
  --ink-2: oklch(44% 0.02 58);
  --ink-3: oklch(58% 0.018 62);
  --rule: oklch(85.5% 0.016 78);
  --amber: oklch(78.5% 0.165 67);
  --amber-hi: oklch(83% 0.15 72);
  --amber-soft: oklch(92% 0.06 80);

  --font: "Familjen Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: clamp(1.625rem, 1.1rem + 1.6vw, 2.25rem);
  --step-3: clamp(2.125rem, 1.2rem + 3.1vw, 3.75rem);
  --step-4: clamp(2.75rem, 1.1rem + 5.6vw, 6rem);

  --gutter: clamp(16px, 4vw, 48px);
  --head: 64px;
  --dock-h: 84px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --rule-w: 2px;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .44 0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.18em; text-decoration-color: var(--amber); }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
::selection { background: var(--amber-soft); color: var(--ink); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.03em; line-height: 0.98; text-wrap: balance; }
h1 { font-size: var(--step-4); letter-spacing: -0.045em; }
h2 { font-size: var(--step-3); letter-spacing: -0.04em; }
h3 { font-size: var(--step-1); letter-spacing: -0.015em; line-height: 1.15; }
p { margin: 0; text-wrap: pretty; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 14px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- label, dot, buttons, press mark ---------- */
.label {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-2); display: inline-flex; align-items: center; gap: 10px;
}
.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--ink); }

.btn {
  --bg: var(--paper); --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px;
  border: var(--rule-w) solid var(--ink); border-radius: 0;
  background: var(--bg); color: var(--fg);
  font: 700 1rem/1 var(--font); letter-spacing: -0.005em; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 120ms var(--ease-out), background-color 160ms ease;
}
.btn:hover { --bg: var(--paper-2); }
.btn:active, .btn.is-pressed { transform: translateY(2px); }
.btn-ink { --bg: var(--ink); --fg: var(--paper); }
.btn-ink:hover { --bg: oklch(32% 0.024 52); }
.btn-amber { --bg: var(--amber); --fg: var(--ink); }
.btn-amber:hover { --bg: var(--amber-hi); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.9375rem; }
.btn[aria-pressed="true"] { --bg: var(--amber); --fg: var(--ink); }
.btn .arrow { transition: transform 200ms var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.press-mark {
  position: fixed; z-index: 60; pointer-events: none;
  width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: var(--amber); mix-blend-mode: multiply;
  animation: press 420ms var(--ease-out) forwards;
}
@keyframes press { from { transform: scale(0.4); opacity: 0.9; } to { transform: scale(1.25); opacity: 0; } }

/* ---------- header: the name, and the two ways to reach me ---------- */
.site-head {
  position: relative; z-index: 30; height: var(--head);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 var(--gutter);
}
.icon-link { display: inline-grid; place-items: center; width: 40px; height: 40px; border: var(--rule-w) solid var(--ink); background: var(--paper); color: var(--ink); }
.icon-link:hover { background: var(--paper-2); }
.site-head .btn-ink { box-shadow: 3px 3px 0 var(--amber); }

/* ---------- the dock: the things on the desk, on every page ---------- */
.dock {
  position: fixed; z-index: 25; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 5px; background: var(--paper); border: var(--rule-w) solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  max-width: calc(100vw - 2 * var(--gutter)); view-transition-name: dock;
}
.dock > * {
  position: relative; border: 0; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none;
  font: 700 0.875rem/1 var(--font); padding: 10px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.dock .short { display: none; }
.dock > *:hover { background: var(--paper-2); }
.dock > [aria-current="true"], .dock > [aria-current="page"] { background: var(--ink); color: var(--paper); }
.dock .is-tried::after { /* a tick that never moves the dock */
  content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 1.5px var(--ink);
}
.dock .dock-you { background: var(--amber); }
.dock .dock-you:hover { background: var(--amber-hi); }
.dock .dock-you[aria-current="page"], .dock .dock-you[aria-current="true"] { background: var(--ink); color: var(--paper); }
.dock .dock-you.is-tried::after { display: none; }
.dock .dock-you .dot { width: 8px; height: 8px; background: var(--paper); }
.dock .dock-you.wiggle { animation: wiggle 700ms var(--ease-out) 1; }
@keyframes wiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-4deg) scale(1.06); } 45% { transform: rotate(3deg) scale(1.06); } 70% { transform: rotate(-2deg); } }

@media (max-width: 700px) {
  :root { --head: 56px; --dock-h: 64px; }
  .site-head .btn-sm { padding: 0 12px; }
  .dock {
    left: 0; right: 0; bottom: 0; transform: none; max-width: none; border-width: var(--rule-w) 0 0; box-shadow: none;
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.4fr); gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); transition: transform 300ms var(--ease-out);
  }
  .dock > * { padding: 10px 2px; font-size: 0.75rem; white-space: normal; line-height: 1.1; text-align: center; min-height: 44px; }
  .dock .long { display: none; } .dock .short { display: inline; }
  .dock .dock-you { gap: 5px; padding: 6px; }
  .dock .dock-you .dot { display: none; }
}

/* ---------- moving between pages: the dock holds still, the rest crossfades ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 240ms; }
::view-transition-group(held) { animation-duration: 420ms; animation-timing-function: var(--ease-out); }

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