@import url('tokens.css');

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg-1);
  background-image: var(--tex-paper);
  background-blend-mode: multiply;
}

.app { min-height: 100vh; }

/* ==== TOPBAR ==== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  transition: background var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled {
  background: rgba(248, 245, 238, 0.88);
  backdrop-filter: blur(8px) saturate(1.05);
  border-bottom-color: var(--line-1);
}
[data-theme="dark"] .topbar.scrolled {
  background: rgba(21, 20, 15, 0.82);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom-color: var(--line-1);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 18px 40px;
  display: flex; align-items: center; justify-content: space-between;
}
.wordmark {
  font-family: var(--font-display); font-weight: 400;
  font-size: 22px; letter-spacing: -0.02em;
  cursor: pointer; text-decoration: none; color: var(--fg-1);
  display: inline-flex; align-items: baseline; gap: 2px;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  white-space: nowrap;
}
.wordmark .dot { color: var(--brand); }
.wordmark .initials {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--fg-3);
  padding-left: 10px; margin-left: 10px;
  border-left: 1px solid var(--line-2);
  transform: translateY(-2px);
}
.topbar nav { display: flex; gap: 2px; align-items: center; }
.wordmark-short { display: none; }
.nav-link {
  font-family: var(--font-sans);
  font-size: 13px; color: var(--fg-2);
  padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
  letter-spacing: 0.01em;
}
.nav-link:hover { color: var(--fg-1); }
.nav-link.active { color: var(--brand); }
.theme-toggle {
  margin-left: 8px; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-1); background: transparent;
  border-radius: var(--radius-pill); cursor: pointer;
  color: var(--fg-2); transition: all var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover { color: var(--fg-1); border-color: var(--line-2); }

/* DE/EN — a real link to the other language, not a JS widget */
.lang-toggle {
  margin-left: 8px; padding: 6px 10px;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  border: 1px solid var(--line-1); border-radius: var(--radius-pill);
  text-decoration: none; white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.lang-toggle:hover { border-color: var(--line-2); }
.lang-toggle .lang-on { color: var(--fg-1); }
.lang-toggle .lang-off { color: var(--fg-3); }
.lang-toggle:hover .lang-off { color: var(--fg-2); }
.lang-toggle .lang-on::after { content: "/"; margin-left: 5px; color: var(--line-2); }

/* ==== UTIL ==== */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: var(--tracking-wider);
  text-transform: uppercase; color: var(--fg-3); font-weight: 500;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ==== HERO ==== */
.hero {
  position: relative;
  padding: 170px 0 100px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-1);
}

.hero-photo {
  position: absolute; inset: 0;
  background-image: url('assets/photos/hero-dolomites.jpeg'); /* fallback */
  background-image: image-set(
    url('assets/photos/hero-dolomites.webp') type('image/webp'),
    url('assets/photos/hero-dolomites.jpeg') type('image/jpeg')
  );
  background-size: cover; background-position: center 55%;
  opacity: 0.22;
  filter: saturate(0.78) contrast(0.95);
  mask-image: linear-gradient(180deg, transparent 0%, black 18%, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 18%, black 70%, transparent 100%);
  pointer-events: none;
}
.hero-grain {
  position: absolute; inset: 0;
  background-image: var(--tex-grain);
  mix-blend-mode: multiply;
  opacity: 0.8;
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 1120px; margin: 0 auto; padding: 0 40px; }
.hero-meta {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 40px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3);
  flex-wrap: wrap;
}
.hero-meta > span { white-space: nowrap; }
.hero-meta .rule {
  flex: 0 0 48px; height: 1px; background: var(--line-2);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(56px, 7.2vw, 96px);
  font-weight: 400; letter-spacing: -0.035em;
  line-height: 0.98;
  max-width: 14ch;
  font-variation-settings: "opsz" 144, "SOFT" 60;
  color: var(--fg-1);
}
.hero-title em {
  font-style: italic; font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  color: var(--brand);
}
.hero-lede {
  margin-top: 28px; font-size: 18px; color: var(--fg-2);
  max-width: 54ch; line-height: 1.58;
  font-family: var(--font-sans);
}
.hero-cta { margin-top: 36px; display: flex; gap: 10px; align-items: center; }
.btn {
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 500;
  padding: 11px 20px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-out);
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand); color: var(--brand-on);
  border-color: var(--brand-press);
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-press); }
.btn-ghost {
  background: transparent; color: var(--fg-1);
  border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--fg-3); background: rgba(0,0,0,0.02); }
[data-theme="dark"] .btn-ghost:hover { background: rgba(255,255,255,0.04); }

/* ==== SECTIONS ==== */
.section { padding: 120px 0; max-width: 1120px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.section-head { margin-bottom: 56px; max-width: 680px; }
.section-head h2 {
  font-size: clamp(36px, 4.4vw, 56px); font-weight: 400;
  letter-spacing: -0.03em; line-height: 1.02; margin-top: 14px;
  font-variation-settings: "opsz" 144, "SOFT" 60;
}
.section-lede { margin-top: 18px; font-size: 17px; color: var(--fg-2); max-width: 56ch; }

/* ==== WORK GRID ==== */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 1px solid var(--line-2); }
.work-card {
  background: transparent;
  border-bottom: 1px solid var(--line-1);
  border-right: 1px solid var(--line-1);
  padding: 36px 36px 32px;
  cursor: pointer;
  transition: background var(--dur-med) var(--ease-out);
  display: flex; flex-direction: column; gap: 18px;
  position: relative;
}
.work-card:nth-child(2n) { border-right: 0; }
.work-card:hover { background: var(--bg-raised); }
.work-card:hover .work-open { color: var(--brand); }
.work-number {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.16em; color: var(--fg-3);
}
.work-title {
  font-family: var(--font-display); font-size: 30px; font-weight: 400;
  letter-spacing: -0.018em; line-height: 1.08;
  color: var(--fg-1);
  font-variation-settings: "opsz" 144, "SOFT" 0;
}
.work-summary { font-size: 14.5px; color: var(--fg-2); line-height: 1.6; max-width: 46ch; }
.work-stats { display: flex; gap: 32px; border-top: 1px solid var(--line-1); padding-top: 16px; }
.work-stat { display: flex; flex-direction: column; gap: 3px; }
.work-stat-k {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3);
}
.work-stat-v {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 17px; font-weight: 500; color: var(--fg-1);
}
.work-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 16px; }
.work-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--fg-2); padding: 2px 0;
  text-transform: uppercase;
}
.tag + .tag::before { content: "· "; color: var(--fg-4); margin-right: 4px; }
.work-open {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-3); transition: color var(--dur-fast) var(--ease-out);
}

/* ==== SHEET ==== */
.sheet-scrim[hidden] { display: none; }
.sheet-scrim {
  position: fixed; inset: 0;
  background: rgba(21, 20, 15, 0.55);
  backdrop-filter: blur(4px);
  z-index: 30; display: flex; justify-content: center; align-items: flex-start;
  padding: 48px 24px; overflow: auto;
  animation: fadeIn 240ms var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--bg-raised);
  background-image: var(--tex-paper); background-blend-mode: multiply;
  border: 1px solid var(--line-1); border-radius: var(--radius-md);
  max-width: 880px; width: 100%;
  padding: 36px 48px 48px;
  box-shadow: var(--shadow-3);
  animation: sheetIn 320ms var(--ease-out);
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-close {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 6px 12px; background: transparent;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  color: var(--fg-2); cursor: pointer;
}
.sheet-close:hover { color: var(--fg-1); border-color: var(--fg-3); }
.sheet-title {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 400; letter-spacing: -0.028em;
  line-height: 1.02; margin-top: 16px;
  font-variation-settings: "opsz" 144, "SOFT" 70;
}
.sheet-lede {
  margin-top: 18px; font-size: 17px; color: var(--fg-2);
  line-height: 1.6; max-width: 640px;
  font-family: var(--font-serif); font-style: italic;
}
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 48px; margin-top: 36px; }
.sheet-grid h4 { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.sheet-grid p { font-size: 14.5px; color: var(--fg-2); line-height: 1.65; margin-top: 8px; font-family: var(--font-sans); }

/* ==== ABOUT ==== */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 64px; align-items: start; }
.about-lede {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 30px; line-height: 1.3; margin-bottom: 24px;
  color: var(--fg-1); font-weight: 400; letter-spacing: -0.005em;
  font-variation-settings: "opsz" 30, "SOFT" 0;
  text-wrap: balance;
  max-width: 32ch;
}
.about-lede em {
  font-style: italic; font-weight: 500;
  color: var(--brand);
  font-variation-settings: "opsz" 30, "SOFT" 0;
}
.about-col p { font-size: 16px; color: var(--fg-2); line-height: 1.7; margin-bottom: 16px; max-width: 58ch; }
.about-col p.dropcap::first-letter {
  font-family: var(--font-display); font-size: 3.2em; line-height: 0.85;
  float: left; padding: 6px 10px 0 0; color: var(--fg-1); font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}
.about-side { display: flex; flex-direction: column; gap: 32px; }
.about-side .photo-frame {
  border: 1px solid var(--line-1);
  padding: 8px 8px 12px;
  background: var(--bg-raised);
  box-shadow: var(--shadow-1);
  transform: rotate(-0.6deg);
}
.about-side .photo-frame img {
  width: 100%; display: block;
  filter: saturate(0.85) contrast(0.98);
}
.about-side .photo-caption {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 8px; text-align: center;
}
.about-block h4 {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3); font-weight: 500; margin-bottom: 14px;
}
.about-block ul { list-style: none; padding: 0; margin: 0; font-size: 14.5px; color: var(--fg-2); }
.about-block li { padding: 10px 0; border-top: 1px solid var(--line-1); display: flex; justify-content: space-between; gap: 16px; }
.about-block li:first-child { border-top: 0; }
.about-block .k { color: var(--fg-1); }
.about-block .v { color: var(--fg-3); font-family: var(--font-mono); font-size: 12px; }

/* ==== CV ==== */
.cv-block { margin-top: 40px; }
.cv-head {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 18px;
}
.cv-row {
  display: grid; grid-template-columns: 110px 1fr;
  gap: 32px; padding: 22px 0;
  border-top: 1px solid var(--line-1);
}
.cv-year {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--fg-3); padding-top: 4px;
  font-variant-numeric: tabular-nums;
}
.cv-role {
  font-family: var(--font-display); font-size: 19px;
  font-weight: 500; color: var(--fg-1);
  letter-spacing: -0.01em;
}
.cv-org { font-size: 13.5px; color: var(--fg-2); margin-top: 3px; }
.cv-note { font-size: 14px; color: var(--fg-3); margin-top: 10px; max-width: 60ch; line-height: 1.6; }
/* German compounds (Rückversicherungsmaklergeschäft) are wider than the phone column.
   min-width keeps them out of the 1fr track's min-content size — without it the long
   word widens the whole grid column and pushes the page past the viewport. */
.cv-body { min-width: 0; }
.cv-role, .cv-org, .cv-note { overflow-wrap: break-word; }

/* ==== FOOTER ==== */
.footer {
  border-top: 1px solid var(--line-1);
  padding: 56px 0 80px; margin-top: 40px;
  background: var(--bg-sunken);
}
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 40px;
  display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 48px;
}
.footer-col h4 {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3); font-weight: 500; margin-bottom: 14px;
}
.footer-col p { font-size: 14px; color: var(--fg-2); line-height: 1.6; max-width: 36ch; }
.footer-col ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.footer-col li { padding: 4px 0; }
.footer-col a { color: var(--fg-1); }
.footer-line { margin-top: 24px; font-size: 13px; color: var(--fg-3); font-family: var(--font-mono); letter-spacing: 0.04em; }
/* the theme control lives here now — a quiet secondary control, not a topbar slot */
.theme-toggle-footer { margin: 14px 0 0; width: 28px; height: 28px; font-size: 13px; }
.footer-wordmark {
  font-family: var(--font-display); font-weight: 400;
  font-size: 28px; letter-spacing: -0.02em; color: var(--fg-1);
  margin-bottom: 8px;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}
.footer-wordmark .dot { color: var(--brand); }

/* ==== FORECASTING PROJECTS (band below selected work) ==== */
.live {
  position: relative;
  padding: 110px 0 96px;
  max-width: 1120px; margin: 0 auto;
  padding-left: 40px; padding-right: 40px;
}
.live-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 24px; margin-top: 8px;
}
.live-card {
  display: flex; flex-direction: column; gap: 18px;
  background: var(--bg-raised);
  background-image: var(--tex-paper); background-blend-mode: multiply;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: 28px 28px 24px;
  text-decoration: none; color: inherit;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
a.live-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
a.live-card:hover .live-go { color: var(--brand-hover); }
.live-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.live-status {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2);
}
.live-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-3); }
.live-title {
  font-family: var(--font-display); font-size: 30px; font-weight: 400;
  letter-spacing: -0.02em; line-height: 1.08; color: var(--fg-1);
  font-variation-settings: "opsz" 144, "SOFT" 0;
}
.live-summary { font-size: 14.5px; color: var(--fg-2); line-height: 1.62; }
.live-stats { display: flex; gap: 28px; flex-wrap: wrap; border-top: 1px solid var(--line-1); padding-top: 16px; margin-top: auto; }
.live-stat { display: flex; flex-direction: column; gap: 3px; }
.live-stat-k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); }
.live-stat-v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 500; color: var(--fg-1); }
.live-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.live-go {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brand); transition: color var(--dur-fast) var(--ease-out);
}

/* work-card / live-card render as <button>/<a> — strip native chrome */
button.work-card { width: 100%; text-align: left; border-top: 0; font: inherit; color: inherit; }

/* ==== ACCESSIBILITY ==== */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: var(--brand-on);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 13px;
}
.skip-link:focus { left: 16px; top: 16px; }

/* ==== RESPONSIVE ==== */
@media (max-width: 880px) {
  .topbar-inner { padding: 14px 22px; }
  .wordmark .initials { display: none; }
  .nav-link { padding: 8px 9px; font-size: 12px; }
  .lang-toggle { margin-left: 6px; padding: 5px 9px; }
  .hero-inner, .section, .live, .hero-grain ~ *, .footer-inner { padding-left: 22px; padding-right: 22px; }
  .section, .live { padding-top: 80px; padding-bottom: 80px; }
  .hero { padding: 140px 0 72px; }
  .live-grid { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .work-card { border-right: 0 !important; padding: 28px 22px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .sheet-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .sheet { padding: 28px 24px 36px; }
  .sheet-title { font-size: 34px; }
}
@media (max-width: 480px) {
  /* keep the whole nav on one line on phones */
  .topbar-inner { padding: 13px 16px; }
  /* the full name costs ~90px the nav needs — it becomes the monogram here */
  .wordmark { font-size: 18px; }
  .wordmark-full { display: none; }
  .wordmark-short { display: inline; }
  .topbar nav { gap: 0; }
  .nav-link { padding: 6px 4px; font-size: 11px; letter-spacing: 0; }
  .lang-toggle { margin-left: 5px; padding: 4px 7px; font-size: 10px; letter-spacing: 0.06em; gap: 4px; }
  .lang-toggle .lang-on::after { margin-left: 4px; }
  .work-stats { gap: 20px; flex-wrap: wrap; }
  .hero-cta { flex-wrap: wrap; }
  .live-stats { gap: 18px; }
  .live-title, .work-title { font-size: 25px; }
  .live-top { flex-wrap: wrap; gap: 8px; }
  .live-foot { flex-wrap: wrap; gap: 10px; }
  .hero-title { font-size: clamp(28px, 8.4vw, 42px); line-height: 1.05; }
  .hero-br { display: none; }
  .section-head h2 { font-size: clamp(26px, 7.6vw, 34px); }
  .sheet-title { font-size: clamp(24px, 7vw, 32px); }
  .about-lede { font-size: clamp(22px, 6.4vw, 28px); }
  /* only this narrow does German need hyphenation — it breaks the long compounds at
     real syllable points instead of mid-word. Not .cv-org: it splits "Guy Car-penter". */
  [lang="de"] .cv-note { hyphens: auto; }
}
/* never allow a long token to push the page wider than the viewport */
.live-title, .work-title, .hero-title, .sheet-title, .section-head h2 { overflow-wrap: break-word; }

/* ==== MOTION PREFERENCES ==== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
