:root {
  --ink: #12151e;
  --paper: #f8f6f2;
  --panel: #ffffff;
  --cream: #f1ece2;
  --navy: #16284a;
  --gold: #ba9435;
  --rust: #c84b2d;
  --muted: #6f6556;
  --line: #ddd4c4;
  --shadow: 0 14px 40px rgba(17, 22, 35, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(circle at 10% -10%, #f0eadf 0, transparent 40%),
    radial-gradient(circle at 100% 0%, #efe7d8 0, transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  line-height: 1.55;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.22;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.17'/%3E%3C/svg%3E");
}

.page {
  position: relative;
  z-index: 1;
  width: min(1080px, 100% - 2.2rem);
  margin: 1.4rem auto 2.6rem;
  padding: 1.25rem;
  border: 1px solid #efe6d6;
  background: linear-gradient(#fbf9f5, #f8f5ef);
  box-shadow: var(--shadow);
}

.hero {
  border-top: 3.9px solid var(--gold);
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 1.4rem;
  padding: 1.25rem 0.45rem 0.9rem;
}

h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(2.05rem, 3.6vw, 3.2rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 58ch;
}

.hero-meta {
  justify-self: end;
  text-align: right;
}

.badge {
  display: inline-block;
  margin: 0;
  background: var(--navy);
  color: #f3d888;
  font-family: "DM Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.32rem 0.6rem;
}

.author {
  margin: 0.65rem 0 0.08rem;
  color: #5a5144;
  font-size: 0.86rem;
  font-weight: 500;
}

.stack {
  margin: 0;
  color: #9b7d34;
  font-family: "DM Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
}

.github-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.github-link:hover {
  opacity: 0.85;
}

.github-link:focus-visible {
  outline: 2px solid #4f6fb4;
  outline-offset: 2px;
}

.hero-actions {
  margin-top: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-end;
}

.hero-actions-row {
  display: flex;
  gap: 0.42rem;
}

.hero-btn {
  display: inline-block;
  font-family: "DM Sans", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.45rem 0.68rem;
  border: 1px solid transparent;
}

.hero-btn-primary {
  width: 100%;
  text-align: center;
  background: var(--gold);
  color: #1b1b1b;
  border-color: var(--gold);
}

.hero-btn-secondary {
  background: transparent;
  color: #6c5a32;
  border-color: #c9b999;
}

.hero-btn-secondary:hover {
  background: #f4ebd7;
  border-color: #bca879;
  color: #4e3f1f;
}

.hero-btn:hover {
  opacity: 0.9;
}

.hero-btn:focus-visible {
  outline: 2px solid #4f6fb4;
  outline-offset: 2px;
}

.insight-bar {
  margin-top: 0.9rem;
  background: var(--navy);
  color: #edf0f8;
  padding: 0.85rem 1rem;
}

.insight-bar p {
  margin: 0;
  font-size: 0.86rem;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 1rem;
}

.insight-icon {
  align-self: center;
  color: #f3d888;
}

.insight-copy {
  display: block;
}

.insight-bar strong {
  color: #ffd98f;
}

.stat-grid {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.stat-card {
  background: var(--panel);
  padding: 0.9rem 0.86rem 1rem;
  text-align: center;
}

.value {
  margin: 0;
  font-family: "Playfair Display", serif;
  color: var(--navy);
  font-size: clamp(2rem, 3.1vw, 2.6rem);
  line-height: 0.95;
  font-weight: 700;
}

.label {
  margin: 0.2rem 0 0;
  font-family: "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #8f7228;
  font-size: 0.65rem;
}

.desc {
  margin: 0.24rem 0 0;
  color: #6f6758;
  font-size: 0.78rem;
}

.panel {
  margin-top: 0.95rem;
  background: var(--panel);
  border: 1px solid var(--line);
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gold);
}

.panel-main::before {
  background: var(--navy);
}

.panel-risk::before {
  background: var(--rust);
}

.panel-head {
  padding: 0.8rem 1rem 0.74rem 1.1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.kicker {
  margin: 0;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.58rem;
}

.panel h2 {
  margin: 0.13rem 0 0;
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  line-height: 1.12;
}

.tag {
  margin: 0;
  padding: 0.22rem 0.52rem;
  min-height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-radius: 2px;
  white-space: nowrap;
}

.warn {
  background: #e7f3e4;
  color: #185a2a;
}

.ok {
  background: #e7f3e4;
  color: #185a2a;
}

.caution {
  background: #fff3d6;
  color: #c62828;
}

.panel img {
  display: block;
  width: calc(100% - 2rem);
  margin: 0.9rem 1rem;
  height: auto;
  border: 1px solid #ece4d5;
}

.panel-note {
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--cream);
  padding: 0.64rem 1rem 0.74rem 1.1rem;
  color: #4d4539;
  font-size: 0.78rem;
}

.split-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem;
}

.split-panels .panel {
  display: flex;
  flex-direction: column;
}

.split-panels .panel img {
  margin-bottom: 0;
}

.split-panels .panel-note {
  flex: 1;
}

.bottom-grid {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.95rem 1rem;
}

.bottom-grid .card .kicker {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.bottom-grid .card .kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.card-risk {
  position: relative;
}

.card-risk::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--rust);
}

.card-recs {
  position: relative;
  padding-left: 1.2rem;
}

.card-recs::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gold);
}

.card-recs .recommendations {
  margin-top: 0.9rem;
  row-gap: 0.58rem;
}

.card-recs .recommendations li {
  grid-template-columns: 1.85rem 1fr;
  column-gap: 0.62rem;
}

.card-recs .recommendations li::before {
  width: 1.85rem;
  text-align: left;
}

.risk-row {
  margin-top: 0;
  padding: 0.58rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.62rem;
  font-size: 0.84rem;
}

.card-risk .risk-row:first-of-type {
  border-top: 0;
  margin-top: 0.45rem;
}

.pill {
  min-width: 70px;
  text-align: center;
  font-family: "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.59rem;
  font-weight: 500;
  padding: 0.2rem 0.4rem;
}

.pill.low {
  color: #24613d;
  background: #e3f3e9;
}

.pill.mod {
  color: #c62828;
  background: #fff3d6;
}

.summary-note {
  margin: 0.78rem 0 0;
  border-left: 4px solid var(--rust);
  background: #fbe9e5;
  color: #595042;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
}

.summary-note strong {
  color: #842f1e;
}

.recommendations {
  margin: 0.56rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: rec;
  display: grid;
  row-gap: 0.62rem;
}

.recommendations li {
  counter-increment: rec;
  margin: 0;
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 0.58rem;
  align-items: start;
  font-size: 0.83rem;
  line-height: 1.38;
}

.recommendations li::before {
  content: counter(rec);
  font-family: "Playfair Display", serif;
  color: #dfcc92;
  font-size: 2.05rem;
  line-height: 0.9;
  align-self: start;
  transform: translateY(-0.02em);
}

.quick-links {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.quick-links a {
  text-decoration: none;
  color: #27395a;
  border: 1px solid #c9b999;
  padding: 0.4rem 0.62rem;
  background: #faf6eb;
  font-size: 0.76rem;
  font-weight: 600;
}

.quick-links a:hover {
  background: #f4ebd7;
}

.quick-links a:focus-visible {
  outline: 2px solid #4f6fb4;
  outline-offset: 2px;
}

.quick-link-right-start {
  margin-left: auto;
}

.quick-link-primary {
  background: var(--gold) !important;
  border-color: var(--gold) !important;
  color: #1b1b1b !important;
}

.footer {
  margin-top: 1.05rem;
  border-top: 1px solid var(--line);
  background: #14223f;
  color: #e6e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.56rem 0.86rem;
  font-size: 0.7rem;
}

.footer p {
  margin: 0;
}

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

  .hero-meta {
    justify-self: start;
    text-align: left;
  }

  .hero-actions {
    align-items: flex-start;
  }

  .hero-actions-row {
    flex-wrap: wrap;
  }

  .split-panels,
  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 740px) {
  .page {
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
    padding: 0.7rem;
  }

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

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .panel img {
    width: calc(100% - 1.2rem);
    margin: 0.6rem;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
