:root {
  --bg: #f4f1ea;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: #ffffff;
  --text: #1a1813;
  --muted: #6e665b;
  --line: rgba(58, 48, 35, 0.16);
  --accent: #7b2d12;
  --accent-soft: rgba(123, 45, 18, 0.08);
  --shadow: 0 20px 50px rgba(62, 42, 20, 0.08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "URW Palladio L", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121313;
    --panel: rgba(24, 26, 27, 0.82);
    --panel-strong: #1b1d1e;
    --text: #ece8dd;
    --muted: #b7afa0;
    --line: rgba(255, 244, 222, 0.12);
    --accent: #ff9a6c;
    --accent-soft: rgba(255, 154, 108, 0.12);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(123, 45, 18, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(11, 88, 74, 0.08), transparent 28%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.12em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
}

.site-header__inner,
.page-shell {
  width: min(1100px, calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header__inner {
  padding: 2.4rem 0 1.4rem;
}

.site-header__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 0.96;
}

.site-header__title a {
  display: inline-flex;
  flex-direction: column;
  gap: 0.02em;
  color: inherit;
  text-decoration: none;
}

.site-header__title-line {
  display: block;
}

.site-header__subtitle {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.75rem;
  color: var(--muted);
}

.page-shell {
  padding: 1.5rem 0 3rem;
}

.panel,
.document-meta,
.document-body {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel,
.document-body,
.document-meta {
  padding: 1.35rem 1.5rem;
}

.index-layout,
.document-layout {
  display: grid;
  gap: 1rem;
}

.document-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 290px);
  align-items: start;
}

.document-meta {
  order: 2;
  position: sticky;
  top: 1rem;
}

.document-body {
  order: 1;
}

.document-meta__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.document-meta__note {
  margin: 0;
  color: var(--muted);
}

.metadata-list {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}

.metadata-list div {
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.metadata-list div:first-child {
  padding-top: 0;
  border-top: 0;
}

.metadata-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metadata-list dd {
  margin: 0.35rem 0 0;
}

.markdown-body {
  font-family: var(--serif);
  line-height: 1.7;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  line-height: 1.2;
  margin: 1.8em 0 0.65em;
}

.markdown-body h1,
.markdown-body h2 {
  font-family: var(--sans);
}

.markdown-body p,
.markdown-body li {
  overflow-wrap: anywhere;
}

.markdown-body blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 4px solid var(--accent);
  color: var(--muted);
}

.markdown-body code,
.markdown-body pre {
  font-family: var(--mono);
}

.markdown-body pre {
  padding: 1rem;
  overflow: auto;
  background: var(--panel-strong);
  border-radius: 16px;
  border: 1px solid var(--line);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.markdown-body th,
.markdown-body td {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  text-align: left;
}

.entry-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry-list li,
.history-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.entry-list li:first-child,
.history-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.entry-list__date,
.history-list__commit,
.empty-state,
.panel__header p {
  color: var(--muted);
}

.panel__header h2,
.panel h2 {
  margin: 0 0 0.75rem;
}

.panel__header p {
  margin: 0;
}

.history-list__commit {
  font-size: 0.92rem;
}

.print-header {
  display: none;
}

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

  .document-meta {
    order: 2;
    position: static;
  }

  .document-body {
    order: 1;
  }
}

@media print {
  :root {
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-strong: #ffffff;
    --text: #000000;
    --muted: #333333;
    --line: #999999;
    --accent: #000000;
    --accent-soft: #ffffff;
    --shadow: none;
  }

  body {
    background: #ffffff;
    font-size: 12pt;
  }

  .site-header,
  .document-meta,
  .panel:not(.markdown-body),
  .breadcrumbs,
  .history-list__commit,
  .entry-list__date {
    display: none !important;
  }

  .print-header {
    display: block;
    width: 100%;
    padding: 0 1cm;
  }

  .print-header__project,
  .print-header__path {
    margin: 0 0 0.2cm;
  }

  .print-header__project {
    font-weight: 700;
  }

  .page-shell {
    width: auto;
    margin: 0;
    padding: 0;
  }

  .document-layout {
    display: block;
  }

  .document-body {
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0 1cm 1cm;
  }
}
