/* rubenlinder.ch — "Lago di Lugano": cool mist paper, lake-ink type, deep-lake teal,
   one brass signal for availability. Spectral (headings) + IBM Plex Sans (text).
   One stylesheet for CV, landing, invalid-link and admin pages. */

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

:root {
  --paper: #f2f5f4;
  --raised: #fafcfb;
  --ink: #132029;
  --ink-soft: #33444d;
  --muted: #5b6b70;
  --rule: #d5dfdc;
  --lake: #1d5c63;
  --lake-ink: #ffffff;
  --lake-wash: #e1ecea;
  --brass: #b8862b;
  --bar: #a9bdbb;
  --group: #5e9a98;
  --expert: #1d5c63;
  --advanced: #4d7a5c;
  --working: #8a6a2e;

  --serif: "Spectral", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --measure: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1b21; --raised: #14232a; --ink: #e2ebe9; --ink-soft: #c3d0cd; --muted: #8fa3a3;
    --rule: #24363d; --lake: #73b8b1; --lake-ink: #0b1a1e; --lake-wash: #16303a; --brass: #d9a94d;
    --bar: #3a5257; --group: #3f8580; --expert: #73b8b1; --advanced: #93c4a0; --working: #d6b77d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1b21; --raised: #14232a; --ink: #e2ebe9; --ink-soft: #c3d0cd; --muted: #8fa3a3;
  --rule: #24363d; --lake: #73b8b1; --lake-ink: #0b1a1e; --lake-wash: #16303a; --brass: #d9a94d;
  --bar: #3a5257; --group: #3f8580; --expert: #73b8b1; --advanced: #93c4a0; --working: #d6b77d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility;
}
a { color: var(--lake); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--lake); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; color: var(--ink); text-wrap: balance; }
strong { font-weight: 600; }
p, li { text-wrap: pretty; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem; padding: 0 0.95rem;
  border: 1px solid var(--rule); border-radius: 4px; background: transparent; color: var(--ink);
  font: 500 0.875rem/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--lake); color: var(--lake); }
.btn-primary { background: var(--lake); border-color: var(--lake); color: var(--lake-ink); }
.btn-primary:hover { color: var(--lake-ink); filter: brightness(1.1); }
.btn-icon { width: 2.25rem; padding: 0; justify-content: center; }
.btn-icon svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-danger:hover { border-color: #b3261e; color: #b3261e; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem max(1rem, calc((100vw - 72rem) / 2));
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.toolbar-name { font: 500 1.05rem/1 var(--serif); color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ---------- layout ---------- */
.layout { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.toc { display: none; }
@media (min-width: 68rem) {
  .layout { display: grid; grid-template-columns: 11rem minmax(0, var(--measure)); gap: 4.5rem; justify-content: center; }
  .toc { display: block; position: sticky; top: 5.5rem; align-self: start; padding-top: 4.25rem; }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc a { display: block; padding: 0.28rem 0; color: var(--muted); font-size: 0.875rem; text-decoration: none; }
  .toc a:hover { color: var(--lake); }
  .toc a[aria-current="true"] { color: var(--ink); font-weight: 500; }
  .toc a[aria-current="true"]::before { content: ""; display: inline-block; width: 0.9rem; height: 2px; margin: 0 0.5rem 0.25em 0; background: var(--lake); vertical-align: middle; }
}
.cv { max-width: var(--measure); margin: 0 auto; padding-bottom: 5rem; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 2rem;
  grid-template-areas: "head photo" "focus contact" "avail avail" "rail rail";
  padding: 4rem 0 0;
}
.hero-head { grid-area: head; align-self: end; }
.hero h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 3.5rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.02; }
.hero-title { margin: 0.6rem 0 0; font: 400 1.3125rem/1.3 var(--serif); font-style: italic; color: var(--lake); }
.hero-photo { grid-area: photo; justify-self: end; width: 7.5rem; height: auto; border-radius: 3px; align-self: end; }
.hero-focus, .hero-contact { margin: 0; padding: 0; list-style: none; }
.hero-focus { grid-area: focus; margin-top: 1.75rem; font-size: 1.0625rem; line-height: 1.55; color: var(--ink-soft); }
.hero-focus li { padding-left: 1rem; border-left: 2px solid var(--lake); }
.hero-focus li + li { margin-top: 0.15rem; }
.hero-contact { grid-area: contact; margin-top: 1.75rem; font-size: 0.9375rem; line-height: 1.75; color: var(--muted); text-align: right; }
.availability { grid-area: avail; margin-top: 2rem; padding-left: 1rem; border-left: 2px solid var(--brass); }
.availability p { margin: 0; font-size: 0.9375rem; color: var(--ink-soft); }
.availability p:first-child { color: var(--ink); font-weight: 500; }

/* career rail: every employer on one year axis */
.rail { grid-area: rail; display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); margin: 2.5rem 0 0; }
.rail-labels { margin: 0; padding: 22px 0 0; list-style: none; }
.rail-labels li { height: 26px; padding-right: 1rem; font-size: 0.8125rem; line-height: 26px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-chart { display: block; overflow: visible; }
.rail-band { fill: var(--lake-wash); }
.rail-band-label { fill: var(--lake); font: italic 400 12.5px var(--sans); }
.rail-tick { stroke: var(--rule); stroke-width: 1; }
.rail-year { fill: var(--muted); font: 400 12px var(--sans); font-variant-numeric: tabular-nums; }
.rail-bar { fill: var(--bar); transform-box: fill-box; transform-origin: left center; animation: rail-grow 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.rail-bar-group { fill: var(--group); }
.rail-bar-current { fill: var(--lake); }
.rail-legend { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0.6rem 0 0; font-size: 0.8125rem; color: var(--muted); }
.rail-key::before { content: ""; display: inline-block; width: 1.1rem; margin-right: 0.45rem; vertical-align: middle; }
.rail-key-group::before { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--group) 55%, var(--lake) 55%); }
.rail-bar:nth-of-type(2) { animation-delay: 0.05s; } .rail-bar:nth-of-type(3) { animation-delay: 0.1s; }
.rail-bar:nth-of-type(4) { animation-delay: 0.15s; } .rail-bar:nth-of-type(5) { animation-delay: 0.2s; }
.rail-bar:nth-of-type(6) { animation-delay: 0.25s; } .rail-bar:nth-of-type(7) { animation-delay: 0.3s; }
@keyframes rail-grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .rail-bar { animation: none; } }

@media (max-width: 40rem) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "photo" "head" "focus" "contact" "avail" "rail"; padding-top: 2rem; }
  .hero-photo { justify-self: start; width: 5.5rem; margin-bottom: 1.25rem; }
  .hero-contact { text-align: left; margin-top: 1.25rem; }
  .rail { grid-template-columns: 9.5rem minmax(0, 1fr); }
  .rail-labels li { font-size: 0.75rem; padding-right: 0.5rem; }
  .rail-band-label { font-size: 11px; }
  .rail-legend { grid-column: 1 / -1; }
  .toolbar-actions .btn:not(.btn-primary):not(.btn-icon) { display: none; }
}

/* ---------- sections ---------- */
.cv-section { padding-top: 2.5rem; margin-top: 3rem; border-top: 1px solid var(--rule); }
.cv-section > h2 { display: flex; align-items: baseline; gap: 1rem; margin: 0 0 1.25rem; font-size: 1.75rem; }
.cv-section p, .cv-section li { color: var(--ink-soft); }
.cv-section ul { padding-left: 1.1rem; margin: 0.5rem 0 0; }
.cv-section li { margin: 0.35rem 0; padding-left: 0.25rem; }
.cv-section li::marker { color: var(--lake); }
.cv-section li > strong:first-child, .cv-section p > strong:first-child { color: var(--ink); }

.lead { font: 400 1.1875rem/1.6 var(--serif); color: var(--ink) !important; }

/* proof points: an unboxed two-column list, the figure leads in serif */
.highlights { display: grid; gap: 1.5rem 2.5rem; padding: 0 !important; margin-top: 2rem !important; list-style: none; }
@media (min-width: 40rem) { .highlights { grid-template-columns: 1fr 1fr; } }
.highlights li { margin: 0; padding: 0; font-size: 0.9375rem; line-height: 1.55; }
.highlights li > strong:first-child { display: block; margin-bottom: 0.3rem; font: 500 1.3125rem/1.25 var(--serif); color: var(--lake) !important; }

.entry { margin-top: 2rem; }
.entry h3 { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.15rem 1rem; margin: 0 0 0.4rem; font-size: 1.3125rem; }
.when { font: 400 0.9375rem/1.3 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tech { margin: 0.25rem 0 0.5rem; font-size: 0.875rem; line-height: 1.55; color: var(--muted) !important; }
.tech strong { font-weight: 500; color: var(--ink-soft) !important; }
.role { margin: 1.25rem 0 0.25rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 1rem; }
.role strong { font: 500 1.0625rem/1.35 var(--serif); }
.role-note { flex-basis: 100%; font-size: 0.875rem; color: var(--muted); }

/* projects: title and technologies visible, details folded */
.project { margin-top: 0; border-bottom: 1px solid var(--rule); }
.project:first-of-type { border-top: 1px solid var(--rule); margin-top: 1.75rem; }
.project summary { position: relative; display: block; padding: 1.1rem 2.5rem 1rem 0; cursor: pointer; list-style: none; }
.project summary::-webkit-details-marker { display: none; }
.project summary::after {
  content: ""; position: absolute; right: 0.4rem; top: 1.55rem; width: 0.5rem; height: 0.5rem;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform 0.2s;
}
.project[open] summary::after { transform: rotate(-135deg); top: 1.8rem; }
.project summary:hover h3, .project summary:focus-visible h3 { color: var(--lake); }
.project summary:hover::after { border-color: var(--lake); }
.project summary h3 { margin: 0; }
.project summary .tech { margin-bottom: 0; }
.project-body { padding: 0 0 1.25rem; }
.project-body ul { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .project summary::after { transition: none; } }
.expand-all { margin-left: auto; min-height: 1.9rem; font-size: 0.8125rem; }

/* employment */
#employment-history .entry + .entry { margin-top: 2.5rem; }

/* skills matrix */
.table-wrap { overflow-x: auto; margin: 1rem 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
th, td { padding: 0.5rem 0.9rem 0.5rem 0; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font-size: 0.8125rem; color: var(--muted); font-weight: 500; border-bottom-color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--muted); }
td:nth-child(2) { color: var(--ink); font-weight: 500; white-space: normal; }
td.level::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.45rem; border-radius: 50%; background: currentColor; }
.level-expert { color: var(--expert) !important; }
.level-advanced { color: var(--advanced) !important; }
.level-working { color: var(--working) !important; }

.cv-footer { margin-top: 4rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.875rem; color: var(--muted); }

/* ---------- landing / invalid-link page ---------- */
.page-card { min-height: 100vh; min-height: 100dvh; display: grid; align-items: center; padding: 2rem 1rem; }
.card { width: 100%; max-width: 40rem; margin: 0 auto; }
.card h1 { margin: 0; font-size: clamp(2.25rem, 8vw, 3.5rem); letter-spacing: -0.02em; line-height: 1.05; }
.card .hero-focus { margin-top: 1.5rem; }
.card-from { margin: 0 0 0.75rem; font: italic 400 1.125rem var(--serif); color: var(--lake); }
.card-note { margin: 2rem 0 1.25rem; color: var(--ink-soft); max-width: 34rem; }
.card-fine { margin: 2.5rem 0 0; font-size: 0.8125rem; color: var(--muted); }

/* ---------- admin ---------- */
.admin { max-width: 72rem; margin: 0 auto; padding: 2rem 1rem 4rem; }
.admin h1 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.admin-form { display: grid; gap: 0.75rem; grid-template-columns: 1fr; padding: 1.25rem; margin-bottom: 2.5rem; background: var(--raised); border: 1px solid var(--rule); border-radius: 6px; }
@media (min-width: 48rem) { .admin-form { grid-template-columns: 2fr 6rem 2fr auto; align-items: end; } }
.admin-form label { display: grid; gap: 0.3rem; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.admin-form input { min-height: 2.25rem; padding: 0 0.7rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); font: 400 1rem var(--sans); }
.admin-new { padding: 1rem 1.25rem; margin-bottom: 2.5rem; border-left: 2px solid var(--brass); background: var(--raised); word-break: break-all; }
.admin-new code { font-size: 0.95rem; }
.admin table td { white-space: nowrap; }
.admin table td:nth-child(2) { white-space: normal; font-weight: 500; }
.admin table td:first-child { color: inherit; }
.status { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 3px; font-size: 0.8125rem; font-weight: 500; }
.status-active { background: var(--lake-wash); color: var(--lake); }
.status-expired, .status-revoked { background: var(--rule); color: var(--muted); }
.inline-form { display: inline; margin: 0; }
.muted { color: var(--muted); }

/* ---------- print (also drives the PDF) ---------- */
@page { size: A4; margin: 16mm 16mm 18mm; }
@media print {
  :root, :root[data-theme="dark"] {
    --paper: #ffffff; --raised: #ffffff; --ink: #132029; --ink-soft: #2c3b43; --muted: #56656a;
    --rule: #cfd9d6; --lake: #1d5c63; --lake-wash: #e6efed; --brass: #a8781f; --bar: #a9bdbb; --group: #5e9a98;
    --expert: #1d5c63; --advanced: #42704f; --working: #7a5e2f; color-scheme: light;
  }
  body { font-size: 9.4pt; line-height: 1.45; }
  .toolbar, .toc, .expand-all { display: none !important; }
  .layout { display: block; padding: 0; max-width: none; }
  .cv { max-width: none; padding: 0; }
  .hero { padding: 0 0 2mm; column-gap: 8mm; }
  .hero h1 { font-size: 25pt; }
  .hero-title { font-size: 12.5pt; margin-top: 1.5mm; }
  .hero-photo { width: 24mm; }
  .hero-focus, .hero-contact { margin-top: 4mm; font-size: 9pt; }
  .availability { margin-top: 4mm; }
  .availability p { font-size: 9pt; }
  .rail { margin-top: 4mm; grid-template-columns: 46mm minmax(0, 1fr); }
  .rail-labels li { font-size: 8.2pt; }
  .rail-bar { animation: none; }
  .tech, .role-note { font-size: 8.4pt; }
  .when { font-size: 8.8pt; }
  .cv-section li { margin: 0.6mm 0; }
  .cv-section { padding-top: 4mm; margin-top: 5mm; }
  .cv-section > h2 { font-size: 15pt; margin-bottom: 2.5mm; break-after: avoid; }
  .lead { font-size: 10.5pt; }
  .highlights { grid-template-columns: 1fr 1fr; gap: 3mm 7mm; margin-top: 3mm !important; }
  .highlights li { font-size: 8.8pt; break-inside: avoid; }
  .highlights li > strong:first-child { font-size: 11pt; }
  .entry { margin-top: 4mm; }
  .entry h3 { font-size: 11.5pt; break-after: avoid; }
  .project, .project:first-of-type { border: 0; margin-top: 4mm; }
  .project summary { padding: 0; }
  .project summary::after { display: none; }
  .project-body { padding: 0; }
  .project summary .tech { margin-bottom: 1.5mm; }
  .entry li, .role { break-inside: avoid; }
  .role { break-after: avoid; margin-top: 2.5mm; }
  .role strong { font-size: 10.2pt; }
  #employment-history .entry + .entry { margin-top: 5mm; }
  .table-wrap { overflow: visible; break-inside: avoid; }
  th, td { padding: 1mm 3mm 1mm 0; }
  table { font-size: 8.6pt; }
  a { color: inherit; text-decoration: none; }
  .cv-footer { margin-top: 6mm; font-size: 8pt; }
}
