:root {
  --paper: #f0f4f8;
  --ink: #050505;
  --muted: rgba(5, 5, 5, 0.52);
  --quiet: rgba(5, 5, 5, 0.34);
  --line: rgba(5, 5, 5, 0.14);
  --panel: rgba(240, 244, 248, 0.72);
  --font-heading: "Big Shoulders Display", sans-serif;
  --font-body: "Barlow Condensed", "Inter", Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-dark {
  --paper: #0d0d0d;
  --ink: #f3f3f3;
  --muted: rgba(243, 243, 243, 0.54);
  --quiet: rgba(243, 243, 243, 0.34);
  --line: rgba(243, 243, 243, 0.16);
  --panel: rgba(13, 13, 13, 0.72);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.board-nav,
.archive-top-nav {
  position: fixed;
  z-index: 100;
  left: 32px;
  right: 32px;
  top: 28px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  align-items: center;
  pointer-events: none;
}
.board-nav a,
.board-nav button,
.archive-top-nav a,
.archive-top-nav button { pointer-events: auto; }

.board-brand,
.archive-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  width: max-content;
}
.board-brand span,
.archive-brand span {
  font-family: var(--font-heading);
  font-size: 16px;
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: 0.055em;
  transform: scaleY(1.08);
}
.board-brand em,
.archive-brand em {
  font-size: 10px;
  line-height: 1;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.72;
}

.board-links,
.archive-nav-links {
  display: flex;
  gap: clamp(13px, 1.35vw, 22px);
  align-items: center;
}
.board-links a,
.archive-nav-links a {
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.075em;
  transition: opacity 240ms ease, filter 240ms ease, transform 280ms var(--ease-out), letter-spacing 280ms ease;
}
.board-links a:hover,
.board-links a[aria-current="page"],
.archive-nav-links a:hover,
.archive-nav-links a[aria-current="page"] {
  opacity: 0.58;
  filter: blur(0.8px);
  transform: translateY(-1px);
  letter-spacing: 0.12em;
}

.nav-controls,
.archive-nav-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  pointer-events: auto;
}
.sound-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  height: 22px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: none;
}
.sound-toggle { gap: 8px; opacity: 0.82; }
.sound-icon {
  width: 18px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  position: relative;
  display: inline-block;
}
.sound-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.sound-label { font-size: 10px; line-height: 1; font-weight: 700; letter-spacing: 0.12em; }
.toggle-track {
  width: 29px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  display: block;
  position: relative;
}
.toggle-dot {
  position: absolute;
  left: 3px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-50%);
  transition: transform 250ms var(--ease-out), background 250ms ease;
}
body.is-dark .toggle-track { background: currentColor; }
body.is-dark .toggle-dot { transform: translate(12px, -50%); background: var(--paper); }

.custom-cursor {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 999px;
  border: 1px solid #fff;
  background: transparent;
  pointer-events: none;
  opacity: 0.75;
  mix-blend-mode: difference;
  transition: width 280ms var(--ease-out), height 280ms var(--ease-out), margin 280ms var(--ease-out), opacity 180ms ease;
}
.custom-cursor.is-link {
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
}
.custom-cursor.is-image {
  width: 30px;
  height: 30px;
  margin-left: -15px;
  margin-top: -15px;
}
.custom-cursor span { display: none; }

body.is-page-leaving {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 360ms ease, filter 360ms ease;
}

@media (max-width: 980px) {
  body { cursor: auto; }
  .custom-cursor { display: none; }
  .board-nav,
  .archive-top-nav {
    left: 20px;
    right: 20px;
    top: 20px;
    grid-template-columns: 1fr auto;
    gap: 16px;
  }
  .board-links,
  .archive-nav-links {
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-top: 8px;
    gap: 10px;
  }
  .board-links a,
  .archive-nav-links a { font-size: 10px; }
  .sound-label { display: none; }
}

@media (pointer: fine) {
  body { cursor: none; }
  a, button { cursor: none; }
}

.chrome-grain {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.105;
  mix-blend-mode: overlay;
  background-image: url("../img/grain-texture-strong.png");
  background-repeat: repeat;
  background-size: 180px;
}

body.is-dark .chrome-grain {
  opacity: 0.13;
}

@media (max-width: 980px) {
  .chrome-grain { opacity: 0.08; }
}
