/* ucsite: one hand-written stylesheet, no framework. */

:root {
  --bg: #fbfaf7;
  --bg-alt: #f2f0ea;
  --fg: #1c1d1f;
  --muted: #5d6066;
  --line: #dedbd2;
  --accent: #1f5f8b;
  --accent-fg: #ffffff;
  --radius: 10px;
  --max: 70rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

/* Dark palette: by system preference unless the visitor chose light, or when
   the visitor chose dark (see static/js/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131416;
    --bg-alt: #1b1c1f;
    --fg: #e8e6e1;
    --muted: #a2a5ab;
    --line: #2d2f33;
    --accent: #7db6dd;
    --accent-fg: #0d1114;
  }
}
:root[data-theme="dark"] {
  --bg: #131416;
  --bg-alt: #1b1c1f;
  --fg: #e8e6e1;
  --muted: #a2a5ab;
  --line: #2d2f33;
  --accent: #7db6dd;
  --accent-fg: #0d1114;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.15em; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0.2em 0 0.3em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 0.4em; }
h3 { font-size: 1.15rem; margin: 0 0 0.4em; }

.container { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  z-index: 10;
}
.skip-link:focus { left: 0.5rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 3.6rem; }
.brand { font-weight: 650; color: var(--fg); text-decoration: none; margin-right: auto; }
.nav, .lang-switch { display: flex; gap: 1rem; font-size: 0.95rem; }
.nav a, .lang-switch a { color: var(--muted); text-decoration: none; }
.nav a:hover, .lang-switch a:hover { color: var(--fg); }
.lang-switch { gap: 0.5rem; font-family: var(--mono); font-size: 0.85rem; }
.lang-switch a[aria-current="page"] { color: var(--fg); font-weight: 700; }

/* Theme switch: shows the moon in light mode and the sun in dark mode */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--muted); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 46rem) {
  .nav { display: none; }
}

/* Sections */
.section { padding: 4.5rem 0; }
.section-alt { background: var(--bg-alt); }
.lead { color: var(--muted); max-width: 42rem; margin-top: 0; }

/* Hero */
.hero { padding: 5rem 0 4rem; }
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: center; }
.eyebrow { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; margin: 0; }
.tagline { font-size: 1.2rem; max-width: 38rem; }
.hero-note { color: var(--muted); font-size: 0.95rem; }
.portrait { width: 17rem; aspect-ratio: 1; object-fit: cover; border-radius: 50%; }

@media (max-width: 46rem) {
  .hero-inner { grid-template-columns: 1fr; }
  .portrait { width: 10rem; order: -1; }
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 1rem; }
.button {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button-secondary { background: transparent; color: var(--accent); }
.button[disabled] { opacity: 0.6; cursor: wait; }

/* Expertise cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin-top: 2rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; background: var(--bg); }
.card p { margin: 0; color: var(--muted); }

/* Case studies */
.case-study { border-top: 1px solid var(--line); padding: 2rem 0; display: grid; grid-template-columns: 18rem 1fr; gap: 2rem; }
.case-study:first-of-type { margin-top: 1.5rem; }
.case-study .summary { color: var(--muted); margin: 0; }
.case-study .prose p { margin-top: 0; }
.case-links { list-style: none; padding: 0; margin: 0.8rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
.tags { list-style: none; padding: 0; margin: 0.8rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li { font-family: var(--mono); font-size: 0.75rem; border: 1px solid var(--line); border-radius: 99px; padding: 0.1rem 0.6rem; color: var(--muted); }

@media (max-width: 46rem) {
  .case-study { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* Publications */
.publications { padding-left: 1.2rem; }
.publications li { margin-bottom: 1rem; }
.publications .meta { display: block; color: var(--muted); font-size: 0.95rem; }

/* About */
.about { display: grid; grid-template-columns: 1fr 20rem; gap: 3rem; align-items: center; }
.upside-down { font-weight: 600; }
.about-photo { border-radius: var(--radius); object-fit: cover; }

@media (max-width: 46rem) {
  .about { grid-template-columns: 1fr; }
}

/* Booking */
.booking-days, .booking-times { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.booking-days button, .booking-times button {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
.booking-days button[aria-pressed="true"], .booking-times button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}
.booking-tz { color: var(--muted); font-size: 0.9rem; }
.booking-form { display: grid; gap: 1rem; max-width: 32rem; }
.booking-form label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.95rem; }
.booking-form input, .booking-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}
.booking-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.booking-status { font-weight: 600; }

/* Contact & footer */
.contact-email { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 600; }
.links { list-style: none; padding: 0; display: flex; gap: 1.2rem; }
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: 0.9rem; }

.not-found { min-height: 50vh; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Gated actions (CV download, e-mail): the upside-down check */
.gate-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  padding: 1.6rem;
  width: min(26rem, calc(100vw - 2rem));
  text-align: center;
}
.gate-dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.gate-dialog .gate-why { font-size: 0.85rem; margin-top: 0; }
.gate-dialog h2 { margin: 0 0 0.4rem; font-size: 1.3rem; }
.gate-dialog p { margin: 0.4rem 0; color: var(--muted); }
.gate-figure {
  width: 12rem;
  height: auto;
  overflow: visible;
  margin: 0.5rem auto;
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.gate-figure:active { cursor: grabbing; }
.gate-figure line, .gate-figure circle {
  stroke: var(--fg);
  stroke-width: 6;
  stroke-linecap: round;
  fill: none;
}
.gate-figure .gate-ground { stroke: var(--line); stroke-width: 3; }
.gate-figure .gate-ghost { opacity: 0; transition: opacity 0.3s; }
.gate-figure .gate-ghost.show { opacity: 0.85; }
.gate-figure .gate-ghost.near { opacity: 0.45; }
.gate-figure .gate-ghost line, .gate-figure .gate-ghost circle {
  stroke: var(--accent);
  stroke-width: 6;
  stroke-dasharray: 0.1 11;
}
.gate-figure .gate-ghost.near line, .gate-figure .gate-ghost.near circle { stroke-dasharray: none; }
@media (prefers-reduced-motion: reduce) {
  .gate-figure .gate-ghost { transition: none; }
}
.gate-figure:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.gate-status { min-height: 1.6em; color: var(--accent); font-weight: 600; }
.gate-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 0.6rem; }
