/* bugni.cc — shared by every page: the wall, the light, the top bar */

:root {
  --wall: #f4f2ee;
  --ink: #17171c;
  --ink-2: #5a5a66;
  --line: rgba(23, 23, 28, 0.14);
  --glass: rgba(255, 255, 255, 0.42);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-shadow: rgba(40, 40, 80, 0.28);
  --tint: 0.26;
  /* speckle inside every sheet of glass */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.5 -0.4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.17'/%3E%3C/svg%3E");
  --serif: 'Instrument Serif', 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'DM Sans', 'Noto Sans TC', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --pad: clamp(1.25rem, 5vw, 5rem);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
  --wall: #0c0c10;
  --ink: #f1f0ec;
  --ink-2: #a5a5b2;
  --line: rgba(255, 255, 255, 0.16);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-edge: rgba(255, 255, 255, 0.2);
  --glass-shadow: rgba(0, 0, 0, 0.6);
  --tint: 0.2;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.5 -0.4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.14'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 400;
  background: var(--wall);
  color: var(--ink);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

html[data-lang="zh"] [data-l="en"],
html[data-lang="en"] [data-l="zh"] { display: none !important; }

/* ===== THE WALL: light canvas + plaster grain ===== */
#light {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.05; filter: invert(1); }

/* where a set of glass fins hangs on the wall; drawn by home.js */
.glass { position: absolute; pointer-events: none; }

main, .top { position: relative; z-index: 2; }

/* ===== TOP BAR ===== */
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--pad);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.top a { text-decoration: none; }
.top-nav { display: flex; gap: 1.6rem; }
.top-nav a, .mark { opacity: 0.75; transition: opacity 0.2s; }
.top-nav a:hover, .mark:hover { opacity: 1; }
.top-tools { display: flex; gap: 0.5rem; }
.top-tools button {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
  font-size: 0.68rem;
  transition: border-color 0.2s, transform 0.3s var(--ease);
}
.top-tools button:hover { border-color: var(--ink); transform: scale(1.06); }
@media (max-width: 640px) { .top-nav { display: none; } }
