:root {
  --ink: #2a1f16;
  --paper: #fdfbf8;
  --paper-alt: #f6f0e8;
  --line: rgba(42, 31, 22, 0.13);
  --brand: #96551a;
  --brand-dark: #74400f;
  --brand-light: #c9822f;

  --font-display: "Fraunces", Georgia, serif;
  --font-body:
    "Source Sans Pro", "Segoe UI", system-ui, -apple-system, sans-serif;

  --rail-width: 300px;
  --content-max: 46rem;
  --wrap-max: 78rem;
}

@font-face {
  font-family: "Fraunces";
  src: url("https://fonts.gstatic.com/s/fraunces/v31/6NVi8FyLNQOQZAnv9bYEvDiIdE9Ea6Vha9zM_dTOnUUX.woff2")
    format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.6em;
  color: var(--brand-dark);
}

p {
  margin: 0 0 1.1em;
  max-width: 60ch;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  color: var(--brand-dark);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--wrap-max);
  margin-inline: auto;
}

.prose {
  max-width: var(--content-max);
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.35rem;
  border: 1px solid var(--brand-dark);
  color: var(--brand-dark);
  font-size: 0.95rem;
  border-radius: 2px;
}
.btn--primary {
  background: var(--brand-dark);
  color: var(--paper);
}
.btn--primary:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--paper);
}
.btn--ghost:hover {
  background: rgba(150, 85, 26, 0.08);
}

/* ---------- layout shell ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.rail {
  flex: 0 0 var(--rail-width);
  top: 0;
  position: sticky;
  height: 100vh;
  overflow: hidden;
  background: var(--paper-alt);
}

@media (min-width: 860px) {
  .rail::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 100%;
    background: var(--paper);
    z-index: 1;
    mask-image:
      linear-gradient(-45deg, red 16px, transparent 0),
      linear-gradient(-135deg, #000 16px, transparent 0);
    mask-position: right top;
    mask-repeat: repeat-y;
    mask-size: 32px 32px;
  }
}

.rail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(0.18) contrast(1.03);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.topbar__logo img {
  display: block;
  height: 86px;
  width: auto;
}

.topbar__nav {
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
}

.topbar__nav a {
  color: var(--ink);
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.topbar__nav a:hover {
  color: var(--brand);
}

.topbar__nav a.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.subnav {
  display: flex;
  gap: 2rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.subnav a {
  padding: 0.8rem 0;
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.6;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.subnav a:hover {
  opacity: 1;
  color: var(--brand);
}
.subnav a.is-active {
  opacity: 1;
  color: var(--brand-dark);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.content {
  flex: 1;
  padding: 2.75rem 2rem 4rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  opacity: 0.65;
}

@media (max-width: 860px) {
  .shell {
    flex-direction: column;
  }
  .rail {
    position: static;
    height: 220px;
    width: 100%;
    flex: none;
  }
  .rail img {
    filter: none;
  }
  .topbar {
    padding: 0.9rem 1.25rem;
  }
  .subnav {
    padding: 0 1.25rem;
    gap: 1.5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .subnav a {
    white-space: nowrap;
  }
  .content {
    padding: 2rem 1.25rem 3rem;
  }
  .footer {
    padding: 1rem 1.25rem;
    flex-direction: column;
    gap: 0.25rem;
  }
}
