/* Philipp Grabner – work page. No framework, no build step. */

@font-face { font-family: "Plex Sans"; src: url("../assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../assets/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --paper: #fcfcfb;
  --ink: #1a1d21;
  --graphite: #535b64;
  --rule: #dcdfe2;
  --wash: #f0f2f4;
  --link: #2353c9;

  /* Trace phases – validated as a categorical set (light + dark), always labelled in text */
  --symptom: #b4233c;
  --measure: #a86a0c;
  --fix: #2353c9;
  --result: #17734d;

  --text: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.5rem, 6vw, 3.75rem);
  --measure-w: 40rem;
  --wide-w: 56rem;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17191c;
    --ink: #e7e9eb;
    --graphite: #a3aab2;
    --rule: #33373d;
    --wash: #1f2226;
    --link: #93b0f2;
    --symptom: #db4f6a;
    --measure: #bc8526;
    --fix: #6a8fe8;
    --result: #3aa676;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17191c; --ink: #e7e9eb; --graphite: #a3aab2; --rule: #33373d; --wash: #1f2226; --link: #93b0f2;
  --symptom: #db4f6a; --measure: #bc8526; --fix: #6a8fe8; --result: #3aa676; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text)/1.6 "Plex Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }
code { font-family: "Plex Mono", ui-monospace, monospace; font-size: 0.88em; background: var(--wash); padding: 0.05em 0.3em; border-radius: 3px; }
strong { font-weight: 600; }
p, ul, ol, dl, table, figure { margin: 0 0 1rem; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; }
.skip:focus { left: var(--gutter); top: var(--gutter); z-index: 10; }

/* ---------- Layout: document with a table of contents ---------- */
.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.toc { display: none; }
main { min-width: 0; }

@media (min-width: 64rem) {
  .page { grid-template-columns: 12rem minmax(0, 1fr); column-gap: 4rem; padding: 0 2.5rem; }
  .toc { display: block; }
  .toc nav { position: sticky; top: 3.5rem; padding-top: 3.5rem; font-size: 0.9375rem; }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc li { margin: 0 0 0.45rem; }
  .toc a { color: var(--graphite); text-decoration: none; }
  .toc a:hover, .toc a[aria-current="true"] { color: var(--ink); text-decoration: underline; }
  .toc .toc-name { color: var(--ink); font-weight: 600; margin-bottom: 1.25rem; display: block; }
}

section { padding: 3.5rem 0 1rem; border-top: 1px solid var(--rule); }
section > h2 { font-size: var(--step-3); letter-spacing: -0.01em; margin-bottom: 1.25rem; }
.prose { max-width: var(--measure-w); }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink); max-width: var(--measure-w); }
.muted { color: var(--graphite); }

/* ---------- Intro ---------- */
.intro { padding: 4.5rem 0 3rem; }
.intro h1 { font-size: var(--step-4); letter-spacing: -0.025em; line-height: 1.05; margin-bottom: 1.5rem; }
.intro .lede { margin-bottom: 1.5rem; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 1.5rem; max-width: var(--wide-w); margin: 2rem 0 1.75rem; }
.facts dt { color: var(--graphite); }
.facts dd { margin: 0; }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0; margin: 0; list-style: none; }
.links a { font-weight: 500; }
@media (max-width: 30rem) { .facts { grid-template-columns: minmax(0, 1fr); gap: 0 0; } .facts dd { margin-bottom: 0.6rem; } }

/* ---------- Case studies ---------- */
.case { padding: 0.5rem 0 2.5rem; }
.case + .case { border-top: 1px dashed var(--rule); padding-top: 2.5rem; }
.case h3 { font-size: var(--step-2); letter-spacing: -0.01em; margin-bottom: 0.4rem; }
.case .status { color: var(--graphite); margin-bottom: 1.25rem; }
.case h4 { font-size: var(--text); margin: 1.5rem 0 0.4rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2.5rem; max-width: var(--wide-w); }
@media (min-width: 48rem) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.split ul { padding-left: 1.1rem; }
.split li { margin-bottom: 0.35rem; }

.callout { border-left: 3px solid var(--symptom); padding: 0.25rem 0 0.25rem 1rem; max-width: var(--measure-w); margin: 1.5rem 0; }
.callout h4 { margin-top: 0; }

/* Before / after measurements: values printed, bars only reinforce */
.ba { width: 100%; max-width: var(--wide-w); border-collapse: collapse; font-size: 0.9688rem; }
.ba caption { text-align: left; color: var(--graphite); padding-bottom: 0.5rem; caption-side: top; }
.ba th, .ba td { text-align: left; padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ba thead th { font-weight: 500; color: var(--graphite); }
.ba td.num { white-space: nowrap; }
.bar { display: block; height: 6px; margin-top: 0.4rem; border-radius: 0 4px 4px 0; background: var(--graphite); opacity: 0.45; }
.bar.after { background: var(--result); opacity: 1; }
@media (max-width: 40rem) {
  .ba thead { display: none; }
  .ba tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--rule); padding: 0.5rem 0; }
  .ba th, .ba td { border: 0; padding: 0.15rem 0.5rem 0.15rem 0; }
  .ba th[scope="row"] { grid-column: 1 / -1; font-weight: 500; }
  .ba td.num::before { content: attr(data-label) " "; color: var(--graphite); }
}

figure.diagram { max-width: var(--wide-w); margin: 1.75rem 0; }
figure.diagram svg { width: 100%; height: auto; display: block; }
figure figcaption { color: var(--graphite); font-size: 0.9375rem; margin-top: 0.6rem; max-width: var(--measure-w); }

/* ---------- Incident traces (the one loud thing on this page) ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; padding: 0; margin: 0 0 2rem; list-style: none; color: var(--graphite); font-size: 0.9375rem; }
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.key { width: 0.9rem; height: 0.55rem; border-radius: 2px; background: var(--c); display: inline-block; }
.key.failed { background: repeating-linear-gradient(135deg, var(--fix) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--fix); }

.incident { max-width: var(--wide-w); margin: 0 0 3.25rem; }
.incident h3 { font-size: var(--step-2); letter-spacing: -0.01em; margin-bottom: 0.25rem; }
.incident .when { color: var(--graphite); margin-bottom: 1.25rem; }
.trace { list-style: none; margin: 0; padding: 0; }
.span {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  column-gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--rule);
}
.span:last-child { border-bottom: 1px solid var(--rule); }
.phase { font-weight: 500; font-size: 0.9375rem; padding-top: 0.05rem; }
.track { position: relative; height: 10px; margin: 0.45rem 0 0.5rem; background: linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat; }
.track i {
  position: absolute; top: 0; bottom: 0;
  left: var(--s); width: max(var(--w), 10px);
  background: var(--c); border-radius: 4px;
  box-shadow: 0 0 0 2px var(--paper);
}
.span.failed .track i { background: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1.5px var(--c), 0 0 0 2px var(--paper); }
.span .note { grid-column: 2; margin: 0; max-width: var(--measure-w); }
.span .note .t { color: var(--graphite); }
.axis { display: flex; justify-content: space-between; margin-left: 7.5rem; color: var(--graphite); font-size: 0.875rem; padding-bottom: 0.35rem; }
.lesson { margin: 1rem 0 0; max-width: var(--measure-w); }
.lesson strong { font-weight: 600; }
.s-symptom { --c: var(--symptom); } .s-measure { --c: var(--measure); } .s-fix { --c: var(--fix); } .s-result { --c: var(--result); }
.s-symptom .phase { color: var(--symptom); } .s-measure .phase { color: var(--measure); } .s-fix .phase { color: var(--fix); } .s-result .phase { color: var(--result); }

@media (max-width: 34rem) {
  .span { grid-template-columns: minmax(0, 1fr); }
  .span .note { grid-column: 1; }
  .track { margin: 0.35rem 0 0.45rem; }
  .axis { margin-left: 0; }
}

/* ---------- How I work ---------- */
.steps { max-width: var(--measure-w); padding-left: 1.4rem; }
.steps li { margin-bottom: 1rem; padding-left: 0.25rem; }
.steps li::marker { color: var(--graphite); font-weight: 500; }
blockquote { margin: 1.5rem 0; padding: 0 0 0 1rem; border-left: 3px solid var(--rule); max-width: var(--measure-w); font-style: italic; }
blockquote footer { font-style: normal; color: var(--graphite); font-size: 0.9375rem; margin-top: 0.35rem; }

/* ---------- Lists: also built, log ---------- */
.rows { list-style: none; padding: 0; margin: 0; max-width: var(--wide-w); }
.rows li { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); column-gap: 1.75rem; padding: 0.85rem 0; border-top: 1px solid var(--rule); }
.rows li:last-child { border-bottom: 1px solid var(--rule); }
.rows .what { font-weight: 500; }
.rows .what small { display: block; font-weight: 400; color: var(--graphite); font-size: 0.875rem; }
.rows p { margin: 0; }
.log li { grid-template-columns: 8rem minmax(0, 1fr); }
.log time { color: var(--graphite); }
@media (max-width: 34rem) {
  .rows li, .log li { grid-template-columns: minmax(0, 1fr); row-gap: 0.15rem; }
}

.two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 3rem; max-width: var(--wide-w); }
@media (min-width: 48rem) { .two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.two h3 { font-size: var(--step-1); margin: 0.5rem 0 0.6rem; }
.two ul { padding-left: 1.1rem; }
.two li { margin-bottom: 0.35rem; }

/* ---------- Footer ---------- */
.contact .big { font-size: var(--step-2); font-weight: 500; margin-bottom: 1rem; }
footer.site { border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.5rem 0 3rem; color: var(--graphite); font-size: 0.9375rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
footer.site a { color: var(--graphite); }

/* ---------- Print: the page doubles as a CV ---------- */
@media print {
  :root { --paper: #fff; --ink: #000; --graphite: #444; --rule: #bbb; --link: #000; }
  .toc, .skip, .noprint { display: none !important; }
  .page { display: block; padding: 0; }
  body { font-size: 10.5pt; }
  section { padding-top: 1.25rem; break-inside: auto; }
  .incident, .case { break-inside: avoid; }
  a { text-decoration: none; }
  .intro { padding-top: 0; }
}
.linklike { font: inherit; font-weight: 500; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.linklike:hover { text-decoration-thickness: 2px; }
