:root,
:root[data-theme="system"],
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0D10;
  --surface: #14171C;
  --text: #E8EAED;
  --muted: #8B919A;
  --accent: #6E7CF6;
  --border: #23272E;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #FAFAF9;
    --surface: #FFFFFF;
    --text: #1A1D21;
    --muted: #8B919A;
    --accent: #6E7CF6;
    --border: #E5E4E0;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --text: #1A1D21;
  --muted: #8B919A;
  --accent: #6E7CF6;
  --border: #E5E4E0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}

.nav-link {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--muted);
}

.nav-link:hover {
  color: var(--accent);
}

main {
  flex: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.hero {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  isolation: isolate;
}

.hero-pattern {
  position: absolute;
  inset: -1rem -2rem 0;
  color: var(--text);
  opacity: 0.06;
  pointer-events: none;
  z-index: -1;
}

.eyebrow,
.tag-row {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(2rem, 5.5vw, 2.85rem);
  max-width: 18ch;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 1.85rem);
}

.product-title-link {
  color: inherit;
  text-decoration: none;
}

.product-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.hero-sub {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.product,
.about {
  padding: 2.75rem 0;
  border-top: 1px solid var(--border);
}

.product p,
.about p {
  margin: 0 0 1.25rem;
  max-width: 54ch;
}

.tag-row {
  margin: 0;
  text-transform: none;
  letter-spacing: 0.04em;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-copy {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.footer-copy a {
  color: var(--muted);
  text-decoration: none;
}

.footer-copy a:hover {
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  position: relative;
  margin-left: auto;
}

.theme-btn {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.theme-btn .icon-sun,
.theme-btn .icon-moon {
  position: absolute;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.theme-btn .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.theme-btn .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

:root[data-theme="dark"] .theme-btn .icon-sun,
:root[data-theme="system"] .theme-btn .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

:root[data-theme="dark"] .theme-btn .icon-moon,
:root[data-theme="system"] .theme-btn .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .theme-btn .icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
  }

  :root[data-theme="system"] .theme-btn .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
  }
}

.theme-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  min-width: 8.5rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: 0 8px 24px color-mix(in srgb, #000 18%, transparent);
  z-index: 20;
}

.theme-menu button {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--muted);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.8125rem;
  cursor: pointer;
  text-align: left;
}

.theme-menu button:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.theme-menu button[aria-checked="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.theme-menu svg {
  flex-shrink: 0;
}

/* —— Edit mode (?edit=1) —— */
.edit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
}

.edit-bar-label {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.edit-bar-hint {
  flex: 1;
  min-width: 12rem;
}

.edit-bar button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.edit-bar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

:root[data-editing="true"] body {
  padding-bottom: 4.5rem;
}

:root[data-editing="true"] [data-content] {
  outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 2px;
  cursor: text;
}

:root[data-editing="true"] [data-content]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .site-header,
  .site-footer,
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero {
    padding-top: 3rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .theme-toggle {
    margin-left: auto;
  }
}
