/* gulm.de – gemeinsames Stylesheet (neues Design 2026)
   Ersetzt dateien/css.css. Keine externen Schriften oder Frameworks. */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --text: #1c2230;
  --muted: #5a6273;
  --line: #e1ddd2;
  --accent: #1f6fd1;
  --accent-hover: #175bb0;
  --accent-soft: #e3eefc;
  --brick: #ffbf1f;
  --brick-dark: #8a5d00;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 34, 48, .06), 0 4px 16px rgba(28, 34, 48, .06);
  --shadow-hover: 0 2px 4px rgba(28, 34, 48, .08), 0 10px 28px rgba(28, 34, 48, .12);
  --max: 1160px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --surface: #1b2029;
    --surface-2: #232a35;
    --text: #e9ecf2;
    --muted: #a3abba;
    --line: #2d3542;
    --accent: #5aa2ff;
    --accent-hover: #82b9ff;
    --accent-soft: #1c2c44;
    --brick: #ffc53d;
    --brick-dark: #ffd97a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

/* ---------- Kopfbereich ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-bar { display: flex; align-items: center; gap: 16px; min-height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; margin-right: auto; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.brand-name span { color: var(--accent); }
.brand-claim { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lang { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; flex: none; }
.lang a { display: block; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.lang a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.main-nav ul { list-style: none; margin: 0; padding: 0 0 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.main-nav a {
  display: block;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .15s;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a[aria-current="page"] { background: var(--text); color: var(--bg); }

/* Smartphone: Menü als waagerecht wischbare Leiste */
@media (max-width: 760px) {
  .header-bar { min-height: 56px; }
  .brand-claim { display: none; }
  .main-nav { margin: 0 calc(var(--gutter) * -1); }
  .main-nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    padding: 0 var(--gutter) 10px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .main-nav ul::-webkit-scrollbar { display: none; }
  .main-nav li { scroll-snap-align: start; }
  .main-nav a { padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); }
  .main-nav a[aria-current="page"] { border-color: var(--text); }
}

/* ---------- Inhalt ---------- */

main { flex: 1; padding: clamp(24px, 4vw, 48px) 0 64px; }

.page-head { margin-bottom: clamp(20px, 3vw, 32px); }
.page-head p { color: var(--muted); max-width: 62ch; font-size: 1.05rem; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brick-dark); margin-bottom: .5em; }

.section { margin-top: clamp(36px, 5vw, 56px); }

/* Startseite */
.hero { display: grid; grid-template-columns: 1fr; gap: clamp(20px, 4vw, 48px); align-items: center; }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 56ch; }
.hero-media img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; }
@media (min-width: 900px) { .hero { grid-template-columns: 5fr 6fr; } }

.facts { list-style: none; padding: 0; margin: 0 0 1.5em; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .88rem; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  background: var(--surface); border-radius: var(--radius); padding: 18px 14px 16px; box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; font-weight: 700; transition: transform .15s, box-shadow .15s;
}
.tile img { width: 120px; aspect-ratio: 1; object-fit: contain; }
.tile small { color: var(--muted); font-weight: 500; }
.tile:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-hover); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; font-size: .95rem;
  text-decoration: none; cursor: pointer; transition: background-color .15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Bauteil-Karten (Kategorieseiten) */
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.part {
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .15s;
}
.part:hover { box-shadow: var(--shadow-hover); }
.part-thumb { position: relative; display: block; background: var(--surface-2); }
.part-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .25s; }
.part:hover .part-thumb img { transform: scale(1.04); }
.badge-3d {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); color: var(--text); border-radius: 999px; padding: 3px 10px;
  font-size: .75rem; font-weight: 800; box-shadow: var(--shadow);
}
.part-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; flex: 1; }
.part-body h3 { margin: 0; }
.part-desc { color: var(--muted); font-size: .95rem; }
.part-desc p:last-child { margin-bottom: 0; }
.part-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.part-actions .btn { flex: 1; min-width: 120px; }

/* Smartphone: Vorschaubild links, Text rechts – kompakter beim Scrollen */
@media (max-width: 560px) {
  .parts { gap: 14px; }
  .part { display: grid; grid-template-columns: 104px minmax(0, 1fr); }
  .part-thumb { align-self: start; margin: 12px 0 0 12px; border-radius: var(--radius-sm); overflow: hidden; }
  .part-thumb img { aspect-ratio: 1; }
  .badge-3d { top: 6px; left: 6px; padding: 2px 8px; }
  .part-body { padding: 12px 14px 14px; gap: 8px; }
  .part-body h3 { font-size: 1rem; }
  .part-desc { font-size: .9rem; }
  .part .specs div { padding: 4px 8px; }
  .part .specs dt { font-size: .64rem; }
  .part .specs dd { font-size: .85rem; }
  .part-actions .btn { min-height: 40px; padding: 8px 12px; font-size: .88rem; min-width: 0; white-space: nowrap; }
  .part-actions .btn svg { display: none; }
}

/* Druck-Info */
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; }
.specs div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 10px; }
.specs dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; font-size: .92rem; }

/* Animationen / Bilder „So sieht es aus" */
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.media-grid figure { margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.media-grid img { width: 100%; }

/* Bauteil-Detailseite mit 3D-Ansicht */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }

.detail { display: grid; grid-template-columns: 1fr; gap: clamp(20px, 4vw, 40px); align-items: start; }
@media (min-width: 900px) { .detail { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }

.viewer {
  position: relative; background:
    radial-gradient(circle at 50% 40%, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
/* Der STL-Viewer füllt den Container und passt sich mit auto_resize:true an */
.viewer-stage { width: 100%; aspect-ratio: 1 / 1; max-height: 78vh; touch-action: none; cursor: grab; }
.viewer-stage:active { cursor: grabbing; }
.viewer-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 12px;
  font-size: .8rem; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; pointer-events: none;
}
.viewer-hint .touch { display: none; }
@media (hover: none), (pointer: coarse) {
  .viewer-hint .mouse { display: none; }
  .viewer-hint .touch { display: inline; }
}
.viewer-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 600; pointer-events: none; }
.viewer.is-loaded .viewer-loading { display: none; }

.detail-info { display: flex; flex-direction: column; gap: 18px; }
.detail-info h1 { margin: 0; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); }
.panel { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }

/* Kontaktformular */
.form { display: grid; gap: 16px; max-width: 640px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .95rem; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 180px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.captcha { display: flex; align-items: center; gap: 12px; }
.captcha img { width: 90px; height: 33px; border-radius: 6px; border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }
.captcha input { max-width: 140px; }

/* ---------- Fußbereich ---------- */

.site-footer { border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

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

/* Formular: Hinweise und Fehler */
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 600; }
.notice-error { background: #fdecea; color: #a1261b; }
.notice-ok { background: #e7f6ec; color: #1d6b39; }
.field.is-invalid label { color: #c62f22; }
.field.is-invalid input, .field.is-invalid textarea { border-color: #c62f22; }
@media (prefers-color-scheme: dark) {
  .notice-error { background: #3a1d1b; color: #ffb4ab; }
  .notice-ok { background: #173323; color: #9be0b1; }
  .field.is-invalid label { color: #ff8a80; }
  .field.is-invalid input, .field.is-invalid textarea { border-color: #ff8a80; }
}
