/* Shared chrome for the landing page and every project page: layout, sidebar,
   footer.
   Plain CSS on purpose: this folder has to stay copy-anywhere, with no build
   step and no npm install. Palette follows Tailwind's slate ramp so the index
   and the MetBr app (which is Tailwind) look like one site. */

:root {
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --accent:      #3857ff; /* the blue MetBr plots with */
  --accent-dark: #2438b8;

  --page:    var(--slate-50);
  --surface: #ffffff;
  --border:  var(--slate-200);
  --text:    var(--slate-900);
  --muted:   var(--slate-600);
  --faint:   var(--slate-500);

  --radius: 12px;
  --shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-lift: 0 4px 16px -2px rgb(15 23 42 / 0.10), 0 2px 4px -2px rgb(15 23 42 / 0.06);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* One knob for how wide the reading column is, shared by both page types. */
  --measure: 46rem;
  --sidebar-width: 16.5rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Skip link: keyboard users shouldn't have to tab through the sidebar on every page. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) 0;
  font-size: 0.875rem;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---------- page layout: sidebar + content ---------- */

/* The sidebar is the site's only navigation, so on a wide screen it stays in
   view: a fixed-width column that sticks while the content scrolls past it.
   On a narrow screen it folds into a sticky bar with a "Projects" button. */

.page { min-height: 100vh; }
.page-content { min-width: 0; }

@media (min-width: 960px) {
  .page {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }
}

/* ---------- sidebar ---------- */

.sidebar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

@media (min-width: 960px) {
  .sidebar {
    height: 100vh;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    padding: 2rem 1.25rem 2rem 1.5rem;
    /* A column, so the legal links can sit at the bottom of it. */
    display: flex;
    flex-direction: column;
  }
}

.sidebar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 20px;
}
@media (min-width: 960px) { .sidebar-bar { padding: 0; } }

.brand {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.015em;
  color: var(--slate-900);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.nav-toggle {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}
.nav-toggle:hover { color: var(--accent); border-color: var(--slate-300); }
.nav-toggle::after { content: " \25BE"; }
.nav-open .nav-toggle::after { content: " \25B4"; }

/* Without JavaScript the toggle cannot work, so the list just stays open. */
.nav-toggle { display: none; }
.js .nav-toggle { display: inline-block; }

.project-nav { padding: 0 20px 1rem; }
.js .project-nav { display: none; }
/* Opened on a narrow screen, the list drops over the page rather than pushing
   it down, so the reader keeps their place. */
.js.nav-open .project-nav {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-top: 0.5rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
}

@media (min-width: 960px) {
  .js .nav-toggle { display: none; }
  .project-nav,
  .js .project-nav,
  .js.nav-open .project-nav {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    position: static;
    padding: 2rem 0 0;
    max-height: none;
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: none;
  }
}

.nav-list { list-style: none; margin: 0; padding: 0; }

/* Top-level groups: small caps labels, set apart from each other. */
.nav-depth-0 > .nav-group + .nav-group { margin-top: 1.75rem; }
.nav-depth-0 > .nav-group > .nav-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Subgroups (Wind, Solar PV): a quieter label, items indented under it. */
.nav-depth-1 > .nav-group + .nav-group,
.nav-depth-1 > li + .nav-group { margin-top: 0.75rem; }
.nav-depth-1 > .nav-group > .nav-label {
  display: block;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--slate-700);
}
.nav-depth-2 { margin-left: 0.625rem; border-left: 1px solid var(--border); }

.project-nav a {
  display: block;
  padding: 0.35rem 0.625rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.35;
}
.nav-depth-2 a { border-radius: 0 6px 6px 0; margin-left: -1px; border-left: 2px solid transparent; }
.project-nav a:hover { color: var(--slate-900); background: var(--slate-100); }
.project-nav a[aria-current="page"] {
  color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-weight: 600;
}
.nav-depth-2 a[aria-current="page"] { border-left-color: var(--accent); }

.nav-title { display: block; }
.nav-ext { margin-left: 0.3rem; color: var(--faint); font-size: 0.8em; }
.nav-note { display: block; font-size: 0.75rem; color: var(--faint); }

/* Impressum and Datenschutz: centred at the foot of the sidebar. On a wide
   screen the auto margin pushes them to the bottom of the full-height column;
   on a narrow one they close the "Projects" panel. */
.sidebar-legal {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-top: auto;
  padding-top: 1rem;
}
@media (min-width: 960px) { .sidebar-legal { padding-top: 2rem; } }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- footer ---------- */

.site-footer {
  max-width: var(--measure);
  margin: 4rem auto 0;
  padding: 2rem 20px 3rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ---------- landing page ---------- */

.intro {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 4.5rem 20px 0;
}

.portrait {
  display: block;
  width: 9rem;
  height: 9rem;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 50%;
  border: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.intro .tagline {
  margin: 1rem 0 1.5rem;
  font-size: 1.125rem;
  color: var(--slate-700);
}

.intro p { max-width: 38rem; color: var(--muted); }

@media (min-width: 960px) {
  .intro { padding-inline: 3rem; }
  .site-footer { padding-inline: 3rem; }
}

@media (max-width: 480px) {
  .intro { padding-top: 2.5rem; }
  .portrait { width: 7rem; height: 7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}
