/* moonman.ch additions on top of zola-quiet.
   Look: all dark. Near-black bands (nav + hero, footer) around a
   slightly lighter page; a halftone dot glow behind the hero. The moon
   is the motif: the hero draws tonight's phase (moon.js), the footer
   shows all eight.
   The typographic skin gets the full treatment; the TUI skin keeps its
   own layout and only borrows the palette. */

@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
/* --- palette: all dark ---------------------------------------------
   One scheme in every mode (base.html pins data-theme="dark"). The
   selector list matches each of the skin's own palette selectors at
   equal specificity, and this file loads after the skin, so it wins.
   --band/--sand are the nav, hero and footer: a shade darker than the
   page, with the halftone dots in --dot. */
:root,
:root[data-theme],
:root:not([data-theme]) {
  --band: #0e0e10;
  --sand: #ecebe7;
  --sand-dim: #8b8b94;
  --dot: #9a9aa2;
  --fg: #ecebe7;
  --fg-dim: #9a9aa3;
  --bg: #18181b;
  --link: #ecebe7;
  --link-visited: #ecebe7;
  --rule: #2a2a2f;
  --code-bg: #202024;
  --figure-bg: #1d1d20;
  --panel: #202024;
  --accent: #ffffff;
  --accent-alt: #b8b8c2;
  --border: #33333a;
  --reverse-fg: #18181b;
  --reverse-bg: #ecebe7;
}

::selection { background: var(--fg); color: var(--bg); }

/* the corner toggles sit on the ink band at the top, and stay ink
   coloured when the page scrolls under them */
.skin-toggle,
.theme-toggle {
  background: var(--band);
  border-color: #2a2a2f;
  color: var(--sand);
}
.theme-toggle { display: none; }
.skin-toggle:hover,
.theme-toggle:hover { color: #fff; border-color: var(--sand-dim); }

/* ====================================================================
   typographic skin
   ==================================================================== */
:root:not([data-skin="tui"]) body {
  font-family: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  letter-spacing: -0.005em;
}
/* subtle film grain over everything */
:root:not([data-skin="tui"]) body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root:not([data-skin="tui"]) .sidebar { display: none; }
:root:not([data-skin="tui"]) .layout { margin-top: 0; margin-bottom: 0; }
:root:not([data-skin="tui"]) h1,
:root:not([data-skin="tui"]) h2,
:root:not([data-skin="tui"]) h3 {
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
:root:not([data-skin="tui"]) main > h1,
:root:not([data-skin="tui"]) article > header > h1 {
  font-size: clamp(2.6rem, 7vw, 4rem);
  margin: 0 0 0.3em;
}
:root:not([data-skin="tui"]) main a { text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
:root:not([data-skin="tui"]) main a:hover { color: var(--accent); }

/* --- ink bands: nav (+ hero on the home page) and the footer --------
   The band colour reaches the viewport edges through an outset
   border-image, which paints outside the box without adding scroll. */
:root:not([data-skin="tui"]) .site-nav,
:root:not([data-skin="tui"]) .hero,
:root:not([data-skin="tui"]) .site-footer {
  --fg: var(--sand);
  --fg-dim: var(--sand-dim);
  --link: var(--sand);
  --link-visited: var(--sand);
  --rule: #232327;
  --border: #232327;
  color: var(--fg);
  border-image: conic-gradient(var(--band) 0 0) fill 0 / / 0 100vw;
}

/* --- site nav ----------------------------------------------------- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin: 0 0 2rem;
  padding: 1.1rem 0 0.9rem;
  border-bottom: 1px solid var(--border, var(--rule));
  font-size: 15px;
}
:root:not([data-skin="tui"]) .site-nav {
  margin: 0 0 3rem;
  padding: 1.1rem 5.5rem 1.1rem 0;
  border-bottom: none;
}
:root[data-skin="tui"] .site-nav { border-bottom-style: dashed; }
.site-nav a,
.site-nav a:visited {
  color: var(--fg-dim);
  text-decoration: none;
}
.site-nav a:hover { color: var(--fg); }
.site-nav .site-nav-home,
.site-nav .site-nav-home:visited {
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}
.site-nav-links a[aria-current="page"],
.site-nav-links a[aria-current="page"]:visited {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
:root[data-skin="tui"] .site-nav-links a::before { content: "./"; opacity: 0.6; }

/* on the home page the nav band runs straight into the hero band */
:root:not([data-skin="tui"]) .site-nav:has(+ main .hero) { margin-bottom: 0; }

/* --- home hero: wordmark on the left, tonight's moon on the right -- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem 2.5rem;
  margin: 0 0 3.5rem;
  padding: 2.5rem 0 4.5rem;
}
.hero > :not(.hero-dots) { position: relative; z-index: 1; }

/* the halftone glow behind the hero: big dots near the middle, small
   dots spreading further out, both fading before the column edges */
.hero-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-dots::before,
.hero-dots::after {
  content: "";
  position: absolute;
  inset: 0;
}
.hero-dots::before {
  background: radial-gradient(circle, var(--dot) 1.1px, transparent 1.5px) 0 0 / 7px 7px;
  opacity: 0.35;
  -webkit-mask: radial-gradient(closest-side at 62% 42%, #000 15%, transparent 100%);
  mask: radial-gradient(closest-side at 62% 42%, #000 15%, transparent 100%);
}
.hero-dots::after {
  background: radial-gradient(circle, var(--dot) 1.9px, transparent 2.3px) 0 0 / 7px 7px;
  opacity: 0.5;
  -webkit-mask: radial-gradient(closest-side at 62% 42%, #000 0%, transparent 55%);
  mask: radial-gradient(closest-side at 62% 42%, #000 0%, transparent 55%);
}
:root[data-skin="tui"] .hero-dots { display: none; }
.hero-meta {
  margin: 0 0 1.4rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.hero-meta span { color: var(--fg); }
.hero h1.hero-title {
  margin: 0 0 0.9rem;
  font-size: clamp(3.2rem, 12vw, 6rem);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.9;
  color: var(--fg);
}
.hero-by {
  margin: -0.2rem 0 1.4rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg-dim);
}
.hero-sub {
  margin: 0 0 1.6rem;
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.hero-body {
  max-width: 30em;
  color: var(--fg-dim);
  line-height: 1.6;
}
.hero-body p { margin: 0; }
.hero-body a { color: var(--fg); }
.hero-moon {
  width: clamp(120px, 26vw, 220px);
  height: auto;
  overflow: visible;
}
.hero-moon .moon-dark { fill: #161618; stroke: #333339; stroke-width: 1; }
.hero-moon .moon-lit {
  fill: var(--sand);
  filter: drop-shadow(0 0 26px rgb(236 235 231 / 0.22));
}
@media (max-width: 640px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-moon { grid-row: 1; justify-self: end; width: 104px; margin-bottom: -1.5rem; }
}
:root[data-skin="tui"] .hero h1.hero-title { font-size: 2.2rem; }

/* --- home index: numbered rows, like a table of contents ----------- */
.index { margin: 0 0 3.5rem; }
.index h2.index-label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1.5px solid var(--fg);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.index-count {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-dim);
}
.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.index-list li {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.index-list li::before { content: none; }
.index-no,
.index-side {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--fg-dim);
}
.index-title {
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 550;
  letter-spacing: -0.025em;
  color: var(--fg);
  text-decoration: none;
}
.index-title:hover { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.index-desc { margin: 0.2rem 0 0; color: var(--fg-dim); font-size: 0.97rem; }
@media (max-width: 640px) {
  .index-list li { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .index-side { grid-column: 2; margin-top: 0.35rem; }
}
.index-more { margin: 0.9rem 0 0; font-size: 0.97rem; }
.index-more a { color: var(--fg); }
.index-more a::after { content: " →"; }

/* --- footer: the phase strip, then name and webring ---------------- */
:root:not([data-skin="tui"]) .site-footer {
  margin: 5rem 0 0;
  padding: 2.5rem 0 1.75rem;
  border-top: none;
  text-align: left;
}
.site-footer a,
.site-footer a:visited { color: var(--fg); }
.phase-strip {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  max-width: 24rem;
  margin: 0 0 2.25rem;
}
.phase-strip svg { width: 22px; height: 22px; overflow: visible; }
.phase-strip .moon-dark { fill: none; stroke: #45454d; stroke-width: 1; }
.phase-strip .moon-lit { fill: var(--sand-dim); }
.phase-strip .tonight .moon-dark { stroke: var(--sand); }
.phase-strip .tonight .moon-lit { fill: var(--sand); }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin: 0 0 1rem;
}
.footer-mark {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.045em;
}
.footer-mark .muted { font-size: 1rem; font-weight: 400; letter-spacing: 0; color: var(--fg-dim); }
.footer-ring {
  display: flex;
  gap: 1rem;
  margin: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
}
.footer-ring a { text-decoration: none; }
.footer-ring a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
:root:not([data-skin="tui"]) .site-footer .footer-line {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  margin: 0 0 0.5rem;
}
:root:not([data-skin="tui"]) .site-footer .footer-icons { justify-content: flex-start; }
:root:not([data-skin="tui"]) .site-footer .footer-icons a:hover { color: #fff; border-color: #2a2a2f; }
