:root {
  --paper: #f5f6f2;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #68736d;
  --line: #d9dfd8;
  --acid: #dfff36;
  --green: #256f56;
  --red: #de5d46;
  --blue: #1f4e9a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 22px 24px; color: #f7f9f5; background: #1b2822; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; font-size: 12px; line-height: 1.15; letter-spacing: .11em; text-decoration: none; }
.brand b { color: var(--acid); font-weight: 600; }
.brand-mark { display: grid; width: 35px; height: 35px; place-items: center; color: #17201c; background: var(--acid); font-family: Georgia, serif; font-size: 23px; font-style: italic; }
.navigation { display: grid; gap: 5px; margin-top: 74px; }
.nav-item { display: flex; align-items: center; gap: 13px; padding: 11px 10px; border-left: 2px solid transparent; color: #c5cbc6; font-size: 14px; text-decoration: none; transition: .16s ease; }
.nav-item span { color: #78847d; font-family: ui-monospace, monospace; font-size: 10px; }
.nav-item:hover, .nav-item.active { border-left-color: var(--acid); color: white; background: #25342d; }
.sidebar-bottom { display: grid; gap: 7px; margin-top: auto; color: #aab5ae; font-size: 11px; }
.sidebar-bottom p { margin: 0; color: #77847d; text-transform: uppercase; letter-spacing: .12em; }
.sidebar-bottom code { width: fit-content; color: var(--acid); font-size: 11px; }
.sync-dot { display: flex; gap: 6px; align-items: center; margin-top: 16px; color: #cdd7d0; }
.sync-dot::before { width: 6px; height: 6px; border-radius: 50%; background: var(--acid); content: ""; }

main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 0 5.5vw; border-bottom: 1px solid var(--line); background: var(--paper); }
.eyebrow, .section-label { margin: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; letter-spacing: .12em; }
.search { display: flex; align-items: center; gap: 8px; width: min(310px, 35vw); padding: 8px 0; border-bottom: 1px solid #bfc8c1; color: var(--green); }
.search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search input::placeholder { color: #89938d; }
.menu-button { display: none; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 330px); gap: 48px; align-items: end; padding: 84px 5.5vw 58px; }
.section-label { color: var(--green); font-weight: 600; }
h1, h2, h3 { font-family: Georgia, "Noto Serif SC", serif; font-weight: 400; letter-spacing: 0; }
h1 { max-width: 710px; margin: 13px 0 0; font-size: clamp(40px, 5.2vw, 74px); line-height: 1.04; }
.intro-copy { max-width: 300px; margin: 0 0 6px; color: #4a5750; font-size: 15px; line-height: 1.8; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 5.5vw; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stats div { display: flex; gap: 10px; align-items: baseline; min-height: 77px; padding: 20px 0; border-right: 1px solid var(--line); }
.stats div + div { padding-left: 25px; }
.stats div:last-child { border-right: 0; }
.stats strong { font-family: Georgia, serif; font-size: 32px; font-weight: 400; }
.stats span { color: var(--muted); font-size: 12px; }

.library { padding: 75px 5.5vw 88px; }
.catalog-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 330px); gap: 48px; align-items: end; padding: 80px 5.5vw 34px; }
.catalog-hero h1 { margin: 11px 0 0; }
.catalog-hero > p { max-width: 300px; margin: 0; color: #4a5750; font-size: 15px; line-height: 1.8; }
.design-library { padding-top: 38px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 24px; }
h2 { margin: 9px 0 0; font-size: 30px; }
.filters { display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.filter { padding: 7px 10px; border: 1px solid var(--line); border-radius: 0; color: #536059; background: transparent; font-size: 12px; }
.filter:hover, .filter.active { border-color: var(--green); color: white; background: var(--green); }
.entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) 132px; min-height: 237px; padding: 22px; border: 0; color: inherit; background: var(--surface); text-align: left; transition: background .16s ease; }
.entry:hover, .entry:focus-visible { outline: none; background: #edf3e7; }
.entry-text { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.entry-type { color: var(--green); font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: .09em; }
.entry h3 { margin: 14px 0 7px; font-size: 25px; line-height: 1.18; }
.entry-summary { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.entry-footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 16px; }
.tag { padding: 4px 6px; color: #59665e; background: #edf0eb; font-family: ui-monospace, monospace; font-size: 10px; }
.entry-image { align-self: end; width: 100%; height: 132px; object-fit: cover; border: 1px solid var(--line); background: #e8ebe6; }
.open-document { margin-top: 17px; padding: 7px 0; border-bottom: 1px solid var(--green); color: var(--green); font-size: 12px; text-decoration: none; }
.open-document::after { margin-left: 7px; content: "→"; }
.open-document:hover, .open-document:focus-visible { outline: none; color: var(--ink); border-color: var(--ink); }
.empty-state { padding: 42px; border: 1px solid var(--line); color: var(--muted); text-align: center; }
.entry-grid.design-list { display: block; border: 0; background: transparent; }
.design-row { display: grid; grid-template-columns: 122px minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.design-row:last-child { border-bottom: 1px solid var(--line); }
.design-thumbnail { width: 122px; height: 100px; object-fit: cover; border: 1px solid var(--line); background: #e8ebe6; }
.design-details { min-width: 0; }
.design-details h3 { margin: 8px 0 5px; font-size: 25px; line-height: 1.18; }
.design-details p { max-width: 580px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.design-details .entry-footer { margin-top: 10px; padding-top: 0; }
.design-actions { display: grid; gap: 8px; justify-items: end; min-width: 90px; }
.open-design, .history-link { min-width: 90px; padding: 8px 10px; border: 1px solid var(--green); border-radius: 0; color: var(--green); background: transparent; font-size: 12px; text-align: center; text-decoration: none; }
.open-design:hover, .open-design:focus-visible { outline: none; color: white; background: var(--green); }
.history-link { border-color: var(--line); color: #536059; }
.history-link:hover, .history-link:focus-visible { outline: none; border-color: var(--ink); color: var(--ink); background: #eef2ec; }

.reader { display: grid; grid-template-columns: 165px minmax(0, 760px); gap: 5.5vw; padding: 64px 5.5vw 100px; background: #e8ede6; }
.reader-meta { padding-top: 10px; }
.reader-meta p:last-child { margin-top: 11px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.markdown { min-width: 0; padding: 48px clamp(25px, 5vw, 62px); background: var(--surface); box-shadow: 9px 10px 0 #d2d9cf; }
.markdown > :first-child { margin-top: 0; }
.markdown h2 { margin: 42px 0 16px; font-size: 34px; line-height: 1.15; }
.markdown h3 { margin: 31px 0 12px; font-size: 23px; }
.markdown p, .markdown li { color: #39463f; font-size: 15px; line-height: 1.78; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown a { color: var(--blue); }
.markdown code { padding: 2px 5px; background: #eef2ec; color: #255d48; font-family: ui-monospace, monospace; font-size: .88em; }
.markdown pre { overflow: auto; padding: 18px; background: #1b2822; }
.markdown pre code { padding: 0; color: #def8d9; background: transparent; font-size: 12px; line-height: 1.7; }
.markdown blockquote { margin: 24px 0; padding: 6px 0 6px 18px; border-left: 3px solid var(--acid); color: #4b5b52; font-family: Georgia, serif; font-size: 18px; line-height: 1.5; }
.markdown img { display: block; width: 100%; margin: 26px 0; border: 1px solid var(--line); }
.markdown table { width: 100%; border-collapse: collapse; font-size: 14px; }
.markdown th, .markdown td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.markdown th { color: var(--green); font-family: ui-monospace, monospace; font-size: 11px; }
footer { padding: 22px 5.5vw; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }

.history-page { min-height: 100vh; background: var(--paper); }
.history-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 5.5vw; border-bottom: 1px solid var(--line); }
.back-link { display: inline-flex; gap: 9px; align-items: center; color: var(--green); font-size: 13px; text-decoration: none; }
.arrow-back > span:first-child { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--green); font-size: 18px; line-height: 1; }
.back-link:hover, .back-link:focus-visible { outline: none; color: var(--ink); }
.arrow-back:hover > span:first-child, .arrow-back:focus-visible > span:first-child { border-color: var(--ink); }
.document-brand { color: var(--ink); }
.history-main { max-width: 1040px; margin: 0 auto; padding: 76px 5.5vw 100px; }
.history-project { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 36px; align-items: end; padding-bottom: 48px; border-bottom: 1px solid var(--ink); }
.history-project h1 { margin: 12px 0 0; font-size: clamp(40px, 5vw, 66px); }
.history-project p { max-width: 590px; color: var(--muted); line-height: 1.7; }
.history-cover { width: 160px; height: 126px; object-fit: cover; border: 1px solid var(--line); }
.history-count { margin: 38px 0 18px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: .1em; }
.history-list { border-top: 1px solid var(--line); }
.history-version { display: grid; grid-template-columns: 106px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.version-id { color: var(--green); font-family: ui-monospace, monospace; font-size: 13px; }
.version-id small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.history-version h2 { margin: 0 0 9px; font-size: 25px; }
.history-version p { margin: 0; color: var(--muted); font-size: 13px; }
.change-list { display: grid; gap: 6px; margin: 14px 0 0; padding-left: 18px; color: #39463f; font-size: 14px; line-height: 1.5; }
.current-badge { display: inline-block; margin-left: 8px; padding: 3px 5px; color: var(--green); background: var(--acid); font-family: ui-monospace, monospace; font-size: 9px; vertical-align: 3px; }
.history-error { padding: 32px 0; color: var(--muted); border-top: 1px solid var(--line); }
.document-page { min-height: 100vh; background: #e8ede6; }
.document-main { max-width: 900px; margin: 0 auto; padding: 72px 5.5vw 100px; }
.document-output { box-shadow: 9px 10px 0 #d2d9cf; }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 2; width: min(280px, 82vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 10px 0 30px #17201c44; }
  body.menu-open .sidebar { transform: translateX(0); }
  .menu-button { display: grid; gap: 5px; width: 28px; padding: 6px 0; border: 0; background: transparent; }
  .menu-button span { display: block; width: 23px; height: 2px; background: var(--ink); }
  .topbar { min-height: 61px; padding: 0 24px; }
  .eyebrow { display: none; }
  .search { width: min(280px, 75vw); }
  .intro { display: block; padding: 61px 24px 42px; }
  .intro-copy { margin: 29px 0 0; }
  .stats { margin: 0 24px; }
  .stats div, .stats div + div { display: block; min-height: 87px; padding: 14px 8px; }
  .stats strong { display: block; font-size: 27px; }
  .library { padding: 51px 24px 65px; }
  .catalog-hero { display: block; padding: 52px 24px 10px; }
  .catalog-hero > p { margin: 22px 0 0; }
  .section-heading { display: block; }
  .filters { justify-content: start; margin-top: 20px; }
  .entry-grid { grid-template-columns: 1fr; }
  .entry { min-height: 205px; grid-template-columns: minmax(0, 1fr) 108px; padding: 18px; }
  .entry-image { height: 108px; }
  .entry h3 { font-size: 22px; }
  .design-row { grid-template-columns: 90px minmax(0, 1fr); gap: 15px; }
  .design-thumbnail { width: 90px; height: 82px; }
  .design-details h3 { font-size: 21px; }
  .design-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; justify-items: stretch; }
  .open-design, .history-link { width: 100%; }
  .reader { display: block; padding: 50px 24px 72px; }
  .reader-meta { margin-bottom: 22px; }
  .markdown { padding: 34px 22px; box-shadow: 6px 7px 0 #d2d9cf; }
  .markdown h2 { font-size: 28px; }
  .history-topbar { min-height: 61px; padding: 0 24px; }
  .history-main { padding: 52px 24px 72px; }
  .history-project { grid-template-columns: 1fr; gap: 22px; }
  .history-cover { width: 120px; height: 95px; }
  .history-version { grid-template-columns: 1fr; gap: 12px; }
  .document-main { padding: 50px 24px 72px; }
  .document-brand { font-size: 10px; }
  .document-brand .brand-mark { display: none; }
}
