:root {
  --bg: #f7f1e4;
  --bg-accent: #e4ecdf;
  --paper: rgba(255, 252, 246, 0.88);
  --paper-strong: rgba(255, 252, 246, 0.95);
  --line: rgba(64, 53, 42, 0.12);
  --ink: #2b241e;
  --muted: #6d6155;
  --accent: #194c44;
  --accent-soft: rgba(25, 76, 68, 0.1);
  --shadow: 0 20px 60px rgba(74, 59, 41, 0.1);
  --radius: 24px;
  --content-width: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 32%),
    radial-gradient(circle at bottom right, rgba(197, 217, 207, 0.35), transparent 26%),
    linear-gradient(180deg, var(--bg), #efe6d4 100%);
  font-family:
    "BIZ UDPMincho",
    "Hiragino Mincho ProN",
    "Yu Mincho",
    "Noto Serif JP",
    serif;
  line-height: 1.85;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.brand {
  font-family:
    "Avenir Next",
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero,
.story-frame,
.story-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  padding: 32px;
  margin-bottom: 28px;
}

.hero h1,
.story-title {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.hero p {
  margin: 14px 0 0;
  max-width: 56rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.story-card {
  display: block;
  padding: 24px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.story-card:hover {
  transform: translateY(-3px);
  text-decoration: none;
  border-color: rgba(25, 76, 68, 0.25);
  box-shadow: 0 24px 70px rgba(74, 59, 41, 0.15);
}

.story-card h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
  line-height: 1.35;
}

.story-card p {
  margin: 0;
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family:
    "Avenir Next",
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.story-frame {
  padding: 28px;
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--content-width)) minmax(220px, 280px);
  gap: 28px;
  align-items: start;
}

.story-main {
  min-width: 0;
}

.story-intro {
  color: var(--muted);
  margin: 14px 0 0;
  font-size: 1rem;
}

.story-body {
  margin-top: 28px;
  font-size: clamp(1.08rem, 1.3vw + 0.85rem, 1.28rem);
  line-height: 2.1;
}

.story-body h1 {
  display: none;
}

.story-body h2,
.story-body h3 {
  margin: 2.5em 0 0.9em;
  line-height: 1.45;
  font-family:
    "Avenir Next",
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
}

.story-body h2 {
  font-size: 1.28em;
}

.story-body h3 {
  font-size: 1.12em;
  color: var(--muted);
}

.story-body p,
.story-body ul,
.story-body ol,
.story-body blockquote {
  margin: 0 0 1.15em;
}

.story-body ul,
.story-body ol {
  padding-left: 1.5em;
}

.story-body code {
  padding: 0.15em 0.38em;
  border-radius: 0.4em;
  background: rgba(22, 61, 56, 0.08);
  font-size: 0.92em;
  color: var(--accent);
}

.story-body .display-code {
  text-align: center;
  margin: 1.4em 0;
}

.story-body .display-code code {
  display: inline-block;
  padding: 0.45em 0.9em;
  font-size: 0.95em;
}

.story-body blockquote {
  padding-left: 1em;
  border-left: 3px solid rgba(25, 76, 68, 0.22);
  color: var(--muted);
}

.story-toc {
  position: sticky;
  top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-strong);
}

.story-toc h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family:
    "Avenir Next",
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
}

.story-toc ol {
  margin: 0;
  padding-left: 1.2em;
}

.story-toc li + li {
  margin-top: 0.5em;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.nav-link {
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-strong);
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

@media (max-width: 980px) {
  .story-layout {
    grid-template-columns: 1fr;
  }

  .story-toc {
    position: static;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
  }

  .hero,
  .story-frame {
    padding: 22px;
  }

  .story-card {
    padding: 20px;
  }
}
