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

/* ===== BASE ===== */
html, body {
  height: 100%;
  background: #0c0d0f;
  color: #ededed;
  font-family: "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.loaded {
  opacity: 1;
}

/* ===== TOP BAR ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 78px;
  background: rgba(12,13,15,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
}

.topbar-inner {
  max-width: 1600px;
  height: 100%;
  margin: 0 auto;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.95);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px 0;
  background: rgba(255,255,255,0.9);
}

/* ===== NAV ===== */
.nav {
  display: flex;
  gap: 2.2rem;
}

.nav a {
  position: relative;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.6);
  padding-bottom: 6px;
  transition: color 0.25s ease;
}

.nav a:hover,
.nav a.active {
  color: #ffffff;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0%;
  height: 1px;
  background: rgba(255,255,255,0.6);
  transition: width 0.28s ease, left 0.28s ease;
}

.nav a:hover::after,
.nav a.active::after {
  width: 100%;
  left: 0;
}

/* ===== PAGE ===== */
.page {
  padding-top: 120px;
}

.page-header {
  text-align: center;
  margin-bottom: 64px;
}

.page-header h1 {
  font-size: 2.4rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.9);
}

/* ===== CONTENT SURFACE ===== */
.content-surface {
  background: #181818;
}

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 6vw 130px;
}

/* ===== SEARCH ===== */
.search-box,
.search-status,
.search-results,
.search-empty {
  width: 100%;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.search-box { margin-bottom: 26px; }

.search-input {
  width: 100%;
  padding: 16px 20px;
  font-family: inherit;
  font-size: 1rem;
  color: #f3f3f3;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.14);
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.search-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.search-status {
  margin-bottom: 22px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.45);
}

.search-empty,
.search-none {
  max-width: 540px;
  margin-top: 4px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.5);
  list-style: none;
}

.search-results {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-result a {
  display: block;
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.search-result a:hover,
.search-result a:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  transform: translateY(-2px);
  outline: none;
}

.result-cat {
  display: block;
  margin-bottom: 8px;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.search-result h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.95);
}

.search-result .snippet {
  margin-bottom: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
}

.search-result .result-url {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
}

.search-result mark {
  padding: 0 2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

/* ===== FOOTER ===== */
.footer {
  height: 64px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.4);
}

/* ===== GRAIN ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.008'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {

  .topbar {
    height: 64px;
  }

  .brand {
    font-size: 0.9rem;
    letter-spacing: 0.18em;
  }

  .menu-toggle {
    display: block;
  }

  .nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #0c0d0f;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding: 28px 0 36px;
    border-bottom: 1px solid rgba(255,255,255,0.06);

    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .nav.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav a {
    font-size: 0.78rem;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .content {
    padding: 64px 6vw 110px;
  }

  .search-result a {
    padding: 16px 18px;
  }
}
