/* ==========================================================================
   narilink. — Minimal Monochrome Design System
   Pure black & white, sparing Nari Media copper (#8C6246), Inter typography.
   ========================================================================== */

:root {
  /* Raw tokens */
  --bg-light: #ffffff;
  --bg-dark: #000000;

  --fg-light: #000000;
  --fg-dark: #ffffff;

  --muted-light: #525252;
  --muted-dark: #a3a3a3;

  --border-light: rgba(0, 0, 0, 0.1);
  --border-dark: rgba(255, 255, 255, 0.12);

  --surface-light: rgba(0, 0, 0, 0.03);
  --surface-dark: rgba(255, 255, 255, 0.05);

  --surface-hover-light: rgba(0, 0, 0, 0.06);
  --surface-hover-dark: rgba(255, 255, 255, 0.1);

  --accent: #8c6246;

  /* Default (light) with prefers-color-scheme fallback for older browsers */
  --bg: var(--bg-light);
  --fg: var(--fg-light);
  --muted: var(--muted-light);
  --border: var(--border-light);
  --surface: var(--surface-light);
  --surface-hover: var(--surface-hover-light);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--bg-dark);
    --fg: var(--fg-dark);
    --muted: var(--muted-dark);
    --border: var(--border-dark);
    --surface: var(--surface-dark);
    --surface-hover: var(--surface-hover-dark);
  }
}

/* Reflect explicit meta[name="color-scheme"] override in CSS */
:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
  --bg: var(--bg-dark);
  --fg: var(--fg-dark);
  --muted: var(--muted-dark);
  --border: var(--border-dark);
  --surface: var(--surface-dark);
  --surface-hover: var(--surface-hover-dark);
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
  --bg: var(--bg-light);
  --fg: var(--fg-light);
  --muted: var(--muted-light);
  --border: var(--border-light);
  --surface: var(--surface-light);
  --surface-hover: var(--surface-hover-light);
}

@supports (color: light-dark(white, black)) {
  :root {
    --bg: light-dark(var(--bg-light), var(--bg-dark));
    --fg: light-dark(var(--fg-light), var(--fg-dark));
    --muted: light-dark(var(--muted-light), var(--muted-dark));
    --border: light-dark(var(--border-light), var(--border-dark));
    --surface: light-dark(var(--surface-light), var(--surface-dark));
    --surface-hover: light-dark(var(--surface-hover-light), var(--surface-hover-dark));
  }
}

/* Base reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  accent-color: var(--accent);
}

body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: var(--fg);
  color: var(--bg);
}

/* Accessibility utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 0.875rem;
  background-color: var(--fg);
  color: var(--bg);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

/* Page shell */
.page {
  min-height: 100svh;
  max-width: 60rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: clamp(1.5rem, 4vw, 2.25rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--fg);
  text-decoration: none;
  border-radius: 0.25rem;
}

.brand-mark {
  display: block;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background-color: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.theme-toggle:hover {
  color: var(--fg);
  background-color: var(--surface);
}

.theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Show "Switch to dark" when currently light; show "Switch to light" when currently dark */
.theme-option--to-light {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .theme-option--to-dark {
    display: none;
  }
  .theme-option--to-light {
    display: inline-flex;
  }
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-option--to-dark {
  display: none;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-option--to-light {
  display: inline-flex;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-option--to-dark {
  display: inline-flex;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-option--to-light {
  display: none;
}

/* Main layout */
.main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Hero */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-block: clamp(2.5rem, 7vh, 5rem) clamp(2.25rem, 5.5vh, 4rem);
}

.hero-mark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background-color 180ms ease;
}

.hero-mark-button:hover {
  background-color: var(--surface);
}

.hero-mark {
  display: block;
}

/* Static resting state for signal path (default for reduced motion & paused) */
.signal {
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-mark-button:not([data-paused="true"]) .signal {
    opacity: 1;
    stroke-dasharray: 24 100;
    stroke-dashoffset: 124;
    animation: narilink-pulse 4.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  }
}

@keyframes narilink-pulse {
  0%, 8% {
    stroke-dashoffset: 124;
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  42% {
    stroke-dashoffset: -24;
    opacity: 1;
  }
  48%, 54% {
    stroke-dashoffset: -24;
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  88% {
    stroke-dashoffset: 124;
    opacity: 1;
  }
  94%, 100% {
    stroke-dashoffset: 124;
    opacity: 0;
  }
}

.hero-title {
  margin: 0;
  font-size: clamp(1.875rem, 5.8vw, 3.5rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-subtitle {
  margin: clamp(1rem, 2.5vw, 1.375rem) 0 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: clamp(0.9375rem, 2vw, 1.125rem);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: clamp(1.75rem, 4.5vw, 2.5rem) 0 0;
  padding: 0.4375rem 0.9375rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background-color: var(--surface);
  color: var(--fg);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.status-dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 9999px;
  background-color: var(--accent);
  flex-shrink: 0;
}

/* Hairline dividers */
.divider {
  width: 100%;
  height: 1px;
  margin: 0;
  border: 0;
  background-color: var(--border);
}

/* Three core pillars */
.pillars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem;
  padding-block: clamp(2.5rem, 6vh, 3.75rem);
  text-align: center;
}

@media (min-width: 40rem) {
  .pillars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
  }
}

.pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.pillar-icon {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--fg);
  opacity: 0.9;
}

.pillar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.pillar-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.4;
}

/* Footer */
.site-footer {
  padding-block: clamp(1.75rem, 4vw, 2.5rem);
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--fg);
  text-decoration: none;
  text-underline-offset: 0.22em;
  transition: opacity 150ms ease;
}

.site-footer a:hover {
  text-decoration: underline;
}
