/* William Nilsson portfolio: shared system */

@font-face { font-family: "Switzer"; src: url("../fonts/switzer-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/switzer-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/switzer-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #131211;
  --stage: #1d1c1a;
  --stage-2: #262422;
  --fg: #efece6;
  --fg-2: #a39e95;
  --fg-3: #8f8a81;
  --line: #2c2a27;
  --accent: #efece6;
  --idr: #c8301a;
  --idr-deep: #b8240f;
  --idr-ink: #fff6f2;

  --font: "Switzer", "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: clamp(1.1875rem, 1.05rem + 0.45vw, 1.375rem);
  --step-3: clamp(1.5rem, 1.25rem + 0.9vw, 2rem);
  --step-4: clamp(2rem, 1.55rem + 1.8vw, 3rem);

  --gutter: clamp(16px, 2.6vw, 40px);
  --max: 1100px;
  --read: 62ch;
  --radius: 6px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.55), 0 6px 14px -6px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: #3a3733 var(--bg); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--idr);
}

::selection { background: var(--idr); color: var(--idr-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3a3733; border-radius: 10px; border: 2px solid var(--bg); }

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.08; letter-spacing: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd, figure { margin: 0; padding: 0; }
li { list-style: none; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-color: var(--fg-2); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 3px; }

.num { font-variant-numeric: tabular-nums; }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--fg-2); }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: var(--gutter); top: 12px; background: var(--fg); color: var(--bg); padding: 8px 12px; z-index: 50; }

/* Header */
.site-head { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.scroll-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; }
.scroll-progress span { display: block; height: 100%; background: var(--idr); transform-origin: left; transform: scaleX(0); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 76px; max-width: none; }
.site-name { font-weight: 400; text-decoration: none; font-size: var(--step-1); }
.site-nav { font-size: var(--step-1); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.3em; }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 36px); }
.site-nav a { text-decoration: none; color: var(--fg-2); transition: color 0.2s; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }
.clock { color: var(--fg-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) { .clock { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 0 20px;
  border-radius: 4px; border: 0;
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  background: var(--fg); color: var(--bg);
  transition: transform 0.25s var(--ease-out), background-color 0.2s;
}
.btn:hover { background: #fff; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; transition: transform 0.3s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }
.btn[target="_blank"]:hover svg { transform: translate(2px, -2px); }
.btn-red { background: var(--idr); color: var(--idr-ink); }
.btn-red:hover { background: #a92612; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: var(--step--1); }
.btn-quiet { background: var(--stage-2); color: var(--fg); }
.btn-quiet:hover { background: #312e2b; }

.arrow-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg-2); }
.arrow-link:hover { color: var(--fg); }
.arrow-link svg { width: 16px; height: 16px; }

/* Browser frame for product screens */
.frame { border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.frame-bar { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; background: #ecebe8; }
.frame-bar i { width: 9px; height: 9px; border-radius: 50%; background: #cfccc6; }
.frame-bar span { margin-left: 10px; font-size: 12px; color: #5c5852; }
.frame img { width: 100%; }

/* Phone frame */
.phone { border-radius: 34px; padding: 9px; background: #0c0c0b; box-shadow: var(--shadow); }
.phone-screen { border-radius: 26px; overflow: hidden; background: #fff; aspect-ratio: 430 / 900; }
.phone-screen img { width: 100%; }

/* Footer */
.site-foot { padding-block: 56px 40px; color: var(--fg-3); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Reveal: visible by default, enhanced when JS confirms motion is allowed */
.js-motion .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
.js-motion .reveal.in { opacity: 1; transform: none; }
