:root {
  --bg: #181914;
  --surface: #202119;
  --line: #2e3029;
  --ink: #f2f1ec;
  --muted: #9a9b8e;
  --amber: #f0b429;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 "Schibsted Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
::selection { background: var(--amber); color: var(--bg); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }

/* image placeholder until real photos are added */
.ph { position: relative; overflow: hidden; background: var(--surface); }
.ph::before {
  content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; opacity: .6;
}
.ph img { position: relative; width: 100%; height: 100%; object-fit: cover; }

/* ---------- header ---------- */
.top {
  max-width: 1040px; margin: 0 auto; padding: 28px 24px;
  display: flex; justify-content: space-between; align-items: center; font-size: 15px;
}
.logo { font-weight: 600; }
.top nav { display: flex; gap: 24px; color: var(--muted); }
.top nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  max-width: 1040px; margin: 0 auto; padding: 48px 24px 120px;
  min-height: calc(100svh - 90px);
  display: grid; grid-template-columns: 1fr 340px; gap: 64px; align-items: center;
}
.hero h1 { font-size: clamp(40px, 6vw, 60px); font-weight: 600; line-height: 1.05; letter-spacing: -.025em; }

/* two stacked versions of the same block; only the active profile shows */
.swap { display: grid; }
.swap > * { grid-area: 1 / 1; transition: opacity .35s var(--ease), transform .35s var(--ease); }
.hero[data-profile="0"] [data-for="1"],
.hero[data-profile="1"] [data-for="0"] { opacity: 0; transform: translateY(6px); visibility: hidden; transition: opacity .2s, transform .2s, visibility 0s .2s; }

.tagline { color: var(--muted); font-size: 20px; margin: 14px 0 40px; max-width: 30ch; }

.contacts { align-self: start; max-width: 420px; }
.contacts div, .facts div {
  display: grid; grid-template-columns: 136px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line);
}
.contacts div:last-child, .facts div:last-child { border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dt { display: flex; align-items: center; gap: 10px; }
.ic { width: 18px; height: 18px; flex: none; color: var(--c); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }
.contacts a, .copy { border-bottom: 1px solid transparent; transition: border-color .2s, color .2s; }
.contacts a:hover, .copy:hover { color: var(--amber); border-color: currentColor; }
.copy::after { content: "copy"; margin-left: 10px; font-size: 13px; color: var(--muted); }

/* photo stack */
.profile { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.stack {
  position: relative; width: 100%; max-width: 300px; aspect-ratio: 4 / 5;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; border-radius: 14px;
}
.stack:active { cursor: grabbing; }
.card {
  position: absolute; inset: 0; border-radius: 14px; border: 1px solid var(--line);
  transition: transform .5s var(--ease), filter .5s var(--ease);
  box-shadow: 0 20px 40px -20px #000a;
}
.card.front { z-index: 2; transform: none; }
.card.back { z-index: 1; transform: translate(22px, -14px) rotate(6deg) scale(.94); filter: brightness(.7); border-color: #4a4c42; }
.card.dragging { transition: none; }
.load .card { animation: deal .8s var(--ease) both; }
.load .card.back { animation-delay: .15s; }
@keyframes deal { from { transform: translateY(40px) rotate(-4deg); opacity: 0; } }

.toggle { display: flex; padding: 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.toggle button { padding: 7px 18px; border-radius: 99px; font-size: 15px; color: var(--muted); transition: color .2s, background .2s; }
.toggle button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.toggle button[aria-selected="true"]::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); margin-right: 8px; vertical-align: 1px;
}
.hint { font-size: 14px; color: var(--muted); }

/* ---------- sections ---------- */
.section { max-width: 1040px; margin: 0 auto; padding: 0 24px 140px; }
.section h2 { font-size: 30px; font-weight: 600; letter-spacing: -.015em; }
.sub { color: var(--muted); margin-top: 4px; }

.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; margin-top: 28px; }
.lede { font-size: 24px; line-height: 1.45; max-width: 34ch; }
.facts div { grid-template-columns: 120px 1fr; }

/* trips: horizontal strip */
.head { display: flex; justify-content: space-between; align-items: end; }
.arrows { display: flex; gap: 8px; }
.arrows button {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center;
  transition: border-color .2s;
}
.arrows button:hover { border-color: var(--ink); }
.arrows svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.strip {
  display: flex; gap: 16px; margin-top: 28px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding-bottom: 12px;
}
.trip { flex: 0 0 auto; width: 260px; scroll-snap-align: start; cursor: zoom-in; }
.trip.wide { width: 460px; }
.trip .ph { height: 340px; border-radius: 8px; }
.trip img { transition: transform .6s var(--ease); }
.trip:hover img { transform: scale(1.04); }
.trip figcaption { display: flex; justify-content: space-between; padding-top: 10px; font-size: 15px; }
.trip small { color: var(--muted); font-size: 15px; }

/* projects: list */
.repos { margin-top: 28px; border-bottom: 1px solid var(--line); }
.repo {
  display: grid; grid-template-columns: 220px 1fr 110px 60px; gap: 24px; align-items: baseline;
  padding: 18px 12px; margin: 0 -12px; border-top: 1px solid var(--line); border-radius: 6px;
  transition: background .2s;
}
.repo:hover { background: var(--surface); }
.repo:hover .name { color: var(--amber); }
.name { font-weight: 500; transition: color .2s; overflow-wrap: anywhere; }
.desc, .lang, .stars, .loading { color: var(--muted); font-size: 15px; }
.stars { text-align: right; }
.loading { padding: 18px 0; border-top: 1px solid var(--line); }
.more { display: inline-block; margin-top: 24px; color: var(--muted); border-bottom: 1px solid var(--line); }
.more:hover { color: var(--ink); border-color: var(--ink); }

.foot { width: min(992px, 100% - 48px); margin: 0 auto; padding: 32px 0 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* lightbox + toast */
.lightbox { position: fixed; inset: 0; z-index: 30; background: #000e; display: grid; place-content: center; gap: 12px; padding: 16px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 84vh; border-radius: 8px; }
.lightbox p { color: var(--muted); text-align: center; }
.toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 40; padding: 10px 18px; border-radius: 99px;
  background: var(--ink); color: var(--bg); font-size: 15px; pointer-events: none;
  white-space: nowrap; opacity: 0; visibility: hidden;
  transform: translate(-50%, 90px); transition: transform .35s var(--ease), opacity .35s, visibility 0s .35s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .35s var(--ease), opacity .35s; }

/* ---------- locked page (no key) ---------- */
.locked {
  max-width: 1040px; min-height: 100svh; margin: 0 auto; padding: 48px 24px;
  display: flex; flex-direction: column; justify-content: center;
}
.locked h1 { font-size: clamp(36px, 6vw, 60px); font-weight: 600; line-height: 1.05; letter-spacing: -.025em; }
.locked .tagline { margin-bottom: 32px; }
.locked .note { max-width: 34ch; padding-top: 16px; border-top: 1px solid var(--line); }
.nfc { width: 120px; margin-bottom: 40px; }
.nfc svg { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; overflow: visible; }
.nfc path { stroke: var(--amber); animation: wave 2.4s ease-in-out infinite; }
.nfc .w2 { animation-delay: .2s; }
.nfc .w3 { animation-delay: .4s; }
@keyframes wave { 0%, 60%, 100% { opacity: .2; } 20% { opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 8px; min-height: 0; }
  .profile { order: -1; }
  .stack { max-width: 220px; }
  .about { grid-template-columns: 1fr; gap: 32px; }
  .repo { grid-template-columns: 1fr auto; gap: 4px 16px; }
  .desc { grid-column: 1 / -1; grid-row: 2; }
  .lang { display: none; }
  .section { padding-bottom: 100px; }
}
@media (max-width: 480px) {
  .top { padding: 20px 16px; }
  .top nav { gap: 16px; }
  .foot { width: calc(100% - 32px); }
  .hero, .section { padding-left: 16px; padding-right: 16px; }
  .contacts div { grid-template-columns: 124px 1fr; }
  .trip { width: 220px; }
  .trip.wide { width: 300px; }
  .trip .ph { height: 280px; }
  .lede { font-size: 21px; }
}

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