/* ==========================================================================
   membrezweiler.com
   Shared stylesheet. No build step, no dependencies.
   ========================================================================== */

:root {
  --paper:        #fbfaf7;
  --surface:      #ffffff;
  --surface-alt:  #f4f2ec;
  --ink:          #16181c;
  --text:         #33363d;
  --muted:        #6a7079;
  --rule:         #e3e0d8;
  --rule-strong:  #cdc9be;
  --accent:       #2b5468;
  --accent-soft:  #eaf0f3;
  --accent-text:  #1c3d4c;
  --warn:         #8a5a1c;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --measure: 68ch;
  --wide: 1120px;
  --gutter: 24px;

  --radius: 4px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 6px 20px rgba(20, 24, 28, .05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:       #121417;
    --surface:     #1a1d21;
    --surface-alt: #1f2328;
    --ink:         #eceef1;
    --text:        #c6cad1;
    --muted:       #949aa3;
    --rule:        #2b3036;
    --rule-strong: #3b424a;
    --accent:      #8fbccf;
    --accent-soft: #1c272d;
    --accent-text: #a9cddc;
    --warn:        #d3a25f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
  }
}

:root[data-theme="dark"] {
  --paper:       #121417;
  --surface:     #1a1d21;
  --surface-alt: #1f2328;
  --ink:         #eceef1;
  --text:        #c6cad1;
  --muted:       #949aa3;
  --rule:        #2b3036;
  --rule-strong: #3b424a;
  --accent:      #8fbccf;
  --accent-soft: #1c272d;
  --accent-text: #a9cddc;
  --warn:        #d3a25f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
}

/* --- reset ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

/* --- typography ----------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.1vw, 1.9rem); margin-top: 0; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; font-family: var(--sans); font-weight: 650; letter-spacing: .005em; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  text-decoration-color: var(--rule-strong);
  transition: text-decoration-color .15s ease, color .15s ease;
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong { color: var(--ink); font-weight: 650; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: .4em; }
li:last-child { margin-bottom: 0; }

blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 1.2em;
  border-left: 2px solid var(--rule-strong);
  font-family: var(--serif);
  font-size: 1.08rem;
  color: var(--ink);
}

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--surface-alt);
  padding: .12em .35em;
  border-radius: 3px;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

/* --- layout --------------------------------------------------------------- */

.wrap {
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose { max-width: var(--measure); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .7em 1.1em;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* --- site header ---------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 74px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
  white-space: nowrap;
  margin-right: auto;
}
.brand:hover { color: var(--accent-text); }
.brand span { display: block; font-family: var(--sans); font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }

.site-nav { display: flex; align-items: center; gap: 1.35rem; flex-wrap: wrap; }
.site-nav a {
  font-size: .93rem;
  color: var(--text);
  text-decoration: none;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex: none;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon,
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

@media (max-width: 720px) {
  .site-header { position: static; }
  .site-header .wrap { padding-block: 14px; min-height: 0; gap: .75rem 1rem; }
  .brand { order: 1; flex: 1 1 auto; margin-right: 0; }
  .theme-toggle { order: 2; }
  .site-nav { order: 3; gap: .3rem 1rem; width: 100%; }
  .site-nav a { font-size: .88rem; }
}

/* --- page head ------------------------------------------------------------ */

.page-head {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.page-head .eyebrow {
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
  font-weight: 650;
  margin: 0 0 .9rem;
}
.page-head h1 { margin-bottom: .45em; }
.page-head .lede {
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1rem + .4vw, 1.25rem);
  color: var(--text);
  max-width: var(--measure);
  margin: 0;
}

section { scroll-margin-top: 96px; }

.section { padding: 3.25rem 0; border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }
.section > .wrap > h2 { margin-bottom: 1.2rem; }

.section-intro { max-width: var(--measure); margin-bottom: 2rem; }

.rule-label {
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.4rem;
}
.rule-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* --- home hero ------------------------------------------------------------ */

.hero { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--rule); }
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 3.5rem;
  align-items: start;
}
.hero h1 { margin-bottom: .3em; }
.hero .title-line {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--accent-text);
  margin: 0 0 1.5rem;
}
.hero .prose { font-size: 1.04rem; }
.portrait {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 22%;
}
.portrait-caption {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .8rem;
  line-height: 1.5;
}
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 2rem; }
  .portrait { max-width: 200px; aspect-ratio: 1 / 1; object-position: 50% 18%; }
}

.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .92rem;
  font-weight: 550;
  padding: .6rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .btn-primary,
.btn-primary { color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #10171b; }
}
:root[data-theme="dark"] .btn-primary { color: #10171b; }
.btn-primary:hover { background: var(--accent-text); border-color: var(--accent-text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary:hover { background: var(--accent-text); }
}
.btn svg { width: 15px; height: 15px; flex: none; }

/* --- cards and grids ------------------------------------------------------ */

.grid { display: grid; gap: 1.5rem; align-items: start; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.6rem 1.7rem;
}
.panel h3 { margin-bottom: .5rem; }
.panel p { font-size: .96rem; }
.panel p:last-child { margin-bottom: 0; }

.stream { border-top: 3px solid var(--accent); }

/* --- publication and project entries -------------------------------------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 1.6rem;
  margin: 0;
}
.entry:first-child { padding-top: 0; }
.entry:last-child { border-bottom: 0; }
.entry .year {
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: .12rem;
}
.entry .entry-title {
  font-family: var(--serif);
  font-size: 1.16rem;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 .35rem;
  line-height: 1.32;
}
.entry .meta { font-size: .94rem; color: var(--muted); margin: 0 0 .6rem; }
.entry .meta em { font-style: italic; color: var(--text); }
.entry .summary { font-size: .96rem; margin: 0 0 .7rem; max-width: var(--measure); }
.entry .links { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .88rem; margin: 0; }

@media (max-width: 600px) {
  .entry { grid-template-columns: 1fr; gap: .5rem; }
  .entry .year { font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; padding-top: 0; }
}

.tag {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 650;
  padding: .2rem .5rem;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid transparent;
  vertical-align: 2px;
  margin-left: .5rem;
}
.tag-neutral { background: var(--surface-alt); color: var(--muted); }
.tag-open { background: transparent; border-color: var(--rule-strong); color: var(--muted); }

/* --- course listing ------------------------------------------------------- */

.course-group { margin-bottom: 3rem; }
.course-group:last-child { margin-bottom: 0; }

.course {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1rem;
}
.course:last-child { margin-bottom: 0; }
.course h3 { margin-bottom: .3rem; font-size: 1.12rem; }
.course .course-meta {
  font-size: .85rem;
  color: var(--muted);
  margin: 0 0 .7rem;
}
.course p { font-size: .96rem; margin-bottom: .7rem; }
.course p:last-child { margin-bottom: 0; }
.course .course-links { font-size: .88rem; }

/* --- lab repository ------------------------------------------------------- */

.lab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  align-items: center;
  padding: 1rem 0 1.6rem;
}
.lab-controls label { font-size: .85rem; color: var(--muted); }
.lab-search {
  flex: 1 1 260px;
  font: inherit;
  font-size: .95rem;
  padding: .55rem .8rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.filter-set { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-btn {
  font: inherit;
  font-size: .85rem;
  padding: .45rem .85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.filter-btn:hover { border-color: var(--accent); }
.filter-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .filter-btn[aria-pressed="true"] { color: #10171b; }
}
:root[data-theme="dark"] .filter-btn[aria-pressed="true"] { color: #10171b; }

.lab-count { font-size: .85rem; color: var(--muted); margin: 0 0 1.4rem; }

.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.lab {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
  transition: border-color .15s ease, transform .15s ease;
}
.lab:hover { border-color: var(--rule-strong); }
.lab .lab-course {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--muted);
}
.lab h3 { font-size: 1.05rem; margin: 0; }
.lab h3 a { color: var(--ink); text-decoration: none; }
.lab h3 a:hover { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--rule-strong); }
.lab p { font-size: .9rem; color: var(--text); margin: 0; flex: 1; }
.lab .lab-open {
  font-size: .85rem;
  font-weight: 550;
  margin-top: .25rem;
}
.lab[hidden] { display: none; }

.no-results {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}

/* --- notes and callouts --------------------------------------------------- */

.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 1.1rem 1.3rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .95rem;
  margin: 1.8rem 0;
  max-width: var(--measure);
}
.note p:last-child { margin-bottom: 0; }
.note strong { color: var(--accent-text); }

.definition-list { margin: 0; }
.definition-list dt {
  font-weight: 650;
  color: var(--ink);
  font-size: .95rem;
  margin-top: 1.1rem;
}
.definition-list dt:first-child { margin-top: 0; }
.definition-list dd { margin: .25rem 0 0; font-size: .96rem; }

/* --- contact strip -------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.5rem 2.5rem;
}
.contact-grid h4 { margin-bottom: .25rem; color: var(--muted); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }
.contact-grid p { font-size: .96rem; margin: 0; }

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

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 2.5rem 0 3.5rem;
  font-size: .9rem;
  color: var(--muted);
  background: var(--surface-alt);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: flex-start;
}
.site-footer a { color: var(--text); }
.site-footer .footer-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.site-footer p { margin: 0 0 .4rem; }

/* --- utilities ------------------------------------------------------------ */

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

@media print {
  .site-header, .site-footer, .theme-toggle, .lab-controls { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { text-decoration: none; color: #000; }
}
