:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #617069;
  --paper: #f4f1e8;
  --panel: #fcfaf3;
  --line: #d8d0bd;
  --forest: #1f4a38;
  --moss: #9aa56b;
  --rust: #bb593c;
  --blue: #315d76;
  --shadow: 0 18px 55px rgba(38, 43, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(187, 89, 60, 0.11), transparent 32%),
    linear-gradient(225deg, rgba(49, 93, 118, 0.13), transparent 36%),
    var(--paper);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 42px);
  min-height: 100vh;
  padding: clamp(16px, 3vw, 36px);
}

.rail {
  border-right: 1px solid var(--line);
  padding-right: clamp(16px, 2vw, 28px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(28px, 7vh, 72px);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-block;
  background:
    linear-gradient(90deg, var(--forest) 0 45%, transparent 45% 55%, var(--rust) 55%),
    linear-gradient(var(--blue), var(--blue));
  clip-path: polygon(0 0, 100% 12%, 82% 100%, 8% 86%);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--rust);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.4rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.95;
  max-width: 12ch;
}

.rail-summary {
  margin-bottom: 28px;
}

.rail-summary span {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4rem;
  line-height: 0.9;
}

.rail-summary p {
  margin: 8px 0 0;
  color: var(--muted);
}

.analysis-list {
  display: grid;
  gap: 10px;
}

.analysis-button {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(252, 250, 243, 0.72);
  color: var(--ink);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.analysis-button:hover,
.analysis-button.active {
  transform: translateX(4px);
  border-color: var(--forest);
  background: var(--panel);
}

.analysis-button strong {
  display: block;
  margin-bottom: 6px;
}

.analysis-button small {
  color: var(--muted);
}

.workspace {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: clamp(18px, 3vw, 34px);
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
  max-width: 460px;
}

.meta-strip span {
  border: 1px solid var(--line);
  background: rgba(252, 250, 243, 0.7);
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.digest {
  max-width: 920px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 34px);
}

.digest h3 {
  margin: 26px 0 10px;
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.digest h3:first-child {
  margin-top: 0;
}

.digest p,
.digest li {
  font-size: 1rem;
  line-height: 1.65;
}

.digest ul {
  margin: 8px 0 20px;
  padding-left: 22px;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(14px, 2vw, 24px);
  align-items: start;
}

.story-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(38, 43, 35, 0.08);
}

.story-card img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
  background: #e1dbc9;
}

.story-copy {
  padding: 14px;
}

.story-copy strong {
  display: block;
  margin-bottom: 4px;
}

.story-copy p,
.story-copy small {
  color: var(--muted);
}

.metadata {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.metadata code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  color: var(--blue);
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 18px;
  }

  .workspace-header {
    display: grid;
  }

  .meta-strip {
    justify-content: start;
  }
}
