/* KindleReady — clean, bookish, professional. No frameworks. */

:root {
  --ink: #2b2620;
  --muted: #6f675c;
  --paper: #faf8f4;
  --card: #ffffff;
  --accent: #8a5a2b;      /* warm leather brown */
  --accent-dark: #6f4520;
  --good: #2e7d32;
  --bad: #b3261e;
  --warn: #8a6d1a;
  --line: #e5ded2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--ink); color: #f5f1e8; }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { color: #f5f1e8; text-decoration: none; font-size: 1.35em; font-weight: bold; }
.site-header nav a {
  color: #d8d0bf; text-decoration: none; margin-left: 22px; font-size: 0.95em;
}
.site-header nav a:hover, .site-header nav a[aria-current="page"] {
  color: #fff; text-decoration: underline;
}

/* Small screens: stack brand above a centered nav instead of a cramped 2-row wrap */
@media (max-width: 600px) {
  .site-header .wrap { flex-direction: column; gap: 8px; }
  .site-header nav {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px;
  }
  .site-header nav a { margin-left: 0; }
}

/* Hero */
.hero { text-align: center; padding: 56px 0 36px; }
.hero h1 { font-size: 2.1em; line-height: 1.3; margin: 0 0 16px; }
.lede { font-size: 1.12em; color: var(--muted); max-width: 640px; margin: 0 auto 22px; }
.privacy-note {
  display: inline-block; background: #eef4ec; border: 1px solid #cfe0cc;
  color: #2e5b2e; border-radius: 20px; padding: 6px 16px; font-size: 0.9em;
  margin: 6px 0 0; font-family: Verdana, sans-serif;
}

/* Buttons */
.btn {
  display: inline-block; padding: 11px 26px; border-radius: 6px;
  border: 1px solid var(--accent); color: var(--accent);
  background: transparent; text-decoration: none; font-size: 1em;
  font-family: inherit; cursor: pointer; margin: 6px 8px 6px 0;
}
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 20px;
}
.card h3 { margin-top: 0; font-size: 1.08em; }
.card a { color: var(--accent); }

/* Panels & forms */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 26px; margin: 22px 0;
}
.file-label { display: block; font-weight: bold; margin-bottom: 8px; }
input[type="file"] { display: block; margin: 8px 0 18px; font-family: inherit; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: bold; margin-bottom: 6px; }
.field input[type="text"], .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 5px; font-family: inherit; font-size: 1em; background: #fff;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* subgrid: labels share one row height across columns, so inputs always align */
.field-row .field { display: grid; grid-template-rows: subgrid; grid-row: span 2; margin-bottom: 0; }
.field-row { margin-bottom: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* Status messages */
.status { padding: 12px 16px; border-radius: 6px; margin-top: 14px; background: #eef2f7; border: 1px solid #ccd9e8; }
.status.ok { background: #e8f5e9; border-color: #b9dfbc; color: var(--good); }
.status.error { background: #fbe9e7; border-color: #f0c6c2; color: var(--bad); }

/* Validation report */
.report { margin-top: 26px; }
.filename { font-family: monospace; font-size: 0.85em; }
.verdict { padding: 14px 18px; border-radius: 6px; margin: 16px 0; }
.verdict.pass { background: #e8f5e9; border: 1px solid #b9dfbc; color: var(--good); }
.verdict.fail { background: #fbe9e7; border: 1px solid #f0c6c2; color: var(--bad); }
.issue {
  background: var(--card); border: 1px solid var(--line);
  border-left-width: 5px; border-radius: 6px; padding: 16px 20px; margin: 14px 0;
}
.issue.error { border-left-color: var(--bad); }
.issue.warning { border-left-color: var(--warn); }
.issue h3 { margin: 0 0 8px; font-size: 1.05em; }
.badge {
  display: inline-block; font-size: 0.72em; padding: 2px 10px; border-radius: 20px;
  vertical-align: middle; margin-right: 8px; font-family: Verdana, sans-serif;
}
.badge.error { background: var(--bad); color: #fff; }
.badge.warning { background: var(--warn); color: #fff; }
.fix { background: #f6f1e7; padding: 10px 14px; border-radius: 5px; }
.small { font-size: 0.85em; }

/* Misc */
.muted { color: var(--muted); }
.steps li, .checklist li { margin-bottom: 10px; }
.faq dt { font-weight: bold; margin-top: 16px; }
.faq dd { margin: 4px 0 0; color: var(--muted); }
.pricing-teaser {
  background: var(--card); border: 2px solid var(--accent); border-radius: 10px;
  padding: 26px; margin: 40px 0; text-align: center;
}

/* Pricing */
.pricing { margin: 40px 0; }
.pricing-cards .card ul { padding-left: 20px; margin: 12px 0; }
.pricing-cards .card li { margin-bottom: 6px; }
.pricing-cards .card.featured { border: 2px solid var(--accent); }
.price { font-size: 1.6em; font-weight: bold; margin: 8px 0; }
.pill {
  display: inline-block; font-size: 0.62em; background: var(--accent); color: #fff;
  border-radius: 20px; padding: 2px 10px; vertical-align: middle;
  font-family: Verdana, sans-serif;
}
.linklike {
  background: none; border: none; padding: 0; color: var(--accent);
  text-decoration: underline; cursor: pointer; font: inherit;
}

/* Pro nav + modal */
.pro-nav.is-pro { color: #8fd694; font-weight: bold; }
.nav-badge {
  display: inline-block; font-size: 0.68em; background: var(--accent); color: #fff;
  border-radius: 12px; padding: 1px 8px; margin-left: 4px; vertical-align: middle;
  font-family: Verdana, sans-serif;
}
.nav-badge.is-pro { background: #2e7d4f; }
.pro-modal-backdrop {
  position: fixed; inset: 0; background: rgba(43, 38, 32, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.pro-modal-backdrop[hidden] { display: none; }
.pro-modal {
  background: var(--card); border-radius: 10px; padding: 28px;
  max-width: 420px; width: 100%; position: relative;
}
.pro-modal-close {
  position: absolute; top: 10px; right: 14px; background: none; border: none;
  font-size: 1.5em; cursor: pointer; color: var(--muted);
}
.pro-key-form { display: flex; gap: 8px; margin: 14px 0; }
.pro-key-form input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px;
  font-family: monospace; font-size: 0.95em;
}
.pro-key-form .btn { margin: 0; white-space: nowrap; }
.pro-msg { min-height: 1.4em; font-size: 0.92em; }
.pro-lock-note {
  display: block; margin: 12px auto 0; background: #f6f1e7;
  border: 1px dashed var(--accent); border-radius: 6px; padding: 8px 16px;
  cursor: pointer; font: inherit; color: var(--ink);
}
/* Template picker */
.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 10px 0 18px;
}
.tpl-card {
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  cursor: pointer; background: var(--card); transition: border-color 0.15s, box-shadow 0.15s;
}
.tpl-card:hover { border-color: var(--accent); }
.tpl-card.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(138, 90, 43, 0.15); }
.tpl-card.is-pro-tpl:not(.unlocked) .tpl-preview { filter: saturate(0.6); }
.tpl-preview {
  height: 170px; overflow: hidden; background: #fff;
  border-bottom: 1px solid var(--line); padding: 14px 16px; pointer-events: none;
  /* fade the bottom so clipped preview text looks intentional */
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 62%, transparent 98%);
}
.tpl-preview h1 { margin-top: 0; }
.tpl-meta { padding: 10px 14px 12px; }
.tpl-meta strong { font-size: 0.98em; }
.tpl-genre { color: var(--muted); font-size: 0.82em; margin-left: 8px; }
.tpl-badge {
  font-size: 0.72em; padding: 2px 10px; border-radius: 20px; margin-left: 8px;
  font-family: Verdana, sans-serif; vertical-align: middle;
}
.tpl-badge.free { background: #e8f5e9; color: var(--good); }
.tpl-badge.pro { background: #f6f1e7; color: var(--accent-dark); }
.tpl-card.unlocked .tpl-badge.pro { background: #e8f5e9; color: var(--good); }
.tpl-blurb { font-size: 0.84em; color: var(--muted); margin: 6px 0 0; }

/* Batch file list */
.file-list { list-style: none; padding: 0; margin: 0 0 16px; }
.file-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 5px;
  margin-bottom: 6px; background: #fff; font-size: 0.92em;
}
.file-list .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fstate { white-space: nowrap; font-family: Verdana, sans-serif; font-size: 0.85em; }
.ok-text { color: var(--good); }
.error-text { color: var(--bad); }

/* Validator one-click fixes */
.btn.small { padding: 7px 16px; font-size: 0.88em; }
.fix-actions { margin: 10px 0 2px; }
.fix-btn.locked { border-style: dashed; }

/* Print layout: only #print-root shows when printing */
#print-root { display: none; }
@media print {
  body.printing > :not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
}

/* Guides */
.guide { max-width: 720px; }
.guide h2 { margin-top: 2em; }
.guide .lede { font-size: 1.08em; color: var(--ink-soft, #444); }
.crumbs { font-size: 0.88em; color: #888; margin-bottom: 0.5em; }
.crumbs a { color: #888; }
.cta-box {
  margin: 2.5em 0; padding: 1.2em 1.5em;
  background: #faf7f0; border: 1px solid #e8ddc8; border-radius: 12px;
}
.guide-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.guide-card {
  display: block; padding: 1.2em 1.4em; border: 1px solid #e5e0d5;
  border-radius: 12px; text-decoration: none; color: inherit;
}
.guide-card:hover { border-color: var(--accent); }
.guide-card h3 { margin: 0 0 0.4em; font-size: 1.05em; }
.guide-card p { margin: 0; font-size: 0.92em; color: #666; }
h1 { font-size: 1.9em; }
h2 { font-size: 1.35em; margin-top: 38px; }
a { color: var(--accent); }

.site-footer {
  margin-top: 60px; padding: 22px 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.9em; text-align: center;
}
