/* Reference: a Nordic winter night. Painted landscapes at the top and bottom (night, then first light),
   a snow-light page in between. Each project shows the old routine ("Før") on one side of the text
   and the result ("Nå") on the other. No JavaScript, no third-party requests. */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-display: block;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-wght-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: "Albert Sans";
  src: url("fonts/albert-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: block;
}

:root {
  --night: #0b1830;
  --night-2: #14254a;
  --snow: #f1f4f8;
  --ink: #101b33;
  --dim: #55607a;
  --brass: #c79a3c;
  --brass-deep: #7d5a0e;
  --flame: #ffd98c;
  --card: #fbfcfe;
  --line: #d3dae6;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --text: "Albert Sans", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--snow); color: var(--ink); font: 400 1.125rem/1.6 var(--text); overflow-wrap: break-word; }
h1, h2, h3, h4, p, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: var(--brass-deep); font-weight: 700; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--brass-deep); outline-offset: 3px; }
.w {
  max-width: 84rem; margin: 0 auto;
  padding-left: max(clamp(16px, 4vw, 64px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 4vw, 64px), env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 5; background: var(--flame); color: var(--ink); padding: 0.6rem 1rem; }
.skip:focus { top: 0.5rem; }
.skip:focus-visible { outline-color: var(--flame); }
/* Text for screen readers only. */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Painted landscape, anchored to the bottom edge and sized by width so the mountains keep their
   proportions on every screen. The top of the picture fades into the flat sky colour, so no seam shows. */
.scene { position: relative; isolation: isolate; overflow: hidden; color: var(--snow); background-color: var(--sky); --iw: max(100vw, 60rem); }
.scene::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; z-index: -1;
  height: calc(var(--iw) * var(--ratio));
  background: var(--img) var(--px) 100% / var(--iw) auto no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%);
  mask-image: linear-gradient(to bottom, transparent, #000 18%);
}
.scene a { color: var(--snow); }
.scene :focus-visible { outline-color: var(--flame); }
.hero { --sky: #0a162d; --img: url("img/topp.webp"); --ratio: 0.4286; --px: 72%; }
.contact { --sky: #0b1931; --img: url("img/bunn.webp"); --ratio: 0.3333; --px: 78%; }

/* Hero: the headline is sized by both width and height, so the whole sentence and the lede
   fit the first screen on a wide, low laptop window. The bottom padding keeps text off the hills. */
.hero .w { padding-block: 1.5rem calc(var(--iw) * 0.4286 * 0.32 + 1.5rem); }
.name { font: 700 1.0625rem/1 var(--text); letter-spacing: 0.02em; }
h1 {
  font: 600 clamp(3.4rem, 11vw, 6.5rem)/0.95 var(--display);
  letter-spacing: -0.02em; max-width: 10.5ch;
  margin-top: clamp(1.75rem, 6svh, 5rem);
}
.lede { max-width: 31rem; font-size: 1.25rem; line-height: 1.45; margin-top: 1.5rem; }

h2 { font: 600 clamp(2rem, 3.6vw, 2.75rem)/1.05 var(--display); }
/* The reader's own routine comes before the projects. */
.know { padding-block: clamp(3rem, 7vw, 5.5rem) 0; }
.know p { max-width: 38rem; margin-top: 1.1rem; font-size: 1.125rem; }
.works { padding-block: clamp(3rem, 7vw, 5.5rem) 0; }
.also { max-width: 38rem; padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }
/* The project rows change layout by the room they actually have, measured in text size.
   Enlarged text therefore falls back to fewer columns instead of squeezing the middle one. */
.works .w { container-type: inline-size; }
.work {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem 2rem;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}
.work + .work { border-top: 1px solid var(--line); }
.work h3 { font: 600 clamp(3.25rem, 7.5vw, 5.75rem)/0.9 var(--display); letter-spacing: -0.02em; }
.what { font: 500 1.75rem/1.2 var(--display); margin-top: 0.6rem; color: var(--brass-deep); }
.plain { margin-top: 1.1rem; max-width: 34rem; }
details { margin-top: 1.25rem; max-width: 34rem; }
summary { cursor: pointer; font-weight: 700; color: var(--brass-deep); padding-block: 0.25rem; }
details p { margin-top: 0.6rem; font: 400 0.875rem/1.7 var(--mono); color: var(--dim); }
.more { margin-top: 1rem; }
.more a { display: inline-block; padding-block: 0.2rem; }

/* Before and now, one on each side of the text and equally tall.
   Before: a plain, unlit outline on the snow. Now: a night box with a straight brass frame and a lit card. */
.lbl { font: 600 1.375rem/1 var(--display); letter-spacing: 0.01em; margin-bottom: 0.7rem; }
.was, .is { display: grid; align-content: center; min-height: 19rem; }
.was { border: 1px solid #aab4c6; padding: 2rem 1.75rem; }
.was .lbl { color: var(--dim); }
.was ol { font: 400 0.875rem/1.9 var(--mono); color: var(--dim); text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: #aab4c6; }
.is {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 2.75rem 2.25rem; justify-items: center;
  color: var(--snow); background-color: var(--night);
  background-image:
    radial-gradient(1.5px 1.5px at 14% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 76% 14%, #dfe8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 78%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 88%, #dfe8ff 50%, transparent 51%),
    radial-gradient(120% 90% at 70% 110%, var(--night-2), transparent 70%);
}
.is::before { content: ""; position: absolute; inset: 0.9rem; border: 1px solid var(--brass); z-index: -1; }
.is::after {
  content: ""; position: absolute; inset: calc(0.9rem - 5px); z-index: -1;
  background:
    radial-gradient(circle 3px at 5px 5px, var(--snow) 96%, transparent),
    radial-gradient(circle 5px at calc(100% - 5px) 5px, var(--flame) 96%, transparent),
    radial-gradient(circle 3px at 5px calc(100% - 5px), var(--snow) 96%, transparent),
    radial-gradient(circle 3px at calc(100% - 5px) calc(100% - 5px), var(--snow) 96%, transparent);
}
.is > div { width: min(20rem, 100%); }
.is .lbl { color: var(--flame); }
.panel {
  background: var(--card); color: var(--ink);
  padding: 1.2rem 1.3rem 1.35rem;
  box-shadow: 0 0 4rem 0.5rem rgb(255 200 110 / 0.22);
}
/* A real screenshot in the night box takes the place of the example card. */
.shot { display: grid; justify-items: center; }
.phone {
  width: min(13.5rem, 100%); padding: 7px; border-radius: 30px;
  background: linear-gradient(138deg, #2b2f3a 0%, #171a22 62%, #0b0d12 100%);
  box-shadow: 0 0 0 1px rgb(241 244 248 / 0.14), 0 0 4rem 0.5rem rgb(255 200 110 / 0.2);
}
.phone-screen {
  position: relative; overflow: hidden; border-radius: 23px; background: #050505;
}
.phone-screen::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.6), inset 0 0 12px rgb(0 0 0 / 0.35);
}
.phone-screen img { display: block; width: 100%; height: auto; }
.shot figcaption { font: 400 0.75rem/1.4 var(--mono); color: var(--snow); opacity: 0.8; margin-top: 1rem; text-align: center; }
.cap { font: 700 0.6875rem/1.4 var(--mono); color: var(--dim); margin-bottom: 0.8rem; }
.row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px solid var(--line); font-size: 1rem; }
.row b { font: 700 0.9375rem/1.7 var(--mono); }
.row.sum { border-top: 1px solid var(--ink); font: 600 1.625rem/1.2 var(--display); }
.row.sum b { font: 700 1.125rem/1.7 var(--mono); color: var(--brass-deep); }
.said { font: 400 0.875rem/1.5 var(--mono); padding: 0.5rem 0 0.35rem; color: var(--dim); }
.said::before { content: "› "; content: "› " / ""; color: var(--brass-deep); font-weight: 700; }
.set { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.75rem; padding: 0.5rem 0.7rem; background: var(--snow); font-weight: 700; margin-bottom: 0.4rem; }
.set span:first-child { flex: 1 1 4.5rem; }
.set span + span { font: 400 0.875rem/1.9 var(--mono); text-align: right; min-width: 3rem; }
.ask { font: 600 1.5rem/1.2 var(--display); }
.btns { display: flex; gap: 0.6rem; margin-top: 1rem; }
.btns span { flex: 1; text-align: center; padding: 0.6rem; border: 1px solid var(--ink); font-weight: 700; }
.btns span:first-child { background: var(--night); color: var(--snow); }
.small { margin-top: 0.8rem; font-size: 0.875rem; color: var(--dim); }

.rules { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem 3rem; margin-top: 2.25rem; }
.rules li { border-top: 2px solid var(--ink); padding-top: 1rem; }
.rules h3 { font: 600 2.125rem/1.02 var(--display); }
.rules p { margin-top: 0.6rem; }
.band { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }

/* The page about the agent system: a day as a timeline, and each rule beside the incident behind it. */
.name a { color: inherit; text-decoration: none; display: inline-block; padding-block: 0.5rem; }
.name a:hover { text-decoration: underline; }
h1.long { max-width: 14ch; }
.intro { max-width: 38rem; margin-top: 1.1rem; }
.day-sec { padding-block: clamp(3rem, 7vw, 5.5rem); }
.day { margin-top: 2rem; max-width: 52rem; }
.day li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.25rem 2rem; padding-block: 1.1rem; border-top: 1px solid var(--line); }
.at { font: 700 0.9375rem/1.9 var(--mono); color: var(--brass-deep); }
.gates { margin-top: 2.25rem; }
.gates li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem 3rem; padding-block: 1.5rem; border-top: 2px solid var(--ink); }
.gates h3 { font: 600 1.875rem/1.05 var(--display); }
.gates p { max-width: 38rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.75rem 3rem; margin-top: 2rem; }
.facts dt { font: 700 1.75rem/1.2 var(--mono); }
.facts dd { margin: 0.2rem 0 0; color: var(--dim); }
.back { margin-top: 3rem; }
@media (min-width: 48rem) {
  .day li { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .gates li { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
}

/* Contact: text and portrait on the night sky, with the second landscape as a strip underneath. */
.contact.band { border-top: 0; padding-bottom: calc(var(--iw) * 0.3333 * 0.6 + 1.5rem); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; }
.contact h2 + p { font: 600 clamp(2.5rem, 6vw, 4.75rem)/1 var(--display); max-width: 19ch; margin-top: 1.25rem; }
.contact ul { display: flex; flex-wrap: wrap; gap: 0.75rem 2.5rem; margin-top: 2.25rem; font-weight: 700; font-size: 1.25rem; }
.contact li span { display: block; font: 700 0.75rem/1.6 var(--mono); color: var(--flame); }
.contact li a { display: inline-block; padding-block: 0.15rem; }
/* Who I am: the text with the portrait beside it, on the snow just above the contact scene. */
.about { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; }
.portrait {
  height: 17rem; aspect-ratio: 4 / 5; max-width: 100%; margin: 0.5rem 0.5rem 0;
  background: var(--night-2); outline: 1px solid var(--brass); outline-offset: 0.5rem;
  overflow: hidden;
}
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }

@container (min-width: 38rem) {
  .work { grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); align-items: stretch; }
  .work > .txt { grid-column: 1 / -1; align-self: center; }
}
@media (min-width: 60rem) {
  h1 { font-size: clamp(3.4rem, min(1.2rem + 4.9vw, 13.5svh), 8.5rem); max-width: none; }
  h1 span { display: block; }
  .hero .w { padding-bottom: calc(var(--iw) * 0.4286 * 0.26 + 1rem); }
  .about { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); column-gap: 4rem; align-items: center; }
  .portrait { height: 22rem; margin: 0; justify-self: center; }
  .rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container (min-width: 68rem) {
  .work { grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) minmax(0, 24rem); column-gap: 3.5rem; }
  .work > .txt { grid-column: auto; }
  .work > .was { order: -1; }
}
/* At 400 % zoom the page is 320 px wide: give the night box content more room. */
@media (max-width: 24rem) {
  .is { padding: 2.5rem 1.6rem; }
}
@media (max-width: 60rem) {
  .hero::before {
    -webkit-mask-image: linear-gradient(to bottom, transparent 32%, #000 60%);
    mask-image: linear-gradient(to bottom, transparent 32%, #000 60%);
  }
  .hero { --px: 86%; }
  .contact { --px: 96%; }
}

/* Windows high contrast: drop the painted landscapes so text sits on the plain system background. */
@media (forced-colors: active) {
  .scene::before, .is::after { display: none; }
  .is { background-image: none; border: 1px solid; }
  .panel, .skip, .set { border: 1px solid; }
  .hero .w { padding-bottom: 3rem; }
  .contact.band { padding-bottom: 3rem; }
}
