:root {
  color-scheme: light;
  --ink: #182026;
  --muted: #5c6870;
  --line: #d8dee2;
  --paper: #ffffff;
  --wash: #f3f5f4;
  --red: #b4372f;
  --red-dark: #892820;
  --green: #245b49;
  --focus: #1667a8;
  --max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

img { display: block; max-width: 100%; }

.shell {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.nav-links a:hover { color: var(--ink); }

.intro {
  min-height: 360px;
  padding: 72px 0 58px;
  background: var(--wash);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 18ch;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 54px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 9px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.lede {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 19px;
}

.section { padding: 62px 0; }
.section.alt { background: var(--wash); border-block: 1px solid var(--line); }

.section-head {
  max-width: 680px;
  margin-bottom: 30px;
}

.section-head p { color: var(--muted); }

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.book-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 154px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.book-cover {
  width: 154px;
  height: auto;
  aspect-ratio: 5 / 8;
  object-fit: cover;
  border: 1px solid #c7ced2;
  box-shadow: 0 12px 24px rgba(24, 32, 38, 0.14);
}

.book-card p { color: var(--muted); }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.tag {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.link-arrow {
  color: var(--red-dark);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.link-arrow:hover { text-decoration: underline; }

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.principle {
  padding-top: 16px;
  border-top: 3px solid var(--green);
}

.principle p { margin-bottom: 0; color: var(--muted); }

.product-hero {
  padding: 64px 0;
  background: var(--wash);
  border-bottom: 1px solid var(--line);
}

.product-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.product-cover {
  width: 280px;
  height: auto;
  aspect-ratio: 5 / 8;
  object-fit: cover;
  border: 1px solid #c7ced2;
  box-shadow: 0 18px 36px rgba(24, 32, 38, 0.16);
}

.product-copy h1 { font-size: 46px; }
.product-copy .subtitle { color: var(--muted); font-size: 20px; }

.actions {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid var(--red);
  border-radius: 5px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.button.secondary:hover { border-color: var(--ink); }

.button[aria-disabled="true"] {
  cursor: not-allowed;
  background: #e5e9eb;
  border-color: #d4dade;
  color: #68757d;
}

.empty-state {
  padding: 24px 0;
  border-block: 1px solid var(--line);
  color: var(--muted);
}

.edition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.edition {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.edition.featured { border-top: 4px solid var(--green); }
.edition ul { margin: 14px 0 0; padding-left: 20px; }
.edition li { margin-bottom: 8px; }
.price { color: var(--red-dark); font-size: 22px; font-weight: 850; }

.prose {
  width: min(760px, 100%);
}

.prose h1 { font-size: 44px; }
.prose h2 { margin-top: 34px; font-size: 26px; }
.prose p, .prose li { color: #344047; }

.site-footer {
  padding: 36px 0;
  border-top: 1px solid var(--line);
  background: #182026;
  color: #e7ecef;
}

.footer-layout {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: #c9d2d7; font-size: 13px; text-decoration: none; }
.footer-links a:hover { color: #fff; }
.copyright { margin: 7px 0 0; color: #aebbc2; font-size: 13px; }

.admin-body { background: var(--wash); }
.admin-main { min-height: calc(100vh - 170px); }
.admin-shell { max-width: 1040px; }

.admin-heading,
.admin-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.admin-heading { margin-bottom: 28px; }
.admin-heading h1 { margin-bottom: 8px; font-size: 44px; }
.admin-heading p { color: var(--muted); }
.admin-section-heading { align-items: center; margin-bottom: 14px; }
.admin-section-heading h2 { margin: 0; font-size: 28px; }

.admin-panel {
  width: min(820px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.auth-panel { width: min(520px, 100%); margin: 28px auto; }
.auth-panel h1 { font-size: 38px; }
.editor-panel { width: 100%; margin-top: 34px; }
.danger-panel { border-top: 4px solid var(--red); }

.notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.notice.success { border-color: #7da997; background: #edf6f1; color: #183f32; }
.notice.error { border-color: #d39a96; background: #fff1f0; color: #76251f; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 800; }
.field small { color: var(--muted); font-size: 12px; }

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #b9c3c9;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.field textarea { min-height: 90px; resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--focus); outline: 2px solid rgba(22, 103, 168, 0.18); }

.admin-list { margin-top: 18px; }
.admin-table-wrap { overflow-x: auto; border-block: 1px solid var(--line); background: var(--paper); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.admin-table th,
.admin-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.admin-table td small { display: block; margin-top: 3px; color: var(--muted); }
.admin-table td:last-child { white-space: nowrap; }
.admin-table td:last-child a { margin-right: 12px; }

.status {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 4px;
  background: #e7ecef;
  color: #42515a;
  font-size: 12px;
  font-weight: 800;
}

.status.published { background: #e2f1e9; color: #1d5743; }
.danger-link { color: var(--red-dark); }
.button.danger { background: var(--red-dark); border-color: var(--red-dark); }

@media (max-width: 900px) {
  .book-grid { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 28px, var(--max)); }
  .nav { min-height: 60px; }
  .nav-links a:not(:last-child) { display: none; }
  .intro { min-height: 320px; padding: 52px 0 44px; }
  h1 { font-size: 40px; }
  h2 { font-size: 30px; }
  .lede { font-size: 17px; }
  .section { padding: 46px 0; }
  .book-card { grid-template-columns: 105px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .book-cover { width: 105px; }
  .book-card h3 { font-size: 17px; }
  .product-layout { grid-template-columns: 105px minmax(0, 1fr); gap: 18px; }
  .product-cover { width: 105px; }
  .product-copy h1 { font-size: 32px; }
  .product-copy .subtitle { font-size: 16px; }
  .edition-grid { grid-template-columns: 1fr; }
  .footer-layout { flex-direction: column; }
  .admin-heading { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .admin-panel { padding: 20px; }
}

@media (max-width: 430px) {
  .product-layout { grid-template-columns: 1fr; }
  .product-cover { width: min(220px, 68vw); }
  .book-card { grid-template-columns: 88px minmax(0, 1fr); }
  .book-cover { width: 88px; }
  .tag { font-size: 11px; }
}
