/* ---------- tokens ---------- */
:root {
  --desk: #F2F4F6;
  --paper: #FFFFFF;
  --ink: #16202A;
  --muted: #5E6B78;
  --rule: #D8DEE4;
  --accent: #0E6E6E;
  --marker: #FFE15A;
  --marker-ink: #16202A;
  --chip: #E6EBEF;
  --dim: .32;
  --mh: 45%;          /* marker height: half-line on light paper */
  --mtext: var(--ink);

  --font: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step--1: .875rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-4: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  --side-w: 21rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #11171D; --paper: #182029; --ink: #E4E9EE; --muted: #93A1AE; --rule: #2B3743;
    --accent: #5CC6C0; --marker: #E3C53A; --marker-ink: #11171D; --chip: #222C37; --dim: .3;
    --mh: 100%; --mtext: #11171D;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #11171D; --paper: #182029; --ink: #E4E9EE; --muted: #93A1AE; --rule: #2B3743;
  --accent: #5CC6C0; --marker: #E3C53A; --marker-ink: #11171D; --chip: #222C37; --dim: .3;
  --mh: 100%; --mtext: #11171D;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font-family: var(--font); font-size: var(--step-0); line-height: 1.55;
  font-feature-settings: "ss01";
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .18em; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
button { font: inherit; color: inherit; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
.skip { position: absolute; left: -999px; top: 1rem; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* ---------- layout ---------- */
.page {
  max-width: 76rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem);
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: clamp(2rem, 4vw, 4rem);
}
.side { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.side-inner { position: relative; padding: clamp(2rem, 5vh, 3.5rem) 0 3rem; }
.sheet {
  background: var(--paper); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule);
  padding: clamp(2rem, 5vh, 3.5rem) clamp(1.5rem, 4vw, 3.5rem) 4rem;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.side-tools { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2.25rem; }
.lang-switch { display: inline-flex; padding: .2rem; border: 1px solid var(--rule); border-radius: 999px; }
.lang-switch a {
  min-width: 2.5rem; padding: .3rem .7rem; border-radius: 999px; text-align: center; text-decoration: none;
  font-size: var(--step--1); font-weight: 600; letter-spacing: .02em; color: var(--muted);
}
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.theme-toggle {
  margin-left: auto;
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%; background: transparent; cursor: pointer; color: var(--muted);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.6; }

.photo { width: 7rem; height: 7rem; border-radius: 50%; object-fit: cover; margin-bottom: 1.5rem; background: var(--chip); }
.name {
  font-size: var(--step-4); font-weight: 800; line-height: 1; letter-spacing: -.035em;
  text-wrap: balance;
}
.headline { margin-top: .75rem; font-size: var(--step-1); color: var(--accent); font-weight: 500; line-height: 1.3; }

.contact { margin-top: 2rem; display: grid; gap: .55rem; font-size: var(--step--1); color: var(--muted); }
.contact li { display: flex; gap: .6rem; align-items: center; min-width: 0; }
.contact a, .contact span { overflow-wrap: anywhere; }
.ico { flex: none; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.pdf-btn {
  margin-top: 1.75rem; display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.1rem .65rem .9rem; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: var(--step--1); text-decoration: none;
}
.pdf-btn:hover { color: var(--paper); background: var(--accent); }
.pdf-btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.side-h { font-size: var(--step-0); font-weight: 700; margin-top: 2.75rem; }
.hint { margin-top: .25rem; font-size: var(--step--1); color: var(--muted); line-height: 1.4; }
.skill-group { margin-top: 1rem; }
.skill-group h3 { font-size: var(--step--1); font-weight: 500; color: var(--muted); margin-bottom: .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }

/* skill chip; the bottom bar shows self-rated level (1-5) */
.chip {
  --lvl: 0%;
  position: relative; overflow: hidden;
  border: 0; border-radius: .4rem; padding: .3rem .65rem .38rem; cursor: pointer;
  background: var(--chip); font-size: var(--step--1); font-weight: 500; line-height: 1.3;
  transition: background-color .15s, color .15s;
}
.chip::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--lvl);
  background: var(--accent); opacity: .7;
}
.chip:hover { background: color-mix(in srgb, var(--marker) 45%, var(--chip)); }
.chip[aria-pressed="true"] { background: var(--marker); color: var(--marker-ink); }
.chip[aria-pressed="true"]::after { background: var(--marker-ink); }
.chip.is-unused { cursor: default; color: var(--muted); }
.chip.is-unused:hover { background: var(--chip); }

.langs dl { margin-top: .75rem; display: grid; gap: .4rem; }
.langs dl div { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--step--1); border-bottom: 1px solid var(--rule); padding-bottom: .4rem; }
.langs dt { font-weight: 600; }
.langs dd { margin: 0; color: var(--muted); text-align: right; }

/* ---------- main sheet ---------- */
.summary { font-size: var(--step-1); line-height: 1.6; max-width: 40rem; }
.summary p + p { margin-top: .8em; }
.summary ul { margin-top: .6em; padding-left: 1.1em; list-style: disc; }

.filter-status {
  position: fixed; z-index: 5; left: 50%; transform: translateX(-50%);
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  width: max-content; max-width: calc(100vw - 2rem);
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem .6rem .55rem 1rem; border-radius: .6rem;
  background: var(--ink); color: var(--paper); font-size: var(--step--1);
  box-shadow: 0 6px 24px rgba(10, 16, 22, .22);
}
.filter-status[hidden] { display: none; }
.filter-status strong { background: var(--marker); color: var(--marker-ink); padding: 0 .3em; border-radius: .2em; }
.filter-clear { border: 1px solid color-mix(in srgb, var(--paper) 40%, transparent); background: transparent; color: inherit; border-radius: 999px; padding: .25rem .8rem; cursor: pointer; }
.filter-clear:hover { background: color-mix(in srgb, var(--paper) 15%, transparent); }

.block { margin-top: 3.25rem; }
.block-h { font-size: var(--step-2); font-weight: 800; letter-spacing: -.02em; margin-bottom: 1.25rem; }

.timeline { display: grid; }
.entry {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); column-gap: 1.75rem;
  transition: opacity .25s;
}
.when {
  padding-top: .2rem; font-size: var(--step--1); color: var(--muted);
  font-variant-numeric: tabular-nums; line-height: 1.45;
}
.what { position: relative; padding: 0 0 2rem 1.5rem; border-left: 1px solid var(--rule); max-width: 42rem; }
.entry:last-child .what { padding-bottom: .25rem; }
/* dot on the timeline: filled = current, hollow = past */
.what::before {
  content: ""; position: absolute; left: -.34rem; top: .5rem; width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--muted);
}
.is-current .what::before { background: var(--accent); border-color: var(--accent); }

.entry-title { font-size: var(--step-1); font-weight: 700; line-height: 1.3; }
/* the marker-pen highlight used when filtering by skill */
.entry-title > * {
  background-image: linear-gradient(var(--marker), var(--marker));
  background-repeat: no-repeat; background-position: 0 88%; background-size: 0% 45%;
  transition: background-size .45s cubic-bezier(.3, .7, .2, 1);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.entry-title a { text-decoration: none; }
.entry-title a::after { content: "↗"; font-weight: 400; color: var(--muted); margin-left: .25em; font-size: .85em; }
.org { color: var(--muted); margin-top: .1rem; }

.desc { margin-top: .6rem; }
.desc p + p, .desc p + ul, .desc ul + p { margin-top: .5rem; }
.desc ul { display: grid; gap: .3rem; }
.desc li { position: relative; padding-left: 1rem; }
.desc li::before { content: ""; position: absolute; left: 0; top: .7em; width: .4rem; height: 1px; background: var(--muted); }
.desc li.is-extra { display: none; }
.desc.is-open li.is-extra { display: list-item; }
.more {
  margin-top: .45rem; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: var(--step--1); font-weight: 600;
  text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px;
}

.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.tag {
  border: 1px solid var(--rule); background: transparent; border-radius: .35rem;
  padding: .1rem .5rem; font-size: .8125rem; color: var(--muted); cursor: pointer;
}
.tag:hover { color: var(--ink); border-color: var(--muted); }
.tag[aria-pressed="true"] { background: var(--marker); border-color: var(--marker); color: var(--marker-ink); }

/* filter state */
.is-filtering .entry { opacity: var(--dim); }
.is-filtering .entry.is-match { opacity: 1; }
.entry.is-match .entry-title > * { background-size: 100% var(--mh); color: var(--mtext); }

/* ---------- responsive ---------- */
@media (max-width: 62rem) {
  :root { --side-w: 17rem; }
  .entry { grid-template-columns: 1fr; }
  .when { padding: 0 0 .3rem 1.5rem; border-left: 1px solid var(--rule); }
  .what::before { top: -1.35rem; }
}
@media (max-width: 46rem) {
  .page { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .side { position: static; max-height: none; overflow: visible; }
  .side-inner { padding: 2rem 1.25rem 2rem; }
  .sheet { border: 0; border-top: 1px solid var(--rule); min-height: 0; padding: 2rem 1.25rem 3rem; }
}

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

/* ---------- print (browser "Save as PDF" fallback) ---------- */
@media print {
  :root { --desk: #fff; --paper: #fff; --ink: #000; --muted: #444; --rule: #bbb; }
  .page { display: block; max-width: none; padding: 0; }
  .side { position: static; max-height: none; overflow: visible; }
  .side-inner { padding: 0 0 1rem; }
  .side-tools, .pdf-btn, .hint, .filter-status, .more, .skip { display: none !important; }
  .sheet { border: 0; padding: 0; min-height: 0; }
  .desc li.is-extra { display: list-item; }
  .entry { opacity: 1 !important; break-inside: avoid; }
  .entry-title > * { background: none !important; }
  .chip { background: none; padding: 0 .3rem 0 0; }
  .chip::after { display: none; }
}
