/* Contact-sheet portfolio. Stone and blueprint, Schibsted Grotesk. */

:root {
  --bg: #dfdedb;
  --surface: #d3d2ce;
  --ink: #26251e;
  --muted: #5f5d55;
  --accent: #2456d6;
  --accent-deep: #1b44ad;
  --accent-ink: #ffffff;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(3rem, 7vw, 6.5rem);

  --m: clamp(16px, 1.4vw, 20px);   /* the one pair of outer margins */
  --g: 12px;                        /* sheet gap */
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  font-size: var(--step-body);
  line-height: 1.45;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; transition: color .2s; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.small { font-size: var(--step-small); }
.soft { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 var(--step-body)/1 inherit; font-family: inherit; letter-spacing: -0.01em;
  text-decoration: none; border: 0; border-radius: 0; cursor: pointer;
  transition: background-color .2s, transform .15s var(--ease);
}
.btn:hover { background: var(--accent-deep); color: var(--accent-ink); }
.btn:active { transform: scale(.97); }

.section-title, .rail-title {
  font-size: var(--step-head); font-weight: 800; letter-spacing: -0.05em; line-height: 0.9;
}

/* ---------- Hero: the sheet ---------- */
.hero {
  --n: 6;
  container-type: inline-size;
  position: relative;
  height: max(100svh, 720px);
  overflow: hidden;
}
.sheet {
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: var(--g);
  padding: 0 var(--m);
  height: 100%;
}
.col { display: flex; flex-direction: column; gap: var(--g); margin-top: var(--off); will-change: transform; }
.col-wide { grid-column: span 2; }
.frame { display: block; overflow: hidden; background: var(--surface); }
/* Each frame is a way into its project */
@media (hover: hover) {
  .hero .frame:hover { outline: 3px solid var(--accent); outline-offset: -3px; }
  .hero .frame:hover .tag { background: var(--accent); color: var(--accent-ink); }
}
.frame img { width: 100%; height: auto; }
.tag {
  height: 28px; padding: 0 10px;
  display: flex; align-items: center;
  font-size: var(--step-small); font-weight: 600; white-space: nowrap;
}
/* The bottom frame of each column is cropped by the screen edge, so it carries no tag */
@media (min-width: 720px) { .col > .frame:last-child .tag { display: none; } }
.t1 { background: var(--ink); color: var(--bg); }
.t2 { background: var(--accent); color: var(--accent-ink); }
.t3 { background: var(--surface); color: var(--ink); }
.t4 { background: var(--muted); color: #fff; }

.cell {
  --colw: calc((100cqw - 2 * var(--m) - (var(--n) - 1) * var(--g)) / var(--n));
  position: absolute;
  top: clamp(20px, 5svh, 56px);
  bottom: clamp(20px, 5svh, 56px);
  left: calc(var(--m) + 2 * (var(--colw) + var(--g)));
  width: calc(2 * var(--colw) + var(--g));
  background: var(--ink);
  color: var(--bg);
  display: flex; flex-direction: column;
}
/* The portrait takes whatever height the name and links leave */
.cell-photo { flex: 1 1 0; min-height: 160px; width: calc(100% - 24px); margin: 12px 12px 0; border-radius: 14px; object-fit: cover; object-position: 45% 25%; }
.cell-text { flex: none; padding: 28px; display: flex; flex-direction: column; align-items: flex-start; }
.wordmark {
  font-size: var(--step-display); font-weight: 800; letter-spacing: -0.05em; line-height: 0.88;
  white-space: nowrap;
}
.wordmark span { display: block; }
.cell-line { margin-top: 24px; font-size: var(--step-lead); line-height: 1.2; letter-spacing: -0.02em; max-width: 24ch; }
.cell-facts { margin-top: 12px; font-size: var(--step-small); color: #bdbbb3; }
.cell .btn { margin-top: 28px; }
.cell-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; font-size: var(--step-small); font-weight: 600; }
.cell-links a:hover { color: #9db6ff; }

@media (min-width: 720px) and (max-height: 820px) {
  .cell .wordmark { font-size: clamp(3rem, 5.5vw, 4.5rem); }
  .cell-line { margin-top: 16px; font-size: 1.1875rem; }
  .cell .btn { margin-top: 20px; }
}

@media (max-width: 1100px) {
  .hero { --n: 4; }
  .col:nth-child(4), .col:nth-child(5) { display: none; }
  /* Keep the portrait card in the middle two of four columns */
  .col-wide { grid-column: 2 / span 2; grid-row: 1; }
  .col:nth-child(2) { grid-column: 4; grid-row: 1; }
  .cell { left: calc(var(--m) + var(--colw) + var(--g)); }
}

@media (max-width: 719px) {
  .hero { height: auto; container-type: normal; display: flex; flex-direction: column-reverse; }
  .cell {
    position: static; width: auto;
    margin: var(--m) var(--m) 8px;
  }
  .cell-photo { flex: none; height: auto; aspect-ratio: 5 / 4; }
  .cell-text { padding: 24px 20px; }
  .wordmark { font-size: clamp(3rem, 15vw, 4rem); }
  .cell-line { font-size: 1.1875rem; }
  .cell .btn { margin-top: 24px; align-self: stretch; }
  .sheet {
    display: block; columns: 2; column-gap: 8px;
    padding: 0 var(--m); height: auto;
  }
  .col { display: contents; }
  .col:nth-child(n+3) { display: none !important; }
  .frame { break-inside: avoid; margin-bottom: 8px; }
}

/* ---------- Work: one strip per project ---------- */
.work {
  display: grid;
  grid-template-columns: clamp(190px, 15vw, 240px) 1fr;
  gap: 48px;
  padding: 160px var(--m) 0;
}
.rail { align-self: stretch; }
.rail-pin { position: sticky; top: 32px; }
.sorts { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 28px; }
.sort {
  font: inherit; font-size: var(--step-body); background: none; border: 0; padding: 6px 0;
  color: var(--muted); cursor: pointer; text-align: left;
  display: inline-flex; align-items: center; gap: 10px;
  transition: color .2s, transform .2s var(--ease);
}
.sort::before { content: ""; width: 10px; height: 10px; background: transparent; transition: background-color .2s, transform .3s var(--ease); transform: scale(.4); }
.sort:hover { color: var(--ink); transform: translateX(3px); }
.sort[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.sort[aria-pressed="true"]::before { background: var(--accent); transform: scale(1); }
.sort-note { margin-top: 20px; font-size: var(--step-small); color: var(--muted); max-width: 22ch; }

.projects { display: flex; flex-direction: column; gap: 88px; min-width: 0; }
.project { min-width: 0; scroll-margin-top: 32px; }
.project:target h3 { color: var(--accent); }
.strip {
  display: flex; gap: 8px; height: 220px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  transition: opacity .3s;
}
.strip::-webkit-scrollbar { display: none; }
.strip > * { height: 100%; width: auto; flex: none; scroll-snap-align: start; background: var(--surface); }
.small { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 32px; }
.small .strip { grid-row: 1 / 3; height: 200px; }
.small .caption { margin-top: 0; }
.small .body { grid-template-columns: 1fr; }
.small .stack, .small .links { grid-column: 1; }
.card-frame {
  width: 300px; padding: 16px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--ink) !important; color: var(--bg);
}
.card-frame span:first-child { font-size: var(--step-lead); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.card-frame span:last-child { font-size: var(--step-small); color: #bdbbb3; }

@media (hover: hover) {
  .projects:hover .project:not(:hover) .strip { opacity: .4; }
  .strip > img { transition: transform .5s var(--ease); }
}

.caption {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 16px;
  margin-top: 14px;
}
.caption h3 { font-size: var(--step-lead); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kind { font-size: var(--step-small); color: var(--muted); }
.year { font-size: var(--step-small); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 48px;
  margin-top: 16px;
}
.lede { display: flex; flex-direction: column; gap: 10px; max-width: 58ch; }
.why { font-weight: 600; transition: opacity .25s; }
.why.swap { opacity: 0; }
.points { display: flex; flex-direction: column; gap: 8px; max-width: 58ch; }
.points li { padding-left: 18px; position: relative; }
.points li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; background: var(--accent); }
.stack { font-size: var(--step-small); color: var(--muted); grid-column: 2; }
.links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-weight: 600; grid-column: 2; }

@media (max-width: 900px) {
  .work { grid-template-columns: 1fr; gap: 28px; padding-top: 160px; }
  .rail-pin { position: static; }
  .sorts { flex-direction: row; flex-wrap: wrap; gap: 4px 18px; margin-top: 16px; }
  .sort { min-height: 44px; }
  .sort-note { max-width: none; margin-top: 8px; }
  .projects { gap: 64px; }
  .strip { flex-wrap: wrap; height: auto; overflow: visible; }
  .strip > * { height: 170px; }
  .small { display: block; }
  .small .strip { height: auto; }
  .small .caption { margin-top: 14px; }
  .body, .small .body { grid-template-columns: 1fr; }
  .stack, .links { grid-column: 1; }
  .kind { display: none; }
  .caption { grid-template-columns: 1fr auto; }
}
@media (max-width: 600px) {
  .strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
  .strip > * { grid-column: span 2; width: 100%; height: auto; }
  .strip > .w { grid-column: span 3; }
  .strip > .card-frame { grid-column: span 6; height: 120px; }
}

/* ---------- About ---------- */
.about, .lists, .contact {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 24px;
  padding: 0 var(--m);
}
.about { padding-top: 200px; }
.facts { grid-column: 1 / 3; display: flex; flex-direction: column; gap: 18px; font-size: var(--step-small); padding-top: 90px; }
.facts dt { color: var(--muted); }
.facts dd { font-weight: 600; }
.about-text { grid-column: 3 / 9; }
.about-photo { grid-column: 9 / 13; overflow: hidden; }
.about-photo img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; }
.about .section-title { margin-bottom: 32px; }
.statement { font-size: var(--step-lead); line-height: 1.25; letter-spacing: -0.02em; max-width: 46ch; }
.statement + .statement { margin-top: 1.2em; }
.statement.soft a { color: var(--ink); }

/* ---------- Experience and toolkit ---------- */
.lists { padding-top: 200px; }
.list:first-child { grid-column: 3 / 8; }
.list:last-child { grid-column: 8 / 13; }
.list .section-title { margin-bottom: 28px; }
.rows li {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 0;
}
.dot, .logo { flex: none; width: 16px; height: 16px; border-radius: 50%; margin-top: 0.2em; background: var(--c, var(--muted)); object-fit: cover; }
.rows .name { flex: 1; font-weight: 600; }
.rows .name small { display: block; font-size: var(--step-small); font-weight: 400; color: var(--muted); margin-top: 2px; }
.rows .val { font-size: var(--step-small); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; padding-top: 0.2em; }
.group { margin-top: 36px; margin-bottom: 4px; color: var(--muted); }
.group.first { margin-top: 0; }

/* ---------- Contact ---------- */
.contact { padding-top: 200px; padding-bottom: 160px; align-items: start; }
.contact-say { grid-column: 3 / 8; display: flex; flex-direction: column; gap: 20px; }
.contact-direct { display: flex; flex-direction: column; gap: 6px; font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.02em; }
.form { grid-column: 8 / 13; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 90px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: var(--step-small); font-weight: 600; }
.form .wide { grid-column: 1 / -1; }
.form input, .form textarea {
  font: inherit; font-size: var(--step-body); color: var(--ink);
  background: var(--surface); border: 0; border-radius: 0; padding: 12px 14px; min-height: 48px;
  transition: background-color .2s;
}
.form input:hover, .form textarea:hover { background: #cac9c4; }
.form textarea { resize: vertical; }
.form .btn { justify-self: start; }
.form-status { grid-column: 1 / -1; font-size: var(--step-small); }
.honey { position: absolute; left: -9999px; }

/* ---------- Footer of tiles ---------- */
.footer {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px;
  padding: 0 var(--m) var(--m);
}
.tile { background: var(--surface); padding: 20px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between; }
.t-state { grid-column: 1 / 5; }
.t-state p:first-child { font-size: var(--step-lead); line-height: 1.2; letter-spacing: -0.02em; max-width: 22ch; }
.t-nav { grid-column: 5 / 8; justify-content: flex-start; gap: 4px; }
.t-nav a { text-decoration: none; font-weight: 600; }
.t-time { grid-column: 8 / 10; }
.clock { font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.02em; }
.t-mail { grid-column: 10 / 13; }
.t-mail .mail { font-size: var(--step-body); font-weight: 600; overflow-wrap: anywhere; }
.t-mark { grid-column: 1 / 9; min-height: 320px; background: var(--ink); color: var(--bg); justify-content: center; align-items: center; overflow: hidden; }
.t-mark p { font-size: var(--step-display); font-weight: 800; letter-spacing: -0.05em; line-height: .88; white-space: nowrap; }
.t-go { grid-column: 9 / 13; min-height: 320px; background: var(--accent); color: var(--accent-ink); text-decoration: none; transition: background-color .25s; }
.t-go span { font-size: var(--step-lead); font-weight: 800; letter-spacing: -0.03em; }
.t-go svg { align-self: flex-end; transition: transform .35s var(--ease); }
.t-go:hover { background: var(--accent-deep); color: var(--accent-ink); }
.t-go:hover svg { transform: translate(6px, -6px); }

@media (max-width: 900px) {
  .about, .lists, .contact { grid-template-columns: 1fr; }
  .about { padding-top: 128px; }
  .about-text, .about-photo, .facts, .list:first-child, .list:last-child, .contact-say, .form { grid-column: 1; }
  .facts { order: 2; flex-direction: row; flex-wrap: wrap; gap: 16px 24px; padding-top: 28px; }
  .statement { font-size: 1.3125rem; }
  .about-photo { grid-column: 1; order: -1; margin-bottom: 28px; max-width: 420px; }
  .lists { padding-top: 128px; row-gap: 64px; }
  .rows li { min-height: 44px; }
  .contact { padding-top: 128px; padding-bottom: 96px; }
  .form { padding-top: 32px; }
  .footer { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tile { min-height: 150px; }
  .t-mark { grid-column: 1 / -1; order: -2; min-height: 160px; }
  .t-mark p { font-size: 14vw; }
  .t-go { grid-column: 1 / -1; order: -1; min-height: 140px; }
  .t-nav, .t-mail { grid-column: span 1; }
  .t-time, .t-state { grid-column: span 1; }
}
@media (max-width: 480px) {
  .form { grid-template-columns: 1fr; }
  .t-state, .t-time { grid-column: 1 / -1; }
}

/* ---------- Motion ---------- */
/* Hero frames open like a shutter, column by column */
.js .hero .frame img, .js .hero .cell-photo { clip-path: inset(100% 0 0 0); transform: scale(1.12); transform-origin: 50% 100%; }
.js .hero.is-in .frame img, .js .hero.is-in .cell-photo {
  clip-path: inset(0 0 0 0); transform: none;
  transition: clip-path 1.1s var(--ease) var(--d, 0s), transform 1.4s var(--ease) var(--d, 0s);
}
.js .hero .cell-text > * { opacity: 0; transform: translateY(18px); }
.js .hero.is-in .cell-text > * { opacity: 1; transform: none; transition: opacity .7s var(--ease) var(--d, 0s), transform .9s var(--ease) var(--d, 0s); }

/* Parts of each section arrive in reading order */
.js [data-reveal] { opacity: 0; transform: translateY(24px); }
.js [data-reveal].in { opacity: 1; transform: none; transition: opacity .8s var(--ease) var(--d, 0s), transform 1s var(--ease) var(--d, 0s); }
/* Strips stay visible; their frames settle from a slight scale as they arrive */
.js .strip[data-reveal] { opacity: 1; transform: none; }
.js .strip[data-reveal] > * { transform: scale(1.04); transform-origin: 50% 100%; transition: transform 1.2s var(--ease); }
.js .strip[data-reveal].in > * { transform: none; }

@media (hover: hover) {
  .strip > img:hover { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero .frame img, .js .hero .cell-photo, .js .hero .cell-text > *, .js [data-reveal], .js .strip[data-reveal] > * {
    clip-path: none !important; transform: none !important; opacity: 1 !important; transition: none !important;
  }
  .col { transform: none !important; }
}
