/* Design tokens */
:root {
  --bg:           #e8d5b0;
  --ink:          #1e0e00;
  --accent:       #7a3006;
  --text-muted:   #4a3010;
  --text-nav:     #5c3e14;

  --border:       #c4a872;
  --border-mid:   #d0b888;
  --border-gold:  #b89560;

  /* RGB channels for rgba() opacity variants */
  --tint-rgb:     130, 70, 10;
  --accent-rgb:   122, 48, 6;

  --font-display: 'IM Fell English', Georgia, serif;
  --font-body:    'EB Garamond', Georgia, serif;
  --font-mono:    'Fira Code', 'Courier New', monospace;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: clamp(16px, 1.25vw, 20px);
}

/* Base */
body {
  background: var(--bg);
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.6rem;
  color: var(--ink);
}

.container {
  max-width: clamp(48rem, 65vw, 80rem);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 6rem;
}

/* Header (shared) */
header {
  margin-bottom: 3.75rem;
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: clamp(3.15rem, 10.5vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

header p {
  margin-top: 0.7rem;
  font-style: italic;
  font-size: 1.6rem;
  color: #3e2608;
  line-height: 1.5;
}

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

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

/* Insert (after header, catalog) */
.insert {
  margin-top: -2rem;
  margin-bottom: 1.5rem;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-nav);
}

/* Section: centered ornamental break */
.section {
  margin-bottom: 4rem;
}

.section-title {
  display: flex;
  align-items: center;
  user-select: none;
  gap: 1rem;
  margin-bottom: 2rem;
  font-style: normal;
  font-variant-caps: small-caps;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Oxford rule: thick (2px) + thin (1px), fading away from text */
.section-title::before {
  content: '';
  flex: 1;
  height: 7px;
  background-image:
    linear-gradient(to right, transparent, var(--border-gold) 35%),
    linear-gradient(to right, transparent, var(--border-gold) 35%);
  background-size: 100% 2px, 100% 1px;
  background-position: top, bottom;
  background-repeat: no-repeat;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 7px;
  background-image:
    linear-gradient(to left, transparent, var(--border-gold) 35%),
    linear-gradient(to left, transparent, var(--border-gold) 35%);
  background-size: 100% 2px, 100% 1px;
  background-position: top, bottom;
  background-repeat: no-repeat;
}

/* Catalog items */
.item-list {
  display: flex;
  flex-direction: column;
}

.item {
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  padding: 0;
  border-bottom: 1px solid var(--border-mid);
  transition: background-color 200ms ease-in-out;
  overflow: hidden;
}

.item:first-child {
  border-top: 1px solid var(--border-mid);
}

.item:hover {
  background: rgba(238, 218, 180, 0.6);
}

.item-thumb {
  width: 8rem;
  flex-shrink: 0;
  object-fit: cover;
  object-position: center;
  display: block;
  mix-blend-mode: multiply;
}

.item-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 0 1.6rem;
}

.item-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.item-title {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.6rem;
  line-height: 1.3;
  min-width: 0;
}

.item-title a {
  color: inherit;
  text-decoration: none;
  transition: color 200ms ease-in-out;
}

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

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
  max-width: 17rem;
  margin-right: 0.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  user-select: none;
  font-variant-caps: small-caps;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  white-space: nowrap;
  background: rgba(var(--tint-rgb), 0.07);
  border: 1px solid rgba(var(--tint-rgb), 0.16);
  color: #7a4010;
}

.tag.accent {
  background: rgba(var(--tint-rgb), 0.13);
  border-color: rgba(var(--tint-rgb), 0.34);
  color: #5e2c06;
}

.item-desc {
  font-size: 1.5rem;
  color: #5a3a18;
  line-height: 1.65;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border-mid);
  margin-left: 0.1rem;
  hanging-punctuation: first last;
}

.item-desc code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(var(--tint-rgb), 0.08);
  padding: 0.05em 0.3em;
  border-radius: 2px;
}

/* Insert links */
.insert a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.4);
  text-underline-offset: 2px;
  transition: text-decoration-color 150ms ease;
}

.insert a:hover {
  text-decoration-color: rgba(var(--accent-rgb), 0.9);
}

/* Article page */
.container--article {
  max-width: clamp(42rem, 50vw, 56rem);
}

.page-nav {
  margin-bottom: 3rem;
  font-style: italic;
  font-size: 1.15rem;
}

.page-nav a {
  color: var(--text-nav);
  text-decoration: none;
  transition: color 150ms ease;
}

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

.article-header {
  margin-bottom: 2.5rem;
}

.article-title {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.article-header .tags {
  justify-content: flex-start;
  max-width: none;
  margin-bottom: 1.75rem;
}

.article-rule {
  border: none;
  height: 7px;
  margin-bottom: 2.5rem;
  background-image:
    linear-gradient(to right, var(--border-gold) 65%, transparent),
    linear-gradient(to right, var(--border-gold) 65%, transparent);
  background-size: 100% 2px, 100% 1px;
  background-position: top, bottom;
  background-repeat: no-repeat;
}

.article-content {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #2a1800;
}

.article-content p {
  margin-bottom: 1.3em;
}

.article-content h2 {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 2.25em;
  margin-bottom: 0.6em;
}

.article-content h3 {
  font-variant-caps: small-caps;
  font-weight: normal;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 2em;
  margin-bottom: 0.4em;
}

.article-content blockquote {
  margin: 1.75em 0;
  padding: 0.1em 0 0.1em 1.25rem;
  border-left: 2px solid var(--border);
  font-style: italic;
  color: #4a2e08;
}

.article-content blockquote p {
  margin-bottom: 0.4em;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(var(--tint-rgb), 0.07);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

.article-content pre {
  background: rgba(var(--tint-rgb), 0.06);
  border: 1px solid rgba(var(--tint-rgb), 0.16);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5em 0;
  line-height: 1.6;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: 0.9rem;
}

.article-content ul,
.article-content ol {
  padding-left: 1.75em;
  margin-bottom: 1.2em;
}

.article-content li {
  margin-bottom: 0.35em;
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.25em 0;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 150ms ease;
}

.article-content a:hover {
  text-decoration-color: rgba(var(--accent-rgb), 0.9);
}

.article-content strong {
  font-weight: 600;
  color: var(--ink);
}

.article-content em {
  font-style: italic;
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.75em auto;
  border-radius: 2px;
}

/* Mobile */
@media (max-width: 600px) {
  body {
    font-size: 1.2rem;
  }

  .container {
    padding: 3rem 1.1rem 4.5rem;
  }

  header {
    margin-bottom: 2.75rem;
    padding-bottom: 1.75rem;
  }

  header h1 {
    font-size: clamp(2.4rem, 10vw, 3.15rem);
  }

  header p {
    font-size: 1.2rem;
  }

  .insert {
    font-size: 1rem;
    margin-bottom: 0.35rem;
  }

  .section-title {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
  }

  .item {
    gap: 0.75rem;
  }

  .item-thumb {
    width: 6rem;
  }

  .item-content {
    padding: 1rem 0 1.1rem;
  }

  .item-title {
    font-size: 1.25rem;
  }

  .item-desc {
    font-size: 1.15rem;
  }

  .tag {
    font-size: 0.95rem;
  }

  .item-head {
    grid-template-columns: 1fr;
  }

  .tags {
    justify-content: flex-start;
    max-width: none;
  }

  .section {
    margin-bottom: 3rem;
  }

  .article-title {
    font-size: clamp(1.4rem, 6vw, 1.8rem);
  }

  .article-content {
    font-size: 1rem;
  }

  .article-content h2 {
    font-size: 1.25rem;
  }
}
