/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --wine:      #7b1a2e;
  --wine-dark: #5a1220;
  --wine-light:#f5ebed;
  --wine-mid:  #b1374c;
  --text:      #1e1e1e;
  --muted:     #5a5a5a;
  --border:    #ddd;
  --bg:        #fafaf8;
  --card:      #ffffff;
  --code-bg:   #f4f4f0;
  --radius:    8px;
  --shadow:    0 2px 8px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* ── Layout ───────────────────────────────────────────────── */
.page-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--wine-dark);
  color: #fff;
  padding: 0 0 2rem;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.25rem 1.25rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: .5rem;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}

.sidebar-logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .5px;
  color: #fff;
  text-decoration: none;
}

.sidebar-logo span { color: var(--wine-mid); }

.sidebar-version {
  font-size: .72rem;
  color: rgba(255,255,255,.45);
  margin-top: .2rem;
}

/* Language switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  margin-top: .1rem;
}

.lang-switcher a,
.lang-switcher span {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .5px;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  transition: color .15s;
}

.lang-switcher a:hover { color: rgba(255,255,255,.85); }
.lang-switcher a.active { color: #fff; }
.lang-switcher .sep { color: rgba(255,255,255,.25); }

/* Nav */
.sidebar nav { padding: 0 .75rem; flex: 1; }

.sidebar nav a {
  display: block;
  padding: .38rem .6rem;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  border-radius: 5px;
  font-size: .875rem;
  transition: background .15s, color .15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar nav .nav-section {
  margin-top: .75rem;
  padding: .25rem .6rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.32);
  cursor: default;
}

.sidebar nav .nav-sub {
  padding-left: 1.25rem;
  font-size: .82rem;
}

/* Impressum link in sidebar footer */
.sidebar-footer {
  padding: 1rem 1.25rem .25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: auto;
}

.sidebar-footer a {
  font-size: .75rem;
  color: rgba(255,255,255,.38);
  text-decoration: none;
  transition: color .15s;
}

.sidebar-footer a:hover { color: rgba(255,255,255,.7); }

/* ── Main Content ─────────────────────────────────────────── */
main {
  max-width: 860px;
  padding: 3rem 3.5rem 6rem;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  background:
    linear-gradient(135deg, rgba(90,18,32,.0) 0%, rgba(60, 2, 19, 0.2) 100%),
    url('images/IWT_ancient_cellar_landscape.png') center / cover no-repeat;
  color: #fff;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin-bottom: 3rem;
  overflow: hidden;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.hero-text { flex: 1; min-width: 0; }

.hero-logo-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.15);
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.hero h1 span { color: var(--wine-mid); }

.hero .subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,.80);
  margin-bottom: 1.25rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: .8rem;
  color: rgba(255,255,255,.55);
}

@media (max-width: 600px) {
  .hero-inner { flex-direction: column-reverse; align-items: flex-start; }
  .hero-logo-img { width: 110px; height: 110px; }
}

/* ── Typography ───────────────────────────────────────────── */
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--wine-dark);
  margin: 3rem 0 1.25rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--wine-light);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--wine);
  margin: 2rem 0 .75rem;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 .5rem;
}

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: .5rem 0 1rem 1.25rem; }
li { margin-bottom: .25rem; }

strong { color: var(--wine-dark); }

a { color: var(--wine); }
a:hover { color: var(--wine-dark); }

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

/* ── Callouts ─────────────────────────────────────────────── */
.callout {
  border-left: 4px solid var(--wine-mid);
  background: var(--wine-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .75rem 1rem;
  margin: 1rem 0 1.25rem;
  font-size: .9rem;
}

.callout.warning {
  border-color: #c0392b;
  background: #fdf0ef;
}

.callout.tip {
  border-color: #27ae60;
  background: #eefaf3;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: .9rem;
}

th {
  background: var(--wine-dark);
  color: #fff;
  font-weight: 600;
  padding: .65rem 1rem;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: #fafaf8; }
td.center { text-align: center; }

/* ── Screenshots ──────────────────────────────────────────── */
.screenshot-wrap {
  margin: 1.25rem 0 1.5rem;
  text-align: center;
}

.screenshot {
  margin: 1.25rem 0 1.5rem;
  text-align: center;
}

.screenshot-wrap img {
  max-width: 100%;
  max-height: 520px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  border: 1px solid var(--border);
}

.screenshot img {
  max-width: 100%;
  max-height: 840px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  border: 1px solid var(--border);
}

.screenshot-wrap.missing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  background: var(--code-bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .82rem;
  font-style: italic;
}

/* ── Steps ────────────────────────────────────────────────── */
.steps {
  list-style: none;
  margin: .5rem 0 1.25rem;
  counter-reset: step-counter;
}

.steps li {
  display: flex;
  gap: .75rem;
  margin-bottom: .6rem;
  counter-increment: step-counter;
}

.steps li::before {
  content: counter(step-counter);
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .1rem;
}

/* ── TOC card ─────────────────────────────────────────────── */
.toc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow);
}

.toc-card h2 {
  font-size: .85rem;
  margin: 0 0 .75rem;
  border: none;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.toc-card ol { margin-left: 1rem; }
.toc-card li { margin-bottom: .2rem; font-size: .9rem; }
.toc-card a { color: var(--wine); text-decoration: none; }
.toc-card a:hover { text-decoration: underline; }
.toc-card ol ol { margin-top: .2rem; }

/* ── Impressum specific ───────────────────────────────────── */
.impressum-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.impressum-section h3 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--wine-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}

.placeholder {
  display: inline-block;
  background: #fff3cd;
  border: 1px dashed #c8a400;
  border-radius: 3px;
  padding: .1em .4em;
  font-style: italic;
  font-size: .9em;
  color: #7a5800;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--wine); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-wrapper { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
  }

  main { padding: 2rem 1.25rem 4rem; }
}
