/* ==========================================================
   Broken Pencils · pave my way
   Same family as davidmair.de: ink, ivory, copper, CT Solid + Montserrat
   ========================================================== */
:root {
  --ink: #07080c;
  --ink-2: #0f1117;
  --ink-3: #161922;
  --ivory: #f4efe7;
  --copper: #e8956a;
  --text: #f4efe7;
  --body: rgba(244, 239, 231, .84);
  --muted: rgba(244, 239, 231, .58);
  --line: rgba(244, 239, 231, .14);
  --display: "CT Solid", "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.22, .9, .25, 1);
  --gutter: clamp(16px, 5vw, 72px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); color: var(--text); font: 400 1rem/1.6 var(--sans); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
em, i { font-style: normal; }
::selection { background: var(--copper); color: var(--ink); }
html:not([lang="en"]) .en, html[lang="en"] .de { display: none !important; }

.eyebrow { font: 500 .72rem/1.4 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--copper); display: inline-flex; align-items: center; gap: .9em; }
.eyebrow::before { content: ""; width: 2.4em; height: 1px; background: currentColor; flex-shrink: 0; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px var(--gutter); transition: background .4s var(--ease), padding .4s var(--ease);
}
.site-header.scrolled { background: rgba(7, 8, 12, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 46px; width: auto; }
.brand span { font: 400 1.35rem/1 var(--display); letter-spacing: .01em; }
.nav { display: flex; align-items: center; gap: clamp(14px, 2.2vw, 30px); }
.nav a { text-decoration: none; font-size: .76rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.lang-toggle { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer; font: 500 .7rem/1 var(--sans); letter-spacing: .12em; }
.lang-toggle span { padding: 6px 9px; border-radius: 999px; color: var(--muted); transition: background .3s, color .3s; }
html:not([lang="en"]) .lang-toggle .l-de, html[lang="en"] .lang-toggle .l-en { background: var(--ivory); color: var(--ink); }
.menu-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; position: relative; }
.menu-toggle span { position: absolute; left: 13px; right: 13px; height: 1px; background: var(--text); transition: transform .3s var(--ease), top .3s; }
.menu-toggle span:first-child { top: 18px; } .menu-toggle span:last-child { top: 25px; }
.menu-open .menu-toggle span:first-child { top: 21px; transform: rotate(45deg); }
.menu-open .menu-toggle span:last-child { top: 21px; transform: rotate(-45deg); }

@media (max-width: 860px) {
  .brand img { height: 38px; }
  .brand span { font-size: 1.15rem; }
  .menu-toggle { display: block; }
  .nav {
    position: fixed; inset: 0; z-index: -1; flex-direction: column; justify-content: center; gap: 26px;
    background: rgba(7, 8, 12, .97); opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
  }
  .nav a { font-size: 1rem; }
  .menu-open .nav { opacity: 1; pointer-events: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: .7em; padding: .95em 1.6em; border: 1px solid var(--copper); border-radius: 999px;
  font: 500 .76rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--text); text-decoration: none; overflow: hidden; isolation: isolate;
  transition: color .45s var(--ease);
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--copper); transform: translateY(101%); transition: transform .45s var(--ease); }
.btn:hover { color: var(--ink); } .btn:hover::before { transform: none; }
.btn-solid { background: var(--copper); color: var(--ink); } .btn-solid::before { background: var(--ivory); }
.btn .arrow { transition: transform .45s var(--ease); } .btn:hover .arrow { transform: translateX(4px); }

/* ---------- Hero: same painting as davidmair.de ---------- */
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; padding: 120px var(--gutter) 100px; overflow: hidden; isolation: isolate; text-align: center; }
.hero-bg { position: absolute; inset: -4%; z-index: -2; background: url("/assets/img/painting.webp") center / cover no-repeat; animation: drift 28s ease-in-out infinite alternate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 45%, rgba(7,8,12,.15) 0 30%, rgba(7,8,12,.6) 80%), linear-gradient(to bottom, rgba(7,8,12,.2), rgba(7,8,12,.1) 60%, var(--ink)); }
@keyframes drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1.5%, 1%); } }
.hero-inner { width: min(760px, 100%); display: grid; justify-items: center; }
.hero-logo { height: clamp(150px, 22vh, 230px); width: auto; filter: drop-shadow(0 10px 40px rgba(0,0,0,.55)); }
.hero h1 { margin: 26px 0 0; font: 400 clamp(2.6rem, 6.4vw, 5.2rem)/1.06 var(--display); text-shadow: 0 4px 30px rgba(0,0,0,.45); }
.hero h1 span { display: block; color: var(--copper); font-size: .5em; margin-top: .25em; }
.lede { margin: 20px 0 32px; max-width: 50ch; font-size: 1.05rem; color: var(--ivory); text-shadow: 0 1px 14px rgba(7,8,12,.7); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.scroll-cue { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); width: 1px; height: 56px; background: var(--line); overflow: hidden; }
.scroll-cue::after { content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: var(--copper); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { to { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .hero-bg, .scroll-cue::after { animation: none; } }

/* ---------- Chapters ---------- */
.section { padding: clamp(64px, 10vw, 130px) var(--gutter); max-width: 1320px; margin: 0 auto; }
.section-head { margin-bottom: clamp(32px, 5vw, 56px); }
.section-title { margin: 16px 0 0; font: 400 clamp(2.4rem, 5.6vw, 4.6rem)/1.1 var(--display); }
.chapters { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.chapter a {
  display: grid; grid-template-columns: 90px 200px minmax(0, 1fr); gap: clamp(16px, 3vw, 40px); align-items: center;
  padding: clamp(20px, 3vw, 32px) 0; border-bottom: 1px solid var(--line); text-decoration: none; position: relative;
}
.chapter a::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 0; background: var(--copper); transition: width .8s var(--ease); }
.chapter a:hover::after { width: 100%; }
.ch-num { font: 400 clamp(2.6rem, 5vw, 4rem)/1 var(--display); color: var(--muted); transition: color .4s; }
.chapter a:hover .ch-num { color: var(--copper); }
.ch-img { aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink-3); border-radius: 4px; }
.ch-img { position: relative; display: block; }
.noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.noimg img { width: auto !important; height: 64% !important; max-width: 80%; object-fit: contain !important; opacity: .5; filter: none !important; transform: none !important; }
.ch-img img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85) brightness(.9); transition: transform 1s var(--ease), filter .5s; }
.chapter a:hover .ch-img img { transform: scale(1.05); filter: none; }
.ch-text { display: grid; gap: 8px; }
.ch-meta { font: 500 .7rem/1 var(--mono); letter-spacing: .12em; color: var(--copper); }
.ch-title { font: 400 clamp(1.4rem, 2.4vw, 2rem)/1.2 var(--display); }
.ch-ex { color: var(--muted); font-size: .92rem; max-width: 70ch; }
.tag { color: var(--copper); }
@media (max-width: 720px) {
  .chapter a { grid-template-columns: 1fr; gap: 14px; }
  .ch-num { font-size: 2.2rem; }
  .ch-img { aspect-ratio: 16 / 9; }
}

/* ---------- Article ---------- */
.article { max-width: 820px; margin: 0 auto; padding: clamp(120px, 14vw, 170px) var(--gutter) clamp(56px, 8vw, 100px); }
.article.wide { max-width: 1320px; }
.article-head h1 { margin: 18px 0 0; font: 400 clamp(2.4rem, 6vw, 4.4rem)/1.12 var(--display); }
.cover { margin: clamp(32px, 5vw, 56px) 0 0; border-radius: 4px; overflow: hidden; }
.cover img { width: 100%; max-height: 70svh; object-fit: cover; }
.prose { margin-top: clamp(32px, 5vw, 56px); font-size: 1.06rem; line-height: 1.85; color: var(--body); }
.prose p { margin: 0 0 1.3em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); }
.prose a { color: var(--text); text-decoration-color: var(--copper); text-underline-offset: 3px; transition: color .3s; }
.prose a:hover { color: var(--copper); }
.prose h2, .prose h3, .prose h4 { margin: 1.8em 0 .6em; font: 400 1.7rem/1.2 var(--display); color: var(--text); }
.prose blockquote { margin: 1.6em 0; padding-left: 1.2em; border-left: 1px solid var(--copper); color: var(--text); }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.3em; }
.prose img { border-radius: 4px; margin: 1.6em 0; }
.prose a[data-lb] { display: block; }
.prose .media { margin: 1.6em 0; }
.prose figcaption { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.only-de { padding: 14px 18px; border: 1px solid var(--line); border-radius: 4px; color: var(--copper); font-size: .9rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 1.8em 0; }
.gallery.big { grid-template-columns: repeat(auto-fill, minmax(min(220px, 45%), 1fr)); gap: 10px; margin-top: clamp(32px, 5vw, 56px); }
.gallery a { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 3px; background: var(--ink-3); }
.gallery img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; transition: transform .8s var(--ease), filter .4s; filter: saturate(.9); }
.gallery a:hover img { transform: scale(1.06); filter: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(48px, 7vw, 80px); padding-top: 28px; border-top: 1px solid var(--line); }
.pager a { display: grid; gap: 8px; text-decoration: none; }
.pager .next { text-align: right; }
.pg-l { font: 500 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--copper); }
.pg-t { font: 400 1.3rem/1.25 var(--display); transition: color .3s; }
.pager a:hover .pg-t { color: var(--copper); }

/* ---------- YouTube (two click) ---------- */
.yt-wrap { margin: 1.8em 0; }
.yt { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: #000; cursor: pointer; }
.yt img { width: 100%; height: 100%; object-fit: cover; margin: 0; filter: brightness(.7); transition: filter .4s; }
.yt:hover img { filter: brightness(.85); }
.yt .play { position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; transform: translate(-50%, -50%); border: 1px solid var(--ivory); border-radius: 50%; display: grid; place-items: center; transition: background .3s, border-color .3s; }
.yt .play::before { content: ""; margin-left: 5px; border: 11px solid transparent; border-left: 17px solid var(--ivory); border-right: 0; }
.yt:hover .play { background: var(--copper); border-color: var(--copper); }
.yt .note { position: absolute; left: 14px; bottom: 12px; font: 500 .66rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ivory); opacity: .75; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(7, 8, 12, .95); padding: 56px 64px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100svh - 112px); width: auto; object-fit: contain; border-radius: 3px; }
.lightbox button { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: rgba(7,8,12,.6); color: var(--text); font: 300 1.8rem/1 var(--sans); cursor: pointer; transition: background .3s, color .3s; }
.lightbox button:hover { background: var(--copper); color: var(--ink); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lightbox { padding: 64px 8px; } .lb-prev, .lb-next { top: auto; bottom: 10px; transform: none; } }

/* ---------- Legal ---------- */
.legal h2 { margin: 2em 0 .6em; font: 400 1.5rem/1.2 var(--display); color: var(--text); }
.legal address { font-style: normal; }

/* ---------- Footer ---------- */
.site-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; padding: 28px var(--gutter); border-top: 1px solid var(--line); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.site-footer a { text-decoration: none; transition: color .3s; } .site-footer a:hover { color: var(--copper); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }
