/* ==========================================================================
   Khim Architektur, Luzern — Stylesheet
   Farben & Typografie aus dem Original-Layout übernommen.
   ========================================================================== */

:root {
  --bg:          #F5F4F0;  /* Seitenhintergrund (warmes Off-White) */
  --ink:         #161616;  /* Text, fast schwarz */
  --muted:       #5E5E5A;  /* Sekundärtext */
  --muted-2:     #3A3A37;  /* etwas dunkler, z. B. Impressum */
  --line:        #CFCDC6;  /* feine Trennlinien */
  --line-strong: #161616;  /* starke Trennlinie */
  --placeholder: #E3E1DA;  /* Bild-Platzhalter */
  --hover:       #5E5E5A;  /* Link-Hover */
  --water:       #CFE4F2;  /* Kartenwasser (hellblau) */

  --maxw:   1200px;
  --gutter: clamp(20px, 5vw, 40px);

  --fs-base: 17px;

  /* Schriften: Titel & Logo = Apertura (Adobe Fonts), Lauftext & Buttons = Mallanna */
  --font-head: "apertura", system-ui, -apple-system, Segoe UI, sans-serif;
  --font-body: "Mallanna", system-ui, -apple-system, Segoe UI, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;   /* verhindert horizontales Scrollen durch Full-Bleed-Elemente */
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--hover); }

h1, h2, h3 { font-weight: 400; letter-spacing: -0.02em; }

/* Titel & Logo in Apertura */
h1, h2, h3,
.eyebrow,
.brand__name, .brand__tag,
.h1, .detail-title,
.person__name {
  font-family: var(--font-head);
}

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

/* ---------- Layout-Container ---------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Full-Bleed: volle Browserbreite mit --gutter Abstand (max. 40px).
   Bei schmalem Browser deckt sich der Abstand mit dem Inhalt. */
.bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  box-sizing: border-box;
}

.page { min-height: 100vh; display: flex; flex-direction: column; }
.page > .wrap { flex: 1 0 auto; }

/* ---------- Kopfzeile / Navigation --------------------------------------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 32px;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 16px; }
.brand__name { font-size: 52px; line-height: 1; letter-spacing: -0.02em; }
.brand__tag  { font-size: 15px; color: var(--muted); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font-size: 15px;
}
.nav a { padding: 10px 0; }
.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* ---------- Fusszeile ----------------------------------------------------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 28px 0 40px;
  margin-top: 56px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* ---------- Typo-Hilfen --------------------------------------------------- */
.eyebrow {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lead { font-size: clamp(19px, 2.4vw, 22px); line-height: 1.5; }

.h1 { margin: 0; font-size: clamp(30px, 6vw, 44px); line-height: 1.14; }

/* ---------- Bild-Platzhalter & Figuren ----------------------------------- */
.ph {
  background: var(--placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 12px;
}
.ph--plan { background: #fff; border: 1px solid var(--line); }

.media { display: block; width: 100%; }
.media img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Seitenverhältnisse */
.ar-16-8  { aspect-ratio: 16 / 8; }
.ar-16-9  { aspect-ratio: 16 / 9; }
.ar-4-3   { aspect-ratio: 4 / 3; }
.ar-4-5   { aspect-ratio: 4 / 5; }

/* ---------- Startseite ---------------------------------------------------- */
.hero { padding: 40px 0 0; }

.intro {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 64px;
  padding: 56px 0 72px;
  border-bottom: 1px solid var(--line);
}
.intro .h1 { flex: 1 1 320px; }
.intro .lead { flex: 2 1 480px; margin: 0; max-width: 680px; }

.section { padding: 56px 0 80px; }
.section__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}
.section__head a { font-size: 15px; text-decoration: underline; text-underline-offset: 4px; padding: 10px 0; }

/* Projekt-Kacheln */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px 32px;
}
.card { display: flex; flex-direction: column; gap: 14px; }
.card__title { }
.card__meta { font-size: 15px; color: var(--muted); }

/* ---------- Projekte-Liste (Werkliste) ----------------------------------- */
.proj-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 64px;
  align-items: baseline;
  margin-bottom: 40px;
}
.proj-head .h1 { flex: 1 1 280px; }
.proj-head p { flex: 2 1 480px; margin: 0; max-width: 640px; font-size: clamp(18px,2.2vw,20px); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.filter {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  border: 1px solid #A9A69E;
}
.filter[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.table-scroll { }
.werkliste {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
.werkliste thead th {
  text-align: left;
  padding: 12px 16px 12px 0;
  font-weight: 400;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.werkliste tbody td {
  padding: 14px 16px 14px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.werkliste td.jahr { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.werkliste td.projekt a { text-decoration: underline; text-underline-offset: 4px; }
.werkliste td.leistung { color: var(--muted); }

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
  cursor: pointer;
}

.note { margin: 20px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Projekt-Detailseite ------------------------------------------ */
.back-link { display: inline-block; font-size: 15px; color: var(--muted); padding: 10px 0; }
.detail-title { margin: 16px 0 32px; font-size: clamp(32px,6vw,44px); line-height: 1.12; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 40px 72px;
  padding: 56px 0 64px;
}
.detail-meta dl {
  flex: 1 1 280px;
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  font-size: 15px;
  align-content: start;
}
.detail-meta dt { color: var(--muted); }
.detail-meta dd { margin: 0; }
.detail-text {
  flex: 2 1 480px;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: clamp(17px,2vw,19px);
  line-height: 1.6;
}
.detail-text p { margin: 0; }

.gallery-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.gallery-2 + .media { margin-top: 24px; }

.proj-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--ink);
  font-size: 15px;
}
.proj-nav a { padding: 10px 0; }

/* ---------- Büro ---------------------------------------------------------- */
.band {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 64px;
  padding: 56px 0 64px;
  border-bottom: 1px solid var(--line);
}
.band:first-child { padding-top: 0; }
.band__label { flex: 1 1 280px; margin: 0; }
.band__body  { flex: 2 1 480px; max-width: 680px; display: flex; flex-direction: column; gap: 18px; font-size: clamp(17px,2vw,19px); line-height: 1.6; }
.band__body p { margin: 0; }
.band--last { border-bottom: 0; }

.leistungen {
  flex: 2 1 480px;
  max-width: 680px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 32px;
}
.leistungen li { padding: 12px 0; border-bottom: 1px solid var(--line); }

.person { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.person__photo { flex: 1 1 260px; max-width: 360px; }
.person__photo img { display: block; width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: 50% 30%; }
.person__body { flex: 2 1 480px; max-width: 680px; display: flex; flex-direction: column; gap: 16px; }
.person__name { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.person__role { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.person__body p { margin: 0; }

/* ---------- Kontakt ------------------------------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px 32px;
  font-size: clamp(17px,2vw,19px);
}
.contact-grid address { font-style: normal; }
.contact-grid a { text-decoration: underline; text-underline-offset: 4px; padding: 4px 0; }
.impressum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px 32px;
  font-size: 15px;
  color: var(--muted-2);
}
.impressum-grid a { color: var(--muted-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Karte --------------------------------------------------------- */
.map-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 64px;
  align-items: baseline;
  margin-bottom: 32px;
}
.map-head .eyebrow { flex: 1 1 280px; }
.map-head p { flex: 2 1 480px; margin: 0; max-width: 680px; font-size: clamp(17px,2vw,19px); }

.map {
  position: relative;
  width: 100%;
  aspect-ratio: 1120 / 900;
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}
@media (max-width: 640px) { .map { aspect-ratio: 3 / 4; } }

.map .maplibregl-canvas { outline: none; }

/* Büro-Marker (klassischer Pin) */
.khim-marker { width: 30px; height: 30px; display: block; cursor: default; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.3)); }
.khim-label {
  margin-bottom: 3px;
  font-size: 14px;
  color: var(--ink);
  background: rgba(241,239,234,0.92);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
}

/* Projekt-Punkte: dezent, bei Hover/Fokus hervorgehoben */
.proj-dot {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; padding: 0; cursor: pointer;
  border-radius: 50%;
}
.proj-dot::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.38;
  box-shadow: 0 0 0 2px rgba(241,239,234,0.9);
  transition: opacity .15s ease, width .15s ease, height .15s ease;
}
.proj-dot:hover::before,
.proj-dot:focus-visible::before,
.proj-dot.is-active::before {
  opacity: 1;
  width: 14px; height: 14px;
}

/* Tooltip (MapLibre Popup, eigenes Styling) */
.maplibregl-popup.khim-pop .maplibregl-popup-content {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(22,22,22,0.12);
  padding: 10px 14px;
  border-radius: 0;
  font-family: inherit;
  min-width: 150px;
}
.maplibregl-popup.khim-pop .maplibregl-popup-tip { display: none; }
.khim-pop__town { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.khim-pop__item { font-size: 16px; line-height: 1.35; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}
.map-legend .leg { display: flex; align-items: center; gap: 10px; }
.map-legend .attrib { margin-left: auto; }
.map-legend .attrib a { color: var(--muted); text-decoration: underline; }

/* ---------- Abstände kleiner Screens ------------------------------------- */
@media (max-width: 640px) {
  .section { padding: 44px 0 56px; }
  .intro { padding: 40px 0 48px; }
  .band { padding: 40px 0 44px; }
  .detail-meta { padding: 40px 0 44px; }
}

/* ---------- Werkliste: Karten-Layout auf schmalen Screens ---------------- */
@media (max-width: 720px) {
  .werkliste thead { display: none; }
  .werkliste, .werkliste tbody, .werkliste tr, .werkliste td { display: block; width: auto; }
  .werkliste tr { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .werkliste tbody td { border: 0; padding: 1px 0; }
  .werkliste td.projekt { font-size: 18px; margin-bottom: 4px; }
  .werkliste td.jahr,
  .werkliste td.ort,
  .werkliste td.art,
  .werkliste td.leistung { font-size: 15px; color: var(--muted); }
  .werkliste td:not(.projekt)::before { content: attr(data-label) ": "; }
}
