/* Shared responsive layer: mobile menu, consent banner, small-screen fixes. Loaded after each site's own CSS. */
img, svg, video { max-width: 100%; height: auto; }
.btn.sm { padding: 10px 18px; font-size: 14px; }
body { overflow-x: hidden; }
.menu { display: none; background: none; border: 0; width: 44px; height: 44px; padding: 0; margin-right: -8px; cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 5px; }
.menu span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
header.nav.open .menu span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
header.nav.open .menu span:nth-child(2) { opacity: 0; }
header.nav.open .menu span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 900px) {
  :root header.nav .wrap { position: relative; }
  :root header.nav.has-menu .menu, header.nav .menu { display: flex; }
  :root header.nav.has-menu nav { display: none; position: absolute; left: 0; right: 0; top: 72px; background: var(--ivory); border-bottom: 1px solid var(--line); box-shadow: 0 14px 24px rgba(32,33,36,.08); padding: 8px 20px 20px; flex-direction: column; gap: 0; }
  :root header.nav.has-menu.open nav { display: flex; }
  :root header.nav.has-menu nav a { font-size: 18px; padding: 14px 4px; border-bottom: 1px solid var(--line); width: 100%; }
  :root header.nav.has-menu nav a.btn { margin-top: 16px; text-align: center; border-bottom: 0; width: 100%; }
  /* without JS the nav simply wraps */
  :root header.nav:not(.has-menu) .wrap { flex-wrap: wrap; height: auto; min-height: 72px; padding-top: 10px; padding-bottom: 10px; }
  :root .btn, :root .tab, :root .chip { min-height: 44px; }
  :root .hero .wrap { padding-top: 40px; padding-bottom: 48px; }
  :root .lead, :root .hero p.lead { font-size: 1.1rem !important; }
  :root section { padding: 56px 0; }
  :root .card { padding: 22px; }
  :root .form-card { padding: 20px; }
  :root footer .wrap { flex-direction: column; }
}
@media (max-width: 380px) { :root h1 { font-size: 2.1rem; } :root .wrap { padding: 0 16px; } }
table { display: block; overflow-x: auto; }
pre { max-width: 100%; }

.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 720px; margin: 0 auto; background: var(--ink); color: var(--ivory); border-radius: 16px; padding: 16px 20px; display: flex; gap: 16px; align-items: center; justify-content: space-between; box-shadow: 0 18px 50px rgba(0,0,0,.3); font-size: 14px; }
.consent p { margin: 0; line-height: 1.5; } .consent a { color: #9CC7EE; }
.consent div { display: flex; gap: 8px; flex: none; }
.consent .btn.ghost { color: var(--ivory); border-color: var(--ivory); }
@media (max-width: 560px) { .consent { flex-direction: column; align-items: stretch; } .consent div { justify-content: stretch; } .consent .btn { flex: 1; } }

@media (max-width: 860px) {
  :root .hero .art .d1 { width: 64px; height: 64px; top: 28px; left: 8px; }
  :root .hero .art .d2 { width: 36px; height: 36px; left: 96px; bottom: auto; top: 120px; }
  :root .hero .art .line { display: none; }
}

/* ---- dark theme ---- */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 40px; height: 40px; margin-left: 8px; background: none; border: 2px solid var(--line); border-radius: 50%; color: var(--ink); cursor: pointer; padding: 0; }
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle .tl { display: none; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (max-width: 900px) {
  :root header.nav.has-menu nav .theme-toggle { width: 100%; height: auto; border: 0; border-radius: 0; justify-content: flex-start; margin: 0; padding: 14px 4px; font: 400 18px Inter, sans-serif; }
  :root header.nav.has-menu nav .theme-toggle .tl { display: inline; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #F1EFEA; --ivory: #141518; --white: #1D1F23; --line: #33363C; --muted: #A9ACB4;
  --lavender: #262A48; --paleblue: #15283C; --blue: #6FB0EA;
}
:root[data-theme="dark"] .nav { background: rgba(20,21,24,.92); }
:root[data-theme="dark"] .btn { color: #202124; }
:root[data-theme="dark"] .btn.ghost { color: var(--ink); }
:root[data-theme="dark"] .btn.dark { background: var(--ink); color: var(--ivory); }
:root[data-theme="dark"] .tag.now { color: #202124; }
:root[data-theme="dark"] section.ink, :root[data-theme="dark"] .featured, :root[data-theme="dark"] .consent { background: #0C0D10; color: #F1EFEA; }
:root[data-theme="dark"] section.ink h2, :root[data-theme="dark"] section.ink h3, :root[data-theme="dark"] .featured h2, :root[data-theme="dark"] .featured .more { color: #F1EFEA; }
:root[data-theme="dark"] .consent .btn.ghost { color: #F1EFEA; border-color: #F1EFEA; }
:root[data-theme="dark"] .avatar, :root[data-theme="dark"] ol.stepsbig .num { background: #F1EFEA; color: #141518; }
:root[data-theme="dark"] header.nav img, :root[data-theme="dark"] .sitefoot img, :root[data-theme="dark"] img[src$="/k.svg"], :root[data-theme="dark"] .hero .art img[src$="k.svg"] { filter: brightness(0) invert(1); }
:root[data-theme="dark"] .form-card { background: #fff; color: #202124; }
:root[data-theme="dark"] .stage.ivory { background: #FAF9F6; } :root[data-theme="dark"] .stage.white { background: #fff; } :root[data-theme="dark"] .stage.ink { background: #202124; }
:root[data-theme="dark"] .sw { border-color: #4a4d55; }
:root[data-theme="dark"] .tab.on, :root[data-theme="dark"] .chip[aria-pressed="true"] { background: #F1EFEA; color: #141518; border-color: #F1EFEA; }
:root[data-theme="dark"] .coll.build { color: #8FD46C; }
:root[data-theme="dark"] code { color: #F1EFEA; }

/* gravatar photos: the initials sit underneath and show if the image is missing */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid var(--white); box-shadow: 0 4px 18px rgba(32,33,36,.15); background: var(--lavender); display: block; margin-bottom: 16px; }
.me-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; }

/* buttons inside dark sections keep their own text color (the section link color must not win) */
:root section.ink a.btn { color: #202124; text-decoration: none; }
:root section.ink a.btn.ghost { color: #FAF9F6; border-color: #FAF9F6; }
:root section.ink a.btn.dark { background: #FAF9F6; color: #202124; }
:root a.btn:hover { color: #202124; }
:root a.btn.ghost:hover { color: var(--ink); }
:root section.ink a.btn.ghost:hover { color: #FAF9F6; }
:root a.btn.dark, :root a.btn.dark:hover { color: var(--ivory); }
:root[data-theme="dark"] a.btn.dark, :root[data-theme="dark"] a.btn.dark:hover { color: var(--ivory); }

.avatar.has-photo { background: transparent; color: transparent; }
