/* greifiks.org — Unified Swiss Monograph Stylesheet (Obsidian Dark Default + Opt-In Paper Light) */
:root {
  color-scheme: dark;
  --bg: #090a0c;
  --surface: #0f1114;
  --frame-bg: #111317;
  --ink: #f2efe8;
  --soft: #c8ccd3;
  --muted: #8c9199;
  --faint: #676c74;
  --rule: rgba(242, 239, 232, 0.15);
  --rule-strong: rgba(242, 239, 232, 0.34);
  --nav-bg: rgba(9, 10, 12, 0.92);
  --accent: #c27161;
  --serif-display: "Bodoni Moda", Georgia, serif;
  --serif-body: "Newsreader", Georgia, serif;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3ef;
  --surface: #fbfaf7;
  --frame-bg: #ece9e2;
  --ink: #161719;
  --soft: #36393f;
  --muted: #62666d;
  --faint: #868b92;
  --rule: rgba(22, 23, 25, 0.14);
  --rule-strong: rgba(22, 23, 25, 0.34);
  --nav-bg: rgba(245, 243, 239, 0.94);
  --accent: #8c3a2b;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background 0.22s ease, color 0.22s ease;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--ink); color: var(--bg); }

.wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

/* Unified Minimal Top Bar — true top-left and top-right corners */
header.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
header.site-nav .wrap {
  width: 100%;
  max-width: none;
  padding-inline: clamp(16px, 2.4vw, 32px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 62px;
}
.brand-cluster {
  display: inline-flex;
  align-items: baseline;
  gap: 11px;
  white-space: nowrap;
}
.brand {
  font-family: var(--serif-display);
  font-variation-settings: "opsz" 14;
  font-size: 1.02rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand-sep { color: var(--faint); font-size: 0.78rem; }
.brand-sub {
  font-size: 0.71rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.18s ease;
}
.brand-sub:hover,
.brand-sub.active { color: var(--ink); }

.nav-right {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.8vw, 22px);
}
.nav-links a {
  font-size: 0.71rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.18s ease;
}
.nav-links a:hover,
.nav-links a.active { color: var(--ink); }

.nav-utils {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-left: 1px solid var(--rule);
  padding-left: 14px;
}
.nav-utils.no-border { border-left: 0; padding-left: 0; }
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.theme-switch button {
  border: 0;
  background: transparent;
  padding: 4px 3px;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.18s ease;
  white-space: nowrap;
}
.theme-switch button:hover,
.theme-switch button.active { color: var(--ink); }
.theme-switch button.active {
  text-decoration: underline;
  text-underline-offset: 5px;
}

/* Quiet Subpage Masthead */
.page-head {
  padding: clamp(40px, 5.5vw, 68px) 0 clamp(22px, 3vw, 34px);
  border-bottom: 1px solid var(--rule);
}
.page-head h1 {
  margin: 0;
  font-family: var(--serif-display);
  font-variation-settings: "opsz" 16;
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.page-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Inline Links & Buttons */
.text-link {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 3px;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.text-link:hover { border-color: var(--ink); }
.text-link.subtle { color: var(--muted); border-color: var(--rule); }
.text-link.subtle:hover { color: var(--ink); border-color: var(--ink); }

.btn-ink {
  display: inline-block;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  font-size: 0.71rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.18s ease;
}
.btn-ink:hover { opacity: 0.86; }

/* Shared Hub Layout (Lens & Vault) */
body.hub-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.hub-page main.wrap {
  width: min(680px, 100%);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: clamp(44px, 7vh, 84px);
}
body.hub-page .page-head {
  padding: 0 0 clamp(22px, 3vh, 32px);
}
.hub-list {
  margin: 0;
  padding: 12px 0;
  list-style: none;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.hub-list a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 20px;
  align-items: baseline;
  gap: 8px 18px;
  padding: 18px 0;
  text-decoration: none;
  transition: padding-left 0.2s ease;
}
.hub-list a:hover,
.hub-list a:focus-visible { padding-left: 6px; }
.cat-num {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--faint);
}
.cat-title {
  font-family: var(--serif-display);
  font-variation-settings: "opsz" 14;
  font-size: clamp(1.28rem, 2.3vw, 1.56rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
}
.cat-title.italic { font-style: italic; }
.cat-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.cat-arr {
  font-size: 0.92rem;
  color: var(--faint);
  text-align: right;
  transition: transform 0.2s ease, color 0.2s ease;
}
.hub-list a:hover .cat-arr { color: var(--ink); transform: translate(2px, -2px); }
body.hub-page footer.colophon { margin-top: auto; padding: 20px 0 28px; }
@media (max-width: 640px) {
  .hub-list a { grid-template-columns: 28px minmax(0, 1fr) 18px; padding: 14px 0; }
  .cat-meta { grid-column: 2; text-align: left; margin-top: 2px; }
  .cat-arr { grid-row: 1; grid-column: 3; }
}

/* Minimal Single-Line Colophon — no full-screen separator line */
footer.colophon {
  margin-top: clamp(48px, 7vw, 88px);
  padding: 24px 0 36px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}
.colophon-inner {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 18px;
  text-align: center;
}
.colophon-name {
  font-family: var(--serif-display);
  font-size: 0.96rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.colophon a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.colophon a:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 860px) {
  .nav-inner {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 10px;
    gap: 10px 14px;
  }
  .nav-right { display: contents; }
  .brand-cluster { order: 1; }
  .nav-utils { order: 2; border-left: 0; padding-left: 0; }
  .nav-links {
    order: 3;
    flex: 1 0 100%;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding-top: 10px;
    border-top: 1px solid var(--rule);
  }
  .nav-links a { font-size: 0.67rem; letter-spacing: 0.14em; }
}

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