/* Inter – variable font, weights 100-900 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* JetBrains Mono – variable font, weights 100-800 */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

:root {
  --black: #0a1020;
  --white: #ffffff;
  --gray-200: #e5e5e5;
  --gray-400: rgba(255, 255, 255, 0.64);
  --gray-500: rgba(255, 255, 255, 0.45);
  --gray-600: rgba(255, 255, 255, 0.32);
  --gray-900: #0c1220;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --nav-bg: rgba(6, 10, 20, 0.4);
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

[data-theme="light"] {
  --black: #ffffff;
  --white: #111111;
  --gray-200: #333333;
  --gray-400: #555555;
  --gray-500: #777777;
  --gray-600: #999999;
  --gray-900: #f3f4f6;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  --surface-hover: rgba(0, 0, 0, 0.03);
  --nav-bg: rgba(255, 255, 255, 0.8);
}

html {
  font-family: var(--font);
  background: var(--black);
  color: var(--white);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Nav ── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 60px 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2e2066;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  transition:
    background 0.3s,
    box-shadow 0.3s;
}

.site-nav.scrolled {
  background: #2e2066;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo .wasm-banner {
  height: 28px;
  width: auto;
}

.nav-searchbox {
  max-width: 360px;
  padding: 6px 14px;
  margin: 0;
  margin-left: auto;
  margin-right: 12px;
  border-radius: 8px;
  position: relative;
  flex: 1;
  min-width: 0;
}

/* Search toggle button (hidden on desktop, shown on mobile) */
.search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-400);
  margin-left: auto;
  margin-right: 12px;
  flex-shrink: 0;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.search-toggle:hover {
  color: var(--white);
  border-color: var(--border-strong);
}

/* ── Nav buttons (shared) ── */
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-400);
  flex-shrink: 0;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.nav-btn:hover {
  color: var(--white);
  border-color: var(--border-strong);
}

.add-article-btn {
  margin-right: 8px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: auto;
  padding: 0 12px;
}

/* ── Theme toggle ── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-400);
  transition:
    color 0.15s,
    border-color 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--white);
  border-color: var(--border-strong);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}
[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme]) .theme-toggle .icon-sun {
  display: block;
}
[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Light mode: nav */
[data-theme="light"] .site-nav {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Light mode: invert SVG logo fill */
[data-theme="light"] .wasm-banner {
  fill: #111111;
}

/* Light mode: hero gradient */
[data-theme="light"] .hero-wrapper::before {
  background: radial-gradient(
    ellipse at center,
    rgba(100, 100, 100, 0.08) 0%,
    transparent 65%
  );
}

/* Light mode: article divider */
[data-theme="light"] .article {
  border-bottom-color: var(--border);
}

[data-theme="light"] .article-body {
  color: #555555;
}

[data-theme="light"] .article-tag {
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .searchbox-icon {
  stroke: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] #search-clear {
  fill: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .filter-dropdown {
  background: rgba(245, 245, 245, 0.92);
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

[data-theme="light"] .filter-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .filter-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .filter-pill {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.3);
  color: var(--black);
}

[data-theme="light"] .filter-pill:hover {
  border-color: rgba(0, 0, 0, 0.5);
}

/* ── Hero ── */
.hero-centered {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
}

.hero-wrapper {
  position: relative;
  min-height: auto;
  display: flex;
  align-items: center;
  overflow-x: clip;
  overflow-y: visible;
  padding-top: 124px;
  padding-bottom: 40px;
}

.hero-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200svh;
  z-index: -1;
  background:
    radial-gradient(
      circle at 30% 20%,
      hsla(247, 76%, 61%, 0.55) 0%,
      hsla(247, 76%, 61%, 0.3) 22%,
      hsla(247, 76%, 61%, 0) 60%,
      transparent 75%
    ),
    linear-gradient(
      hsla(247, 76%, 61%, 0.45) 0%,
      hsla(247, 76%, 61%, 0.3) 22%,
      hsla(247, 76%, 61%, 0.15) 40%,
      transparent 75%
    );
  pointer-events: none;
}

.hero {
  position: relative;
  padding: 0 60px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.hero-brand {
  margin-bottom: 0;
  flex-shrink: 0;
}

.hero-brand .wasm-banner {
  height: clamp(48px, 6vw, 96px);
  width: auto;
}

.hero-subtitle {
  font-family: var(--mono);
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  padding-top: 20px;
  margin: 0;
  margin-left: 0;
  text-align: left;
}

.hero h1 {
  font-size: clamp(45px, 5.3vw, 70px);
  font-weight: 700;
  line-height: 0.97;
  letter-spacing: -0.05em;
  margin-bottom: 48px;
  max-width: 880px;
}

.hero-sub {
  font-size: 18px;
  line-height: 1.7;
  color: var(--gray-400);
  max-width: 640px;
  font-weight: 400;
  margin-bottom: 48px;
}

.hero-sub .highlight {
  color: var(--white);
  font-weight: 500;
}

/* ── Section ── */
section {
  padding: 0 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.section-pad {
  padding-top: 0;
  padding-bottom: 120px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── Searchbox ── */
.searchbox {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 600px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-hover);
  transition: border-color 0.15s;
}

.searchbox:focus-within {
  border-color: var(--border-strong);
}

.searchbox-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  flex-shrink: 0;
  opacity: 0.5;
}

.searchbox input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--white);
  caret-color: var(--white);
}

.searchbox input::placeholder {
  color: var(--gray-500);
}

.searchbox-clear {
  width: 20px;
  height: 20px;
  opacity: 0.4;
  cursor: pointer;
  display: none;
  transition: opacity 0.15s;
}

.searchbox-clear:hover {
  opacity: 0.8;
}

.searchbox-clear.visible {
  display: block;
}

/* ── Filter dropdown ── */
.filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px;
  margin-left: 8px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.filter-btn:hover {
  color: var(--white);
}

.filter-btn.has-filters {
  color: var(--white);
}

.filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: rgba(6, 10, 20, 0.85);
  border-radius: 12px;
  padding: 8px 0;
  max-height: 320px;
  overflow-y: auto;
  min-width: 200px;
  z-index: 200;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.filter-dropdown::-webkit-scrollbar {
  width: 6px;
}

.filter-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.filter-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.filter-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.filter-dropdown.open {
  display: block;
}

.filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray-400);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition:
    color 0.15s,
    background 0.15s;
}

.filter-option:hover {
  background: var(--surface-hover);
  color: var(--white);
}

.filter-option.selected {
  color: var(--white);
}

.filter-topic-count {
  font-size: 11px;
  color: var(--gray-600);
  margin-left: 12px;
}

.article-tag {
  cursor: pointer;
}

/* ── Filter pills ── */
.filter-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--white);
  white-space: nowrap;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: border-color 0.15s;
}

.filter-pill:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

.filter-pill-x {
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.filter-pill:hover .filter-pill-x {
  opacity: 1;
}

/* ── Article list ── */
.article-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 32px;
  width: 100%;
}

.article-columns > .article:has(.article-photo-wrap) {
  grid-column: 1 / -1;
}

.article-columns > .article-editing {
  grid-column: 1 / -1;
  max-width: none;
  width: 100%;
}

/* ── Article card ── */
.article {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr auto;
  position: relative;
  padding: 24px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  transition: none;
}

.article:last-child {
  border-bottom: none;
}

.article::before,
.article::after {
  display: none;
}

.article-subheadline {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-400);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-headline {
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.article-headline a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}

.article-headline a:hover {
  opacity: 0.8;
}

.article-photo-wrap {
  aspect-ratio: 2 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 25px;
  margin-bottom: 16px;
}

.article-photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.article-photo-wrap.no-image {
  display: none;
}

/* Desktop: horizontal rows with image on the right */
@media (min-width: 1025px) {
  .article {
    grid-template-columns: 1fr 500px;
    max-width: 1280px;
    margin: 0 auto;
    grid-template-rows: auto auto auto 1fr;
    column-gap: 32px;
  }
  .article.article-editing {
    max-width: none;
    width: 100%;
  }
  .article-subheadline {
    grid-column: 1;
    grid-row: 1;
  }
  .article-headline {
    grid-column: 1;
    grid-row: 2;
  }
  .article-body {
    grid-column: 1;
    grid-row: 3;
  }
  .article-tags {
    grid-column: 1;
    grid-row: 4;
  }
  .article-photo-wrap {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
    width: 500px;
    margin-bottom: 0;
  }
}

.article-body {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 20px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  align-self: start;
}

.article-tag {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-400);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 16px;
  border-radius: 15px;
  transition: opacity 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-tag:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.article-tag.active {
  background: rgba(255, 255, 255, 0.8);
  color: rgba(0, 0, 0, 0.7);
  border-color: transparent;
}

/* ── Editable article ── */
.article-editing [contenteditable] {
  outline: none;
  border-radius: 2px;
}

.article-editing [contenteditable]:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-600);
  pointer-events: none;
}

.editable-headline {
  cursor: pointer;
}

.editable-headline:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-600);
}

.headline-popup {
  position: absolute;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--gray-900);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.headline-input {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  padding: 4px 0;
  width: 100%;
}

.headline-link-input {
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-400);
}

.headline-input::placeholder {
  color: var(--gray-600);
}

.headline-input:focus {
  border-bottom-color: var(--accent);
}

.article-editing .editable-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gray-500);
  border: 1px dashed var(--border);
  border-radius: 25px;
}

/* ── Footer ── */
footer {
  padding: 64px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-bottom p {
  font-size: 13px;
  color: var(--gray-600);
}

.footer-bottom a {
  font-size: 13px;
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-bottom a:hover {
  color: var(--white);
}

/* ── Legal page ── */
.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 120px 60px 80px;
}

.legal-page h1 {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 40px;
}

.legal-page h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.legal-page section {
  padding: 0;
  max-width: none;
  margin-bottom: 24px;
}

.legal-page p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--gray-400);
}

.legal-page hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.legal-page a {
  color: var(--gray-400);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-page a:hover {
  color: var(--white);
}

.legal-footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 60px 64px;
}

.legal-footer p {
  font-size: 13px;
  color: var(--gray-600);
}

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.rd1 {
  transition-delay: 0.08s;
}
.rd2 {
  transition-delay: 0.16s;
}
.rd3 {
  transition-delay: 0.24s;
}
.rd4 {
  transition-delay: 0.32s;
}

/* ── Responsive ── */
@media (max-width: 1000px) {
  .site-nav {
    padding: 0 28px 10px 28px;
  }
  .hero {
    padding: 0 28px 0;
  }
  section {
    padding-left: 28px;
    padding-right: 28px;
  }
  footer {
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 520px) {
  .nav-searchbox {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    max-width: none;
    margin: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 28px;
  }
  .nav-searchbox.open {
    display: flex;
  }
  .search-toggle {
    display: flex;
  }
}

@media (max-width: 1024px) {
  .hero-centered {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .hero-subtitle {
    padding-top: 0;
    align-self: flex-start;
    margin-left: 70px;
  }
  .hero-wrapper {
    padding-bottom: 16px;
  }
  .hero-brand .wasm-banner {
    height: 64px;
  }
  .section-pad {
    padding-top: 0;
    padding-bottom: 60px;
  }
  .article-columns {
    grid-template-columns: 1fr;
  }
  .article {
    grid-template-columns: 1fr;
  }
  .article-subheadline {
    order: -2;
  }
  .article-photo-wrap {
    width: 100%;
    order: -1;
  }
  .article-tag {
    font-size: 11px;
    padding: 4px 10px;
  }
  .article-tags {
    gap: 6px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 16px;
  }
}
