:root {
  --bg: #FFF8F2;
  --fg: #2A1A1A;
  --accent: #E46B52;
  --accent-soft: #F4A78F;
  --muted: #7a6a66;
  --rule: #e8dcd3;
  --card: #ffffff;
  --ink: #3a2626;
  --maxw: 1160px;
  --shadow: 0 1px 0 rgba(42, 26, 26, 0.04), 0 8px 24px rgba(42, 26, 26, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); }

h1, h2, h3, h4 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.6em;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* Masthead */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}
.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  border-bottom: none;
}
.brand:hover { border-bottom-color: transparent; }
.logomark {
  width: 42px;
  height: 42px;
  color: var(--accent);
  flex-shrink: 0;
}
.brand-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.nav a {
  color: var(--fg);
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.nav a:hover { color: var(--accent); }

/* Status bar — field-note imperfection */
.statusbar {
  background: #2A1A1A;
  color: #FFF8F2;
  font-size: 13px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.statusbar .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.statusbar strong {
  color: var(--accent-soft);
  font-weight: 600;
}
.status-dot {
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(228, 107, 82, 0.25);
}

/* Hero */
.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--rule);
}
.hero .kicker {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 600;
  max-width: 900px;
  margin-bottom: 24px;
}
.hero .lede {
  font-size: 19px;
  color: var(--fg);
  max-width: 720px;
  margin: 0 0 28px;
}
.hero .meta {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

/* Content grid */
.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  padding: 56px 24px 72px;
}
@media (max-width: 840px) {
  .content { grid-template-columns: 1fr; gap: 40px; }
}

/* Post cards */
.feed {
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.post-card {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 48px;
}
.post-card:last-child { border-bottom: none; }
.post-card h2 {
  font-size: 28px;
  font-weight: 600;
  margin: 8px 0 12px;
  line-height: 1.2;
}
.post-card h2 a {
  color: var(--fg);
  border-bottom: none;
}
.post-card h2 a:hover { color: var(--accent); }
.post-card p {
  color: var(--fg);
  margin: 0 0 12px;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.tag {
  background: var(--accent);
  color: #fff;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
.readtime { font-style: italic; }
.readmore {
  margin-top: 14px !important;
  font-weight: 500;
  font-size: 15px;
}
.readmore a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.widget {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
}
.widget h3 {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.widget p {
  font-size: 15px;
  color: var(--fg);
  margin: 0 0 10px;
}
.widget .inline {
  font-weight: 500;
  font-size: 14px;
}
.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cats li, .archive li {
  border-bottom: 1px dotted var(--rule);
  padding: 8px 0;
  font-size: 14px;
}
.cats li:last-child, .archive li:last-child { border-bottom: none; }
.cats a {
  color: var(--fg);
  display: flex;
  justify-content: space-between;
  border-bottom: none;
}
.cats a:hover { color: var(--accent); }
.cats span {
  color: var(--muted);
  font-size: 12px;
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 10px;
}
.archive a {
  color: var(--fg);
  border-bottom: none;
}
.archive a:hover { color: var(--accent); }

.pattern-widget {
  padding: 0;
  background: var(--accent);
  color: #fff;
  overflow: hidden;
}
.pattern-widget svg {
  display: block;
  width: 100%;
  height: auto;
}

.note-widget {
  background: #FFF2E4;
  border-color: var(--accent-soft);
  transform: rotate(-0.6deg);
}
.scribble {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
  margin: 0;
  line-height: 1.45;
}

/* Single post */
.single {
  max-width: 760px;
  padding: 56px 24px 72px;
}
.single.wide { max-width: 960px; }
.single h1 {
  font-size: clamp(30px, 4.2vw, 44px);
  font-weight: 600;
  margin: 18px 0 20px;
  line-height: 1.15;
}
.single h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 14px;
}
.single .lede {
  font-size: 19px;
  color: var(--fg);
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  margin: 0 0 32px;
}
.single p {
  margin: 0 0 18px;
}
.single ol, .single ul {
  padding-left: 22px;
  margin: 0 0 22px;
}
.single li {
  margin-bottom: 10px;
}
.single strong { font-weight: 700; }
.single em { font-style: italic; }
.endnote {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

.diagram {
  margin: 40px 0;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--accent);
}
.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}
.diagram-cap {
  font-family: 'DM Sans', sans-serif;
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
  text-align: center;
}

/* Archive page */
.vol-section {
  margin: 48px 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.vol-section:last-of-type { border-bottom: none; }
.vol-section h2 {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 26px;
  margin-bottom: 8px;
}
.vol-year {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.archive-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.archive-list li {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule);
  align-items: baseline;
  font-size: 15px;
}
.archive-list li:last-child { border-bottom: none; }
.archive-list time {
  font-family: 'DM Sans', sans-serif;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.archive-list a {
  color: var(--fg);
  border-bottom: none;
}
.archive-list a:hover { color: var(--accent); }
.mark-new {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  transform: rotate(-2deg);
  display: inline-block;
}
@media (max-width: 560px) {
  .archive-list li { grid-template-columns: 60px 1fr; }
  .archive-list li .mark-new { grid-column: 2; justify-self: start; margin-top: 4px; }
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.cat-card h3 {
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--accent);
}
.cat-card p {
  font-size: 14px;
  color: var(--fg);
  margin: 0;
}

/* Glossary */
.equipment-diagram {
  margin: 32px 0 48px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--accent);
}
.equipment-diagram .diagram-title {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  color: var(--fg);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.equipment-diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.glossary dl {
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px 32px;
}
.glossary dt {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  color: var(--fg);
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
}
.glossary dd {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--fg);
}
.glossary dt:first-of-type, .glossary dd:first-of-type {
  border-top: none;
  padding-top: 0;
}
@media (max-width: 720px) {
  .glossary dl { grid-template-columns: 1fr; gap: 4px; }
  .glossary dt { border-top: 1px solid var(--rule); padding-top: 14px; }
  .glossary dd { border-top: none; padding-top: 4px; padding-bottom: 10px; }
}

/* Case files */
.case {
  margin: 40px 0 48px;
  padding: 28px 28px 8px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.case-head {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}
.case-no {
  color: var(--accent);
  font-weight: 700;
}
.case-lane {
  color: var(--fg);
}
.case-equip {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.case h2 {
  font-size: 22px;
  margin: 8px 0 18px;
}
.case p {
  margin: 0 0 14px;
  font-size: 15.5px;
}
.case strong { color: var(--fg); }

/* 404 */
.notfound {
  padding: 80px 24px 120px;
  max-width: 720px;
  text-align: left;
}
.big404 {
  color: var(--accent);
  margin-bottom: 20px;
}
.big404 svg {
  width: 260px;
  max-width: 100%;
  height: auto;
}
.notfound h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 18px;
}
.notfound .lede {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 24px;
}
.fallback {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}
.fallback li {
  border-bottom: 1px solid var(--rule);
  padding: 12px 0;
}
.fallback li:last-child { border-bottom: none; }

/* Footer */
.foot {
  border-top: 1px solid var(--rule);
  background: var(--bg);
  padding: 32px 0;
  margin-top: 40px;
}
.foot p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--muted);
}
.foot .small {
  font-size: 13px;
  font-style: italic;
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding: 48px 0 40px; }
  .content { padding: 40px 20px 56px; }
  .single { padding: 40px 20px 56px; }
  .masthead .wrap { flex-direction: column; align-items: flex-start; }
  .nav { width: 100%; }
  .case { padding: 22px 20px 4px; }
}