/* =========================================================================
   Andrej Olsen — site layout (Direction C, expanded)
   Wide left sidebar (horizontal stacked nav) · reading column · meta column
   ========================================================================= */

.site {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 300px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  position: relative;
}

/* Background art — a looping hero video, then the user's composition tiled
   beneath it (full width, repeating vertically, at reduced opacity). The
   sidebar and meta columns are opaque, so the art reads in the reading band. */
.bg-hero, .bg-sections {
  position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none;
}
.bg-hero {
  top: 0; height: 100vh; width: 100%;
  object-fit: cover; object-position: center top;
  opacity: .5;
}
.bg-sections {
  /* slight overlap so the image meets the video seamlessly */
  top: calc(100vh - 56px); bottom: 0;
  background-image: url('bg-sections-v2.webp');
  background-position: center top;
  background-size: 100% auto;
  background-repeat: repeat-y;
  opacity: .2; mix-blend-mode: multiply;
}
[data-theme='dark'] .bg-hero {
  filter: invert(1) hue-rotate(180deg);
  opacity: .36;
}
[data-theme='dark'] .bg-sections {
  filter: invert(1) hue-rotate(180deg);
  mix-blend-mode: screen; opacity: .2;
}

/* scroll progress hairline */
#scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--teal); transform-origin: left;
  transform: scaleX(0); z-index: 200; pointer-events: none;
}

/* ---------- Left sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid var(--line);
  padding: 40px 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  background: var(--surface);
}
/* top bar (id + burger) */
.sb-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sb-burger, .sb-close, .sb-panel-head, .sb-scrim { display: none; }

/* panel holds nav + meta + foot; foot pinned to bottom on the rail */
.sb-panel { display: flex; flex-direction: column; gap: 26px; flex: 1 1 auto; min-height: 0; }

.sb-id .sb-badge {
  width: 56px; height: 56px; flex: none;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.sb-id .sb-badge img { width: 100%; height: 100%; object-fit: contain; display: block; }
[data-theme='dark'] .sb-badge img { filter: invert(.92) hue-rotate(180deg); }
.sb-id { display: flex; flex-direction: column; align-items: center; text-align: center; }
.sb-logo { display: inline-flex; align-self: center; line-height: 0; text-decoration: none; }
.sb-logo img { width: 152px; max-width: 100%; height: auto; display: block; }
.sb-logo .sb-logo-dark { display: none; }
[data-theme='dark'] .sb-logo .sb-logo-light { display: none; }
[data-theme='dark'] .sb-logo .sb-logo-dark { display: block; }
.sb-logo-mark { display: none; }  /* compact mark only when the burger menu shows */
.sb-name { font-family: var(--font-serif); font-size: 19px; line-height: 1.1; letter-spacing: -0.01em; white-space: nowrap; }
.sb-role { font-size: 13px; color: var(--ink-2); margin-top: 16px; line-height: 1.45; }
.sb-role b { color: var(--teal-deep); font-weight: 500; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 7px;
  font-size: 15px; color: var(--ink-2);
  text-decoration: none; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.sb-link .sb-num { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .04em; transition: color .15s ease; }
.sb-link:hover { background: var(--teal-ghost); color: var(--ink); }
.sb-link.active { background: var(--teal-soft); color: var(--teal-deep); }
.sb-link.active .sb-num { color: var(--teal-deep); }

/* meta info folded into the rail (shown on tablet, hidden on wide where the
   right column carries it) */
.sb-extra { display: none; padding-top: 4px; border-top: 1px solid var(--line); }
.sb-extra .meta-list { display: flex; flex-direction: column; gap: 16px; }
.sb-extra .meta-block .mb-big { font-size: 14.5px; }

.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 16px; padding-top: 20px; }
.sb-legal { display: flex; gap: 16px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; }
.sb-legal a { color: var(--teal-deep); text-decoration: none; transition: color .15s; }
.sb-legal a:hover { color: var(--teal); }
.sb-status { display: inline-flex; gap: 9px; align-items: center; font-size: 13px; color: var(--ink-2); }
.sb-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--teal); }
.sb-dot.off { background: oklch(0.58 0.17 25); }
[data-theme='dark'] .sb-dot.off { background: oklch(0.66 0.16 25); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.seg button {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  padding: 6px 12px; border: 0; background: transparent; color: var(--ink-3);
  cursor: pointer; transition: background .15s, color .15s;
}
.seg button.on { background: var(--teal); color: #fff; }
.sb-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sb-loc { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Center reading column ---------- */
.reading { padding: 64px clamp(40px, 6vw, 88px) 96px; max-width: 760px; position: relative; z-index: 1; }
.section { scroll-margin-top: 40px; padding-top: 8px; }
.section + .section { margin-top: 84px; }

.eyebrow { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.eyebrow .ey-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--teal); }

.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; position: relative; }
.sec-head .sec-num { font-family: var(--font-mono); font-size: 12px; color: var(--teal); }
.sec-head h2 { font-family: var(--font-serif); font-size: var(--t-h2); letter-spacing: -0.02em; text-wrap: balance; }
.sec-head .sec-rule { flex: 1; height: 1px; background: var(--line); align-self: center; margin-left: 4px; }
/* ghost numeral behind each section head */
.sec-head::after {
  content: attr(data-n);
  position: absolute; right: 0; top: -58px;
  font-family: var(--font-serif); font-size: 124px; line-height: 1; font-weight: 300;
  color: transparent; -webkit-text-stroke: 1px var(--line-2);
  opacity: .5; pointer-events: none; user-select: none;
}
.sec-intro { font-size: 16px; color: var(--ink-2); margin: -6px 0 26px; max-width: 54ch; }

.hero-h { font-family: var(--font-serif); font-size: clamp(34px, 4.6vw, 50px); line-height: 1.08; letter-spacing: -0.022em; max-width: 20ch; text-wrap: balance; }
.hero-h .accent { color: var(--teal-deep); font-style: italic; }
/* keep the accent phrase on a single line where there's room (desktop/tablet) */
@media (min-width: 761px) { .hero-h .accent { white-space: nowrap; } }
.hero-lede { font-size: 18.5px; line-height: 1.62; color: var(--ink-2); margin-top: 26px; max-width: 50ch; }
.prose p { font-size: 16.5px; line-height: 1.72; color: var(--ink-2); margin: 0 0 16px; text-wrap: pretty; }

/* timeline */
.job { display: grid; grid-template-columns: 124px 1fr; gap: 22px; padding: 20px 0; border-top: 1px solid var(--line); }
.job:last-child { border-bottom: 1px solid var(--line); }
.job .jy { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); padding-top: 3px; }
.job .jrole { font-size: 17px; color: var(--ink); }
.job .jorg { font-size: 14.5px; color: var(--teal-deep); margin-top: 2px; }
.job .jnote { font-size: 13.5px; color: var(--ink-3); margin-top: 7px; line-height: 1.5; }

.edu-title { margin: 40px 0 16px; }
.edu { display: grid; grid-template-columns: 124px 1fr; gap: 22px; padding: 13px 0; border-top: 1px solid var(--line); }
.edu .ey { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.edu .et { font-size: 15.5px; color: var(--ink); }
.edu .eo { font-size: 13.5px; color: var(--ink-2); }

/* skills — building blocks (drop & stack) */
.skill-play { margin-top: 6px; }
.sp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.sp-hint { font-size: 13.5px; color: var(--ink-3); max-width: 46ch; line-height: 1.5; }
.sp-reset { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-deep); background: transparent; border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 12px; cursor: pointer; transition: background .15s, border-color .15s; }
.sp-reset:hover { background: var(--teal-ghost); border-color: var(--teal); }

.sp-area { position: relative; height: 480px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  background-image: radial-gradient(var(--line) 0.9px, transparent 0.9px); background-size: 22px 22px; overflow: hidden; touch-action: none; }
.sp-base { position: absolute; top: 26px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); opacity: .8; white-space: nowrap; pointer-events: none; text-align: center; }
.sp-base::after { content: ''; display: block; width: 1px; height: 30px; background: var(--line-2); margin: 8px auto 0; }

.sp-token { position: absolute; display: inline-flex; align-items: center; padding: 9px 15px;
  background: var(--bg); border: 1px solid var(--line-2); border-left-width: 3px; border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 16px -10px rgba(0,0,0,.28);
  cursor: grab; user-select: none; white-space: nowrap;
  transition: box-shadow .15s ease; will-change: transform, left, top; }
.sp-token.dragging { cursor: grabbing; box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 18px 34px -12px rgba(0,0,0,.45); }
.sp-token .sp-label { font-size: 14px; color: var(--ink); }
.sp-token.g0 { border-left-color: var(--teal); }
.sp-token.g1 { border-left-color: var(--teal-deep); }
.sp-token.g2 { border-left-color: var(--teal); }

@media (max-width: 760px) {
  .sp-area { height: 520px; }
  .sp-hint { max-width: 100%; }
  .sp-token { padding: 8px 13px; }
  .sp-token .sp-label { font-size: 13px; }
}
@media (max-width: 420px) {
  .sp-area { height: 560px; }
}

/* tech-stack cards */
.stack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack-card { border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; background: var(--surface); }
.stack-card.wide { grid-column: 1 / -1; }
.stack-card .sc-label { margin-bottom: 12px; color: var(--teal-deep); }
.stack-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); align-items: baseline; }
.stack-row:first-of-type { border-top: 0; }
.stack-row .sr-n { font-size: 15px; color: var(--ink); white-space: nowrap; }
.stack-row .sr-d { font-size: 12.5px; color: var(--ink-3); text-align: right; max-width: 26ch; line-height: 1.4; }

/* interests */
.int-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.int-card { border: 1px solid var(--line); border-radius: 10px; padding: 20px; background: var(--surface); }
.int-card .ic-t { font-family: var(--font-serif); font-size: 19px; color: var(--ink); }
.int-card .ic-d { font-size: 14px; color: var(--ink-2); margin-top: 8px; line-height: 1.5; }
.int-card .ic-mk { width: 22px; height: 2px; background: var(--teal); margin-bottom: 14px; }

/* link variant of an interest card */
a.int-link { display: block; text-decoration: none; cursor: pointer; }
a.int-link .ic-t { display: inline-flex; align-items: baseline; gap: 8px; transition: color .2s ease; }
a.int-link .ic-t svg { color: var(--teal-deep); transition: transform .25s cubic-bezier(.22,.61,.36,1); }
a.int-link:hover { border-color: var(--teal); }
a.int-link:hover .ic-t { color: var(--teal-deep); }
a.int-link:hover .ic-t svg { transform: translate(2px, -2px); }
a.int-link:hover .ic-mk { width: 40px; }

/* recommendations */
.rec { display: block; padding: 18px 0; border-top: 1px solid var(--line); text-decoration: none; transition: padding-left .15s ease; }
.rec:last-child { border-bottom: 1px solid var(--line); }
.rec:hover { padding-left: 8px; }
.rec-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.rec-name { font-size: 16.5px; color: var(--ink); }
.rec-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.rec-quote { font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--ink-2); margin-top: 7px; line-height: 1.5; }
.rec-link { display: inline-flex; gap: 6px; align-items: center; font-family: var(--font-mono); font-size: 11.5px; color: var(--teal-deep); margin-top: 10px; white-space: nowrap; }

/* contact */
.contact-links { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
.clink { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; transition: color .15s; }
.clink:last-child { border-bottom: 1px solid var(--line); }
.clink .cl-t { font-family: var(--font-serif); font-size: 22px; color: var(--ink); transition: color .15s; }
.clink:hover .cl-t { color: var(--teal-deep); }
.clink .cl-h { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* colophon footer */
.colophon {
  margin-top: 96px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 20px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--ink-3);
}
.colophon .co-logo { display: inline-flex; align-self: flex-start; line-height: 0; }
.colophon .co-logo img { width: 190px; max-width: 256px; height: auto; display: block; }
.colophon .co-logo .co-logo-dark { display: none; }
[data-theme='dark'] .colophon .co-logo .co-logo-light { display: none; }
[data-theme='dark'] .colophon .co-logo .co-logo-dark { display: block; }
.colophon .co-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.colophon .co-row > * { white-space: nowrap; }
.colophon .co-legal { display: flex; gap: 18px; }
.colophon a { color: var(--teal-deep); text-decoration: none; transition: color .15s; }
.colophon a:hover { color: var(--teal); }

/* ---------- Right meta column ---------- */
.meta {
  position: sticky; top: 0; align-self: start; height: 100vh;
  border-left: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 40%, transparent);
  padding: 64px 28px 40px;
  display: flex; flex-direction: column; gap: 24px;
  overflow: auto;
}
.meta-list { display: flex; flex-direction: column; gap: 24px; }
.portrait {
  aspect-ratio: 4 / 5; border-radius: 12px; border: 1px solid var(--line);
  position: relative; overflow: hidden;
  background-color: var(--surface-2);
}
.portrait img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center top; display: block;
}
.meta-block .mb-label { margin-bottom: 7px; }
.meta-block .mb-big { font-size: 15.5px; color: var(--ink); line-height: 1.4; }
.meta-block .mb-big.teal { color: var(--teal-deep); font-family: var(--font-mono); font-size: 13px; }
.meta-block .mb-link { text-decoration: none; word-break: break-all; transition: color .15s; }
.meta-block .mb-link:hover { color: var(--teal); }
.meta-block .mb-sub { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.meta-rule { height: 1px; background: var(--line); }

/* ---------- Responsive ---------- */

/* Tablet landscape / small desktop — drop the meta column, keep the rail */
@media (max-width: 1180px) {
  .site { grid-template-columns: 256px minmax(0,1fr); }
  .meta { display: none; }
  .sidebar { overflow-y: auto; }
  .sb-extra { display: block; }
  .reading { padding: 56px clamp(32px, 5vw, 64px) 84px; }

  /* compact the rail once it also carries the meta info — max 14px */
  .sb-link { font-size: 14px; }
  .sb-role { font-size: 12px; }
  .sb-status { font-size: 12px; }
  .sb-legal { font-size: 10.5px; }
  .sb-extra .meta-block .mb-label { font-size: 11px; }
  .sb-extra .meta-block .mb-big { font-size: 14px; }
  .sb-extra .meta-block .mb-big.teal { font-size: 12px; }
  .sb-extra .meta-block .mb-sub { font-size: 12px; }
}

/* Tablet portrait — slightly tighter rail */
@media (max-width: 980px) {
  .site { grid-template-columns: 224px minmax(0,1fr); }
  .sidebar { padding: 32px 24px 26px; }
  .sb-name { font-size: 17px; }
}

/* Phone — top bar + hamburger → slide-in sheet (nav · meta · toggles) */
@media (max-width: 760px) {
  .site { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: sticky; top: 0; z-index: 50;
    height: auto; min-width: 0; max-width: 100%; overflow: visible;
    flex-direction: row; align-items: center; gap: 0;
    padding: 11px 16px;
    border-right: 0; border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
  .sb-bar { width: 100%; align-items: center; }
  .sb-id { display: flex; flex-direction: row; align-items: center; text-align: left; gap: 12px; }
  /* compact mark replaces the big logo once the burger menu appears */
  .sb-logo-full { display: none; }
  .sb-logo-mark { display: inline-flex; line-height: 0; }
  .sb-logo-mark img { width: 44px; height: 44px; }
  .sb-logo-mark .sb-logo-mdark { display: none; }
  [data-theme='dark'] .sb-logo-mark .sb-logo-mlight { display: none; }
  [data-theme='dark'] .sb-logo-mark .sb-logo-mdark { display: block; }
  .sb-role { display: none; }

  /* hamburger */
  .sb-burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 0 9px; flex: none;
    border: 1px solid var(--line-2); border-radius: 9px; background: var(--bg); cursor: pointer; }
  .sb-burger span { height: 1.5px; width: 100%; background: var(--ink); border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease; }
  .sidebar.open .sb-burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .sidebar.open .sb-burger span:nth-child(2) { opacity: 0; }
  .sidebar.open .sb-burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  /* backdrop */
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: 60;
    background: oklch(0.18 0.01 220 / 0.44); opacity: 0; pointer-events: none; transition: opacity .26s ease; }
  .sidebar.open .sb-scrim { opacity: 1; pointer-events: auto; }

  /* sheet */
  .sb-panel {
    position: fixed; top: 0; right: 0; z-index: 70;
    width: min(86vw, 360px); height: 100%;
    padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
    gap: 22px; background: var(--surface); border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px -30px rgba(0,0,0,.5);
    transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto; flex: none; min-height: 0;
  }
  .sidebar.open .sb-panel { transform: none; }

  .sb-panel-head { display: flex; align-items: center; justify-content: space-between; }
  .sb-close { display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; font-size: 22px; line-height: 1; color: var(--ink-2);
    background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }

  .sb-link { font-size: 17px; padding: 11px 12px; }
  .sb-link .sb-num { font-size: 12px; }
  .sb-extra { display: block; }
  .sb-foot { margin-top: 6px; }
  .sb-loc { display: block; }

  .reading { padding: 40px 20px 64px; }
  .section + .section { margin-top: 64px; }
  .sec-head::after { font-size: 78px; top: -32px; opacity: .4; }
  .colophon { margin-top: 64px; }
  .stack-grid, .int-grid { grid-template-columns: 1fr; }
  .job, .edu { grid-template-columns: 78px 1fr; gap: 14px; }
  .stack-row { flex-direction: column; align-items: flex-start; gap: 3px; }
  .stack-row .sr-d { text-align: left; max-width: 100%; }
}

/* Small phones */
@media (max-width: 420px) {
  .reading { padding: 36px 16px 56px; }
  .sb-name { font-size: 17px; }
  .clink .cl-t { font-size: 19px; }
  .job, .edu { grid-template-columns: 1fr; gap: 4px; }
  .job .jy, .edu .ey { padding-top: 0; }
}
