/* =====================================================================
   mechanische-tastatur.de - Stylesheet
   Aesthetik: Werkstatt der Keyboard-Szene. Warmes Papier + Kohle-Ink,
   ein Honig-Amber-Akzent (Anspielung an beige/Honey-Keycaps).
   Interaktion: Kacheln reagieren wie gedrueckte Switches.
   ===================================================================== */

/* ---------- Fonts (lokal, DSGVO) ---------- */
@font-face {
  font-family: 'Space Grotesk';
  src: url('/assets/fonts/space-grotesk-variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-latin.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-latin-ext.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Design-Tokens ---------- */
:root {
  --paper:      #F4F1EA;
  --paper-2:    #FBFAF5;
  --ink:        #1B1B20;
  --ink-soft:   #4C4A50;
  --ink-faint:  #7A7780;
  --line:       #E3DDD1;
  --line-2:     #D6CFBF;
  --accent:     #B0701F;   /* Honig-Amber */
  --accent-deep:#8A5514;
  --accent-soft:#F3E4CC;
  --key-top:    #ECE6DA;
  --key-side:   #C7BEAC;
  --ok:         #3F7D53;

  --wrap: 1180px;
  --radius: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --sp-1: 8px; --sp-2: 16px; --sp-3: 24px; --sp-4: 32px;
  --sp-5: 48px; --sp-6: 64px; --sp-7: 96px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--ink);
}

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

.skiplink {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 12px 18px; z-index: 100;
}
.skiplink:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding-block: 18px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-key { display: inline-flex; flex: none; transition: transform .35s var(--ease); }
.brand:hover .brand-key { transform: translateY(-2px); }
.brand-text {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.28rem;
  letter-spacing: -0.02em; color: var(--ink);
}
.brand-dot { color: var(--accent); }
.brand-claim {
  font-size: 0.82rem; color: var(--ink-faint); letter-spacing: 0.01em;
  border-left: 2px solid var(--line-2); padding-left: 14px;
}

/* ---------- Nav ---------- */
.site-nav { background: var(--ink); position: sticky; top: 0; z-index: 50; }
.site-nav .wrap { padding-inline: var(--sp-3); }
.site-nav ul {
  list-style: none; display: flex; gap: 2px; padding: 0;
  overflow-x: auto; scrollbar-width: none;
}
.site-nav ul::-webkit-scrollbar { display: none; }
.site-nav a {
  display: block; white-space: nowrap; text-decoration: none;
  color: #D9D4C9; font-size: 0.92rem; font-weight: 500;
  padding: 13px 15px; border-bottom: 2px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.site-nav a:hover { color: #fff; }
.site-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); }

/* ---------- Article-Tabs ---------- */
.article-tabs { background: var(--paper-2); border-bottom: 1px solid var(--line); }
.article-tabs ul { list-style: none; display: flex; gap: var(--sp-3); padding: 0; }
.article-tabs a {
  display: block; padding: 10px 2px; font-size: 0.85rem; color: var(--ink-faint);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.article-tabs a.cur { color: var(--ink); border-bottom-color: var(--ink); }
.article-tabs a:hover { color: var(--accent); }

/* ---------- Main-Layout ---------- */
main { padding-block: var(--sp-5); }
main.layout, main.article-only { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--sp-3); }
main.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-5);
  align-items: start;
}
main.article-only { max-width: 940px; }
.article { min-width: 0; }
.article > p, .article > ul, .article > ol, .article > h2, .article > h3,
.article > .fact, .article > figure, .article > .disclaimer { max-width: 68ch; }

/* ---------- Typografie ---------- */
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700; margin-bottom: var(--sp-2); }
h2 { font-size: clamp(1.5rem, 3vw, 1.95rem); margin-top: var(--sp-5); margin-bottom: var(--sp-2); }
h3 { font-size: 1.25rem; margin-top: var(--sp-4); margin-bottom: var(--sp-1); }
p { margin-bottom: var(--sp-2); color: var(--ink-soft); }
.article p, .article li { color: var(--ink-soft); }
.article strong, .article b { color: var(--ink); font-weight: 700; }
.lead { font-size: 1.16rem; color: var(--ink); line-height: 1.6; margin-bottom: var(--sp-3); }
.meta-row { font-size: 0.9rem; color: var(--ink-faint); margin-bottom: var(--sp-3); }
.article ul, .article ol { margin: 0 0 var(--sp-2) 1.2em; }
.article li { margin-bottom: 6px; }
.article a:not(.btn):not(.kapitel):not(.usecase) {
  color: var(--accent-deep); text-decoration: underline;
  text-decoration-color: var(--accent-soft); text-underline-offset: 2px;
  transition: text-decoration-color .2s;
}
.article a:not(.btn):not(.kapitel):not(.usecase):hover { text-decoration-color: var(--accent); }
sup.ref a { text-decoration: none; color: var(--accent-deep); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1rem;
  padding: 14px 24px; border-radius: 10px; cursor: pointer; border: 0;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 3px 0 var(--accent-deep);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--accent-deep); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--accent-deep); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* ---------- HERO (Hub) ---------- */
.hero { padding: var(--sp-5) 0 var(--sp-4); }
.hero-kicker {
  font-family: 'Space Grotesk', sans-serif; text-transform: uppercase;
  letter-spacing: 0.16em; font-size: 0.78rem; font-weight: 600; color: var(--accent-deep);
  margin-bottom: var(--sp-2);
}
.hero h1 { font-size: clamp(2.3rem, 6vw, 4rem); max-width: 16ch; }
.hero-sub { font-size: 1.2rem; color: var(--ink-soft); max-width: 56ch; margin-block: var(--sp-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.hero .fade-up { opacity: 0; transform: translateY(14px); animation: fadeUp .7s var(--ease) forwards; }
.hero .fade-up:nth-child(1){ animation-delay:.02s } .hero .fade-up:nth-child(2){ animation-delay:.10s }
.hero .fade-up:nth-child(3){ animation-delay:.18s } .hero .fade-up:nth-child(4){ animation-delay:.26s }
.hero .fade-up:nth-child(5){ animation-delay:.34s }
.hero-media { margin-top: var(--sp-4); }
.hero-media img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 14px 34px -14px rgba(27,27,32,0.30); }
@keyframes fadeUp { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hero .fade-up { animation: none; opacity: 1; transform: none; } }

/* ---------- Section-Kopf ---------- */
.section { padding-block: var(--sp-4); }
.section-head { margin-bottom: var(--sp-3); }
.section-head h2 { margin-top: 0; }
.section-head p { max-width: 60ch; }

/* ---------- Use-Case-Kacheln (verhalten sich wie Switches) ---------- */
.usecases {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-2);
}
.usecase {
  display: block; text-decoration: none; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-3); box-shadow: 0 2px 0 var(--line-2);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.usecase:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--line-2); border-color: var(--line-2); }
.usecase:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--line-2); }
.usecase-tag {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-deep);
}
.usecase h3 { margin: 8px 0 6px; font-size: 1.18rem; }
.usecase p { font-size: 0.95rem; margin: 0; color: var(--ink-soft); }
.usecase .pick { display: block; margin-top: 12px; font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.usecase .pick b { color: var(--accent-deep); }

/* ---------- Themen-Cluster ---------- */
.clusters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--sp-2);
}
.kapitel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-2); margin-block: var(--sp-3); }
.kapitel, .cluster-card {
  position: relative; display: block; text-decoration: none;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-3);
  box-shadow: 0 2px 0 var(--line-2);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.kapitel:hover, .cluster-card:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--line-2); }
.kapitel:active, .cluster-card:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--line-2); }
.kapitel h3, .cluster-card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.kapitel p, .cluster-card p { margin: 0; font-size: 0.95rem; color: var(--ink-soft); }
.kapitel .arrow, .cluster-card .arrow { color: var(--accent); font-weight: 700; float: right; transition: transform .25s var(--ease); }
.kapitel:hover .arrow, .cluster-card:hover .arrow { transform: translateX(3px); }

/* ---------- Spec-Chip (Mono, technische Werte) ---------- */
.spec {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.85em; background: var(--accent-soft); color: var(--accent-deep);
  padding: 1px 7px; border-radius: 5px; white-space: nowrap; font-weight: 600;
}

/* ---------- Fact / Hinweis-Box ---------- */
.fact, .disclaimer {
  display: flex; gap: 14px; background: var(--paper-2);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: var(--sp-3); margin-block: var(--sp-3);
}
.fact-icon {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: grid; place-items: center;
}
.fact p, .disclaimer p { margin: 4px 0 0; }

/* ---------- Affiliate-Hinweis (aufklappbar) ---------- */
.affiliate-note {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; margin-bottom: var(--sp-3); font-size: 0.9rem;
}
.affiliate-note summary { cursor: pointer; color: var(--ink); font-weight: 600; list-style: none; }
.affiliate-note summary::-webkit-details-marker { display: none; }
.affiliate-note summary::before { content: "i"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700; margin-right: 8px; font-style: italic; }
.affiliate-note[open] summary { margin-bottom: 8px; }
.affiliate-note p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; margin-block: var(--sp-3); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { font-family: 'Space Grotesk', sans-serif; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); border-bottom: 2px solid var(--line-2); }
table.data tbody tr:hover { background: var(--paper-2); }

/* ---------- FAQ ---------- */
.faq dl { margin-top: var(--sp-2); }
.faq dt { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.08rem; color: var(--ink); margin-top: var(--sp-3); }
.faq dd { margin: 6px 0 0; color: var(--ink-soft); }

/* ---------- Figure ---------- */
figure { margin-block: var(--sp-3); }
figure img { border-radius: 10px; border: 1px solid var(--line); }
figcaption { font-size: 0.85rem; color: var(--ink-faint); margin-top: 8px; }
.lightbox-trigger { display: block; cursor: zoom-in; }

/* ---------- Quellen ---------- */
.quellen { margin-top: var(--sp-5); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.quellen h2 { margin-top: 0; font-size: 1.3rem; }
.quellen ol { font-size: 0.9rem; color: var(--ink-faint); margin-left: 1.2em; }
.quellen a { color: var(--accent-deep); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin-bottom: var(--sp-3); font-size: 0.85rem; color: var(--ink-faint); }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--line-2); }
.breadcrumbs a { color: var(--ink-faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-deep); }

/* ---------- Aside (Guide-Seiten) ---------- */
.aside { position: sticky; top: 64px; display: grid; gap: var(--sp-3); }
.aside-box { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); }
.aside-box h2, .aside-box h3 { margin-top: 0; font-size: 1.05rem; }
.toc strong { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 10px; }
.toc ol { margin: 0 0 0 1.1em; padding: 0; font-size: 0.92rem; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--accent-deep); }
.aside .toc { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #C9C4B9; margin-top: var(--sp-6); padding-block: var(--sp-5) var(--sp-3); }
.foot-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-4); }
.foot-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; margin-bottom: 12px; }
.foot-brand strong { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; }
.foot-sub { font-size: 0.9rem; color: #9C978C; max-width: 44ch; }
.foot-nav { display: flex; flex-direction: column; gap: 8px; }
.foot-nav-title { font-family: 'Space Grotesk', sans-serif; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7E7A70; margin-bottom: 4px; }
.foot-nav a { color: #C9C4B9; text-decoration: none; font-size: 0.92rem; }
.foot-nav a:hover { color: #fff; }
.foot-meta { border-top: 1px solid #34333A; margin-top: var(--sp-4); padding-top: var(--sp-3); font-size: 0.82rem; color: #8B877D; }
.foot-meta p { color: #8B877D; margin-bottom: 8px; }
.foot-meta strong { color: #B9B4A9; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding-block: var(--sp-5); }
.notfound h1 { max-width: 20ch; margin-inline: auto; }

/* ---------- Lightbox ---------- */
body.lightbox-open { overflow: hidden; }
.lightbox-overlay { position: fixed; inset: 0; background: rgba(20,18,14,0.9); display: grid; place-items: center; padding: 24px; z-index: 200; cursor: zoom-out; }
.lightbox-overlay img { max-width: 92vw; max-height: 82vh; border-radius: 8px; }
.lightbox-overlay figcaption { color: #ddd; text-align: center; margin-top: 12px; font-size: 0.9rem; }
.lb-close { position: absolute; top: 18px; right: 22px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.12); color: #fff; font-size: 1.6rem; cursor: pointer; }
.lb-close:hover { background: rgba(255,255,255,0.22); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  main.layout { grid-template-columns: 1fr; }
  .aside { position: static; }
  .foot-cols { grid-template-columns: 1fr 1fr; }
  .foot-brand-col { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .brand-claim { display: none; }
  .foot-cols { grid-template-columns: 1fr; }
  main { padding-block: var(--sp-4); }
}

/* ---------- Print ---------- */
@media print {
  .site-nav, .article-tabs, .aside, .site-footer, .hero-actions, .affiliate-note { display: none; }
  body { background: #fff; font-size: 12pt; }
  main.layout { grid-template-columns: 1fr; }
  a { text-decoration: none; color: #000; }
}
