/* ALFHEIM site shell — 空无 direction, themed with Rose Pine Dawn and Kanagawa Wave. */

:root {
  color-scheme: light dark;
  /* Rose Pine Dawn */
  --bg: #faf4ed;
  --ink: #575279;
  --ink-2: #797593;
  --line: #dfdad9;
  --accent: #b4637a;
  --sans: "Inter Tight", "Noto Sans SC", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Noto Sans SC", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* Kanagawa Wave */
  --bg: #1f1f28;
  --ink: #dcd7ba;
  --ink-2: #938aa9;
  --line: #363646;
  --accent: #e46876;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    /* Kanagawa Wave */
    --bg: #1f1f28;
    --ink: #dcd7ba;
    --ink-2: #938aa9;
    --line: #363646;
    --accent: #e46876;
  }
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.8s ease,
    color 0.8s ease;
}

main {
  animation: page-in 0.9s ease both;
}

@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

button {
  color: inherit;
  font: inherit;
}

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

a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 60;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

.mono-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- masthead ---------- */

.masthead__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.masthead__brand {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.masthead__brand .brand-dot {
  color: var(--accent);
  font-weight: 400;
}

.masthead__nav {
  display: flex;
  align-items: baseline;
  gap: 28px;
}

.masthead__nav a {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: color 0.3s ease;
}

.masthead__nav a:hover {
  color: var(--ink);
}

.theme-toggle {
  padding: 4px;
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.theme-toggle:hover {
  color: var(--ink);
}

/* ---------- hero (featured essay) ---------- */

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 680px;
  min-height: 58vh;
  margin: 0 auto;
  padding: 15vh 24px 13vh;
}

.hero__kicker {
  margin-bottom: 56px;
  font-size: 11px;
  color: var(--ink);
}

.hero__title {
  margin-bottom: 36px;
  font-size: 34px;
  font-weight: 400;
  line-height: 1.6;
  text-wrap: pretty;
}

.hero__title a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.4s ease;
}

.hero__title a:hover {
  background-size: 100% 1px;
}

.hero__dek {
  margin-bottom: 52px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 2;
  text-wrap: pretty;
}

.hero__rule {
  margin-bottom: 20px;
  border: none;
  border-top: 1px solid var(--line);
}

.hero__meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- index ---------- */

.index {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px 15vh;
}

.index__head {
  margin-bottom: 36px;
}

.index__head .mono-label {
  font-size: 11px;
}

.index__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  font-size: 17px;
}

.index__row:last-of-type {
  border-bottom: 1px solid var(--line);
}

.index__title {
  font-size: inherit;
  font-weight: 400;
  line-height: 1.7;
}

.index__row em {
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  white-space: nowrap;
}

.index__row em b {
  color: var(--ink);
  font-weight: 400;
}

.index__row:hover .index__title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.home__footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px 64px;
  text-align: center;
}

/* ---------- 404 ---------- */

.not-found {
  max-width: 680px;
  margin: 0 auto;
  padding: 18vh 24px 20vh;
}

.not-found .not-found__kicker {
  margin-bottom: 56px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
}

.not-found .not-found__number {
  margin-bottom: 36px;
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
}

.not-found h1 {
  margin-bottom: 36px;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.7;
  text-wrap: pretty;
}

.not-found p {
  margin-bottom: 52px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 2;
  text-wrap: pretty;
}

.not-found a {
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition:
    color 0.3s ease,
    border-color 0.3s ease;
}

.not-found a:hover {
  color: var(--ink);
  border-color: var(--accent);
}

/* ---------- responsive & motion ---------- */

@media (max-width: 640px) {
  .hero {
    padding-top: 14vh;
  }

  .hero__title,
  .not-found__number {
    font-size: 28px;
  }

  .index__row {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  main {
    animation: none;
  }

  body {
    transition: none;
  }
}
