/* BYHS Digital Standards Lab — shared stylesheet.
   Direct port of the main site's design system (src/index.css): strict
   black/white grayscale, DM Sans body + Oswald display, cursor aura,
   blueprint grid, glow-ring cards, film grain. Self-hosted variable fonts. */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
  src: url("/fonts/oswald-latin.woff2") format("woff2");
}

:root {
  --background: hsl(0 0% 4%);
  --foreground: hsl(0 0% 96%);
  --muted: hsl(0 0% 12%);
  --muted-foreground: hsl(0 0% 60%);
  --border: hsl(0 0% 14%);
  --surface: hsl(0 0% 7%);
  --surface-dark: hsl(0 0% 2%);
  --surface-dark-foreground: hsl(0 0% 88%);
  --radius: 0.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
* { border-color: var(--border); }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at top, hsl(0 0% 8%) 0%, transparent 60%),
    radial-gradient(ellipse at bottom, hsl(0 0% 6%) 0%, transparent 60%);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  text-wrap: balance;
  letter-spacing: -0.01em;
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 0.5em;
}
p { text-wrap: pretty; overflow-wrap: break-word; }

::selection { background: var(--foreground); color: var(--background); }

a { color: inherit; }

.container { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.container-narrow { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }

/* ── text helpers ─────────────────────────────────────────────────────────── */
.text-gradient {
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  background-image: linear-gradient(135deg, hsl(0 0% 100%) 0%, hsl(0 0% 55%) 100%);
}
.eyebrow {
  font-family: "Oswald", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: hsl(0 0% 60%);
  font-weight: 400;
}

/* ── surfaces ─────────────────────────────────────────────────────────────── */
.glow-ring {
  box-shadow: 0 0 0 1px hsl(0 0% 100% / 0.06), 0 30px 80px -20px hsl(0 0% 100% / 0.08);
}
.card {
  position: relative;
  border: 1px solid hsl(0 0% 100% / 0.10);
  border-radius: 0.75rem;
  background: linear-gradient(to bottom, hsl(0 0% 100% / 0.05), hsl(0 0% 100% / 0.015));
  padding: 1.5rem;
  transition: transform 0.5s, border-color 0.5s;
}
.card:hover { transform: translateY(-4px); border-color: hsl(0 0% 100% / 0.22); }

/* Faint blueprint grid that fades at the edges */
.bg-grid {
  background-image:
    linear-gradient(hsl(0 0% 100% / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, hsl(0 0% 100% / 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
  mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
}

/* Film grain overlay — apply to relatively positioned containers */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  30% { transform: translate(3%, -8%); }
  50% { transform: translate(-3%, 4%); }
  70% { transform: translate(5%, 3%); }
  90% { transform: translate(-4%, 6%); }
}

/* ── cursor aura (ported from CursorAura.tsx) ─────────────────────────────── */
#aura {
  pointer-events: none;
  position: fixed;
  left: 0; top: 0;
  z-index: 1;
  height: 600px; width: 600px;
  border-radius: 9999px;
  opacity: 0;
  transition: opacity 0.7s;
  background: radial-gradient(circle, hsl(0 0% 100% / 0.05) 0%, hsl(0 0% 100% / 0.02) 35%, transparent 70%);
}

/* ── masked line reveal (hero) ────────────────────────────────────────────── */
.mask-line { display: block; overflow: hidden; padding-bottom: 0.18em; margin-bottom: -0.18em; }
.mask-line > span {
  display: block;
  transform: translateY(115%);
  animation: mask-rise 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes mask-rise { to { transform: none; } }

/* ── navbar (ported from Navbar.tsx) ──────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  transition: all 0.5s;
  background: transparent;
  border-bottom: 1px solid transparent;
  padding: 0.5rem 0;
}
.nav.scrolled {
  background: hsl(0 0% 4% / 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom-color: hsl(0 0% 14% / 0.6);
  padding: 0;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  transition: height 0.5s;
}
.nav.scrolled .nav-inner { height: 3.5rem; }
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}
.nav-brand img { height: 2rem; width: 2rem; transition: transform 0.3s; }
.nav-brand:hover img { transform: scale(1.1); }
.nav-brand span {
  font-family: "Oswald", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(0 0% 96% / 0.9);
  font-weight: 400;
}
.nav-brand span b { font-weight: 400; color: hsl(0 0% 96% / 0.5); }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a {
  font-size: 0.875rem;
  color: hsl(0 0% 96% / 0.6);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--foreground); }
@media (max-width: 640px) {
  .nav-brand span { display: none; }
  .nav-links { gap: 1.1rem; }
}

/* ── footer (ported from Footer.tsx) ──────────────────────────────────────── */
.footer {
  padding: 3rem 0;
  background: var(--surface-dark);
  border-top: 1px solid hsl(0 0% 96% / 0.05);
  margin-top: 5rem;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  text-align: center;
}
.footer img { height: 4rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; font-size: 0.875rem; color: hsl(0 0% 88% / 0.5); }
.footer-links a { text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--foreground); }
.footer-legal { color: hsl(0 0% 88% / 0.5); font-size: 0.875rem; }
.footer-legal .fine { margin-top: 0.25rem; color: hsl(0 0% 88% / 0.4); font-size: 0.75rem; }
.footer-legal a { color: inherit; }
@media (min-width: 768px) {
  .footer-inner { flex-direction: row; text-align: right; }
  .footer-links { justify-content: flex-start; }
}

/* ── article typography ───────────────────────────────────────────────────── */
.article { padding: 8.5rem 0 2rem; }
.article header { margin-bottom: 2.5rem; }
.article h1 { font-size: clamp(2rem, 5vw, 3rem); }
.article .meta { color: var(--muted-foreground); font-size: 0.875rem; }
.article h2 { font-size: 1.5rem; margin-top: 2.5rem; }
.article h3 { font-size: 1.15rem; margin-top: 1.8rem; }
.article p, .article li { color: hsl(0 0% 96% / 0.78); font-size: 1.02rem; }
.article li { margin-bottom: 0.4rem; }
.article code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: hsl(0 0% 100% / 0.07);
  border: 1px solid hsl(0 0% 100% / 0.08);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.article pre {
  background: var(--surface-dark);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
}
.article pre code { background: none; border: none; padding: 0; font-size: 0.85rem; line-height: 1.55; }
.article blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid hsl(0 0% 100% / 0.25);
  color: hsl(0 0% 96% / 0.65);
  font-style: italic;
}
.article table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.92rem; }
.article th, .article td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.article th { background: hsl(0 0% 100% / 0.05); font-weight: 600; }
.article a { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: hsl(0 0% 100% / 0.35); }
.article a:hover { text-decoration-color: var(--foreground); }

/* breadcrumbs */
.crumbs { font-size: 0.8rem; color: var(--muted-foreground); margin-bottom: 1.25rem; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.4rem; color: hsl(0 0% 40%); }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--foreground); }

/* chips */
.chip {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(0 0% 96% / 0.6);
  border: 1px solid hsl(0 0% 100% / 0.15);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* grids */
.grid-3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

.card h3 { font-size: 1.1rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { color: hsl(0 0% 96% / 0.6); font-size: 0.92rem; margin-bottom: 0; }
.card .chip { margin-bottom: 0.9rem; }

/* motion is a garnish, never a requirement */
@media (prefers-reduced-motion: reduce) {
  .grain::after { animation: none !important; }
  .mask-line > span { transform: none; animation: none !important; }
  html { scroll-behavior: auto; }
}
