:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-soft: #eef4fb;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0ea5e9;
  --accent-2: #22d3ee;
  --border: #dbe3ef;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --grad-accent: linear-gradient(135deg, var(--accent), var(--accent-2));
  --grad-accent-soft: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(34, 211, 238, 0.06));
  --grad-accent-strong: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(34, 211, 238, 0.14));
  --grad-ambient: linear-gradient(120deg, rgba(14, 165, 233, 0.16), rgba(34, 211, 238, 0.08));
  --grad-pill: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(34, 211, 238, 0.1));
  --shadow-strong: 0 18px 50px rgba(15, 23, 42, 0.14);
  --shadow-medium: 0 16px 46px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 14px 40px rgba(15, 23, 42, 0.12);
  --shadow-light: 0 10px 26px rgba(15, 23, 42, 0.1);
  --shadow-ambient: 0 12px 28px rgba(15, 23, 42, 0.18);
  --shadow-soft: 0 10px 28px rgba(14, 165, 233, 0.15);
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Base */
* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 20%, rgba(14, 165, 233, 0.14), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(34, 211, 238, 0.14), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

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

/* Layout */
.container {
  width: min(1140px, 100% - 48px);
  margin: 0 auto;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 8% 30%, rgba(14, 165, 233, 0.12), transparent 30%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.07);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  position: relative;
  z-index: 1;
  width: min(1140px, 100% - 48px);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: none;
  border: none;
  box-shadow: none;
}

.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--grad-accent);
  box-shadow: 0 0 0 8px rgba(14, 165, 233, 0.12);
  display: inline-block;
}

.brand-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.96rem;
  border: none;
  background: none;
}

.nav-links a:hover {
  color: var(--accent);
  box-shadow: none;
}

/* Main shell */
.page-body {
  flex: 1;
  padding: 88px 0 108px;
  position: relative;
  z-index: 1;
}

.content-wrap {
  position: relative;
  isolation: isolate;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(240, 245, 251, 0.92));
  border-radius: var(--radius-lg);
  padding: 38px 32px;
  box-shadow: var(--shadow-medium);
  overflow: hidden;
}

.content-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(14, 165, 233, 0.12), transparent 38%),
    radial-gradient(circle at 82% 0%, rgba(34, 211, 238, 0.12), transparent 36%);
  z-index: 0;
  pointer-events: none;
}

.content-wrap > * {
  position: relative;
  z-index: 1;
}

.site-footer {
  padding: 28px 0 36px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.05);
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.95rem;
}

.brandline {
  margin: 0 0 4px 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
}

/* Home sections & cards */
.section-title {
  margin: 6px 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--grad-ambient);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0b5fad;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 16px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(255, 255, 255, 0));
  z-index: 0;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-strong), 0 12px 32px rgba(14, 165, 233, 0.12);
}

.card > * {
  position: relative;
  z-index: 1;
}

.card h2 {
  margin: 8px 0 8px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

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

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 12px;
}

.meta-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.meta-date {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}

/* Tags & chips */
.meta-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--grad-pill);
  color: #0b5fad;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.15);
}

.pill.subtle {
  background: linear-gradient(135deg, #f8c18c 0%, #f59e0b 70%);
  color: #7c2d12;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.2);
}

.pill.ghost {
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.pill.stat {
  background: var(--grad-accent);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-soft);
}

/* Writeup page */
.writeup {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 38px 30px;
  box-shadow: var(--shadow-strong);
  position: relative;
  overflow: hidden;
}

.writeup::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.08), rgba(255, 255, 255, 0));
  z-index: 0;
  pointer-events: none;
}

.writeup > * {
  position: relative;
  z-index: 1;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
  transition: color 150ms ease, transform 150ms ease;
}

.back-link:hover {
  color: var(--accent);
  transform: translateX(-2px);
}

.writeup-hero {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.writeup h1 {
  margin: 6px 0 0;
  font-size: clamp(28px, 5vw, 36px);
  letter-spacing: -0.02em;
}

.writeup-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 18px 0 22px;
}

.stat-block {
  background: var(--grad-accent-soft);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow-light);
}

.stat-block.highlight {
  background: var(--grad-accent-strong);
  box-shadow: var(--shadow-soft);
}

.stat-block.wide {
  grid-column: 1 / -1;
}

.writeup .stat-block.wide {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stat-value.result {
  font-size: 1.3rem;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.writeup-body {
  margin-top: 32px;
  color: var(--text);
}

/* Markdown content */
.markdown-body h2 {
  margin-top: 36px;
  margin-bottom: 14px;
}

.markdown-body h3 {
  margin-top: 28px;
  margin-bottom: 12px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin-top: 0;
  margin-bottom: 22px;
}

.markdown-body code {
  font-family: var(--mono);
  background: rgba(15, 23, 42, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.95em;
}

.markdown-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 12px;
  overflow-x: auto;
  font-family: var(--mono);
  box-shadow: var(--shadow-ambient);
}

.markdown-body img {
  max-width: 100%;
  display: block;
  margin: 26px auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}

.markdown-body figure {
  margin: 26px 0;
}

.markdown-body figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 8px;
}

.markdown-body blockquote {
  margin: 0 0 22px 0;
  padding: 18px 20px;
  background: var(--grad-ambient);
  color: #0f172a;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body li {
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .container {
    width: 100%;
    padding: 0 16px;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-body {
    padding: 56px 0 76px;
  }

  .content-wrap {
    padding: 26px 20px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    width: 100%;
    flex-wrap: wrap;
  }
}
