/* The Cowboy's Playbook — companion site styles
 * Parchment / rust palette to match the print book.
 */
:root {
  --bg: #f7f3ea;          /* parchment */
  --bg-2: #efe9da;        /* deeper parchment */
  --ink: #1a1814;         /* near-black ink */
  --light: #a8a39a;       /* light gray accent */
  --rust: #7a3d2c;        /* rust accent */
  --gold: #b3893d;        /* gold accent */
  --line: #d5d0c5;        /* light parchment line */
  --maxw: 1080px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Helvetica Neue",
        "Segoe UI", Roboto, sans-serif;
}
a { color: var(--rust); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  font: inherit; cursor: pointer; background: var(--bg-2);
  border: 1px solid var(--line); padding: 0.45em 0.9em; border-radius: 6px;
  color: var(--ink);
}
button:hover { background: var(--bg); border-color: var(--rust); }
button.primary { background: var(--rust); color: white; border-color: var(--rust); }
button.primary:hover { background: #5e2d20; }
input[type=text], input[type=number], select {
  font: inherit; padding: 0.4em 0.6em;
  border: 1px solid var(--line); border-radius: 6px;
  background: white; color: var(--ink);
}

/* Header */
.site-hd {
  display: flex; justify-content: space-between; align-items: center;
  max-width: var(--maxw); margin: 0 auto;
  padding: 1.2rem 1.4rem 0.8rem;
}
.brand {
  display: flex; align-items: baseline; gap: 0.5rem;
  text-decoration: none; color: var(--ink);
}
.brand .cn {
  font-family: 'LXGW WenKai TC', 'Noto Serif TC', serif;
  font-size: 2.3rem; line-height: 1; color: var(--rust);
}
.brand .title {
  font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em;
}
.brand .sub {
  color: var(--light); font-size: 0.9rem; font-style: italic;
}
.site-nav { display: flex; gap: 1.2rem; font-size: 0.95rem; }
.site-nav a { color: var(--light); }
.site-nav a:hover { color: var(--rust); }

/* Footer */
.site-ft {
  max-width: var(--maxw); margin: 4rem auto 1rem; padding: 1.5rem 1.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem; color: var(--light);
}
.site-ft .cols {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.2rem;
}
.site-ft strong { color: var(--ink); }
.site-ft em { color: var(--light); }
.site-ft .rights { font-size: 0.75rem; }
@media (max-width: 720px) {
  .site-ft .cols { grid-template-columns: 1fr; }
}

/* Main content */
main {
  max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.4rem 2rem;
}

/* Index / search hero */
.search-hero {
  background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 1.5rem 1.5rem 1.2rem; margin-bottom: 1.5rem;
  display: grid; grid-template-columns: 1fr auto; gap: 1rem;
  align-items: end;
}
.search-hero h1 {
  margin: 0 0 0.2rem; font-size: 1.5rem; color: var(--ink);
}
.search-hero p {
  margin: 0 0 0.8rem; color: var(--light); font-size: 0.95rem;
}
.search-hero input {
  width: 100%;
}
.search-hero .filters {
  display: flex; gap: 0.5rem;
}
@media (max-width: 720px) {
  .search-hero { grid-template-columns: 1fr; }
}

/* Index grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem;
}
.card {
  background: white; border: 1px solid var(--line);
  border-radius: 8px; padding: 1rem 0.8rem 0.8rem;
  text-align: center; cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
  display: flex; flex-direction: column; align-items: center;
}
.card:hover { border-color: var(--rust); transform: translateY(-2px); }
.card .glyph {
  font-family: 'LXGW WenKai TC', 'Noto Serif TC', serif;
  font-size: 3rem; line-height: 1.1; color: var(--ink);
  display: flex; gap: 0.05em;
}
.card .glyph.phrase { font-size: 2.1rem; }
.card .pinyin {
  margin-top: 0.4rem; font-style: italic;
  color: var(--rust); font-size: 0.92rem;
}
.card .meaning {
  margin-top: 0.1rem; font-size: 0.82rem; color: var(--light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.card .num {
  position: relative; top: -0.5rem; left: 0;
  font-size: 0.7rem; color: var(--light); align-self: flex-start;
}

/* Entry detail */
.entry {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 1.5rem 1.6rem; margin-top: 1rem;
}
.entry-back {
  margin-bottom: 1rem; font-size: 0.9rem;
}
.entry-header {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0; align-items: stretch;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 1.2rem; margin-bottom: 1.2rem;
}
.entry-cell {
  text-align: center; padding: 0 0.5rem;
  display: flex; flex-direction: column;
}
.entry-cell + .entry-cell { border-left: 1px solid var(--line); }
.cell-label {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--rust);
}
.cell-sub {
  font-size: 0.78rem; color: var(--light); font-style: italic;
  margin-bottom: 0.5rem;
}
.cell-glyph {
  font-size: 5rem; line-height: 1; margin: 0.2rem 0;
  display: flex; justify-content: center; gap: 0.08em;
  min-height: 5rem;
}
.cell-glyph.phrase { font-size: 3.6rem; }
.cell-caption {
  margin-top: 0.4rem; font-size: 0.78rem; color: var(--light);
  font-style: italic;
}
.cell-pron { text-align: center; }
.cell-pron .ml { font-size: 0.78rem; color: var(--light); }
.cell-pron .pinyin {
  font-size: 1.7rem; font-weight: 700; color: var(--ink);
  letter-spacing: 0.01em;
}
.cell-pron .yomi {
  font-size: 0.95rem; margin: 0.2rem 0;
}
.cell-pron .meaning {
  margin-top: 0.4rem; color: var(--ink); font-weight: 600;
}
.font-picker {
  margin: 0.4rem auto 0; max-width: 95%;
}
.font-picker select { width: 100%; font-size: 0.85rem; }

/* Body sections */
.entry-body { display: grid; gap: 0.8rem; }
.entry-body section h3 {
  margin: 0 0 0.2rem; font-size: 0.85rem; color: var(--rust);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.entry-body section p { margin: 0; }

/* Stencil generator */
.stencil {
  margin-top: 1.6rem; padding: 1.2rem 1.4rem; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px;
}
.stencil h2 {
  margin: 0 0 0.6rem; font-size: 1.05rem; color: var(--ink);
}
.stencil p.lead {
  margin: 0 0 1rem; color: var(--light); font-size: 0.9rem; font-style: italic;
}
.stencil-controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem; margin-bottom: 1rem;
}
.stencil-controls label {
  display: flex; flex-direction: column; gap: 0.2rem;
  font-size: 0.85rem; color: var(--light);
}
.stencil-controls .row {
  display: flex; gap: 0.4rem; align-items: center;
}
.stencil-controls input[type=range] { flex: 1; }
.stencil-controls input[type=number] { width: 5em; }
.stencil-preview-wrap {
  display: flex; justify-content: center; align-items: center;
  background: white; border: 1px dashed var(--line); border-radius: 8px;
  padding: 1.5rem; min-height: 200px;
  overflow: auto;
}
.stencil-preview {
  display: block; max-width: 100%; height: auto;
}
.stencil-actions {
  display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem;
}

/* Soft sell under the download buttons — Wall-of-Shame voice */
.stencil-caption {
  margin-top: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: rgba(122, 61, 44, 0.05);
  border-left: 2px solid var(--rust);
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.45;
  font-style: italic;
}
.stencil-caption a { font-weight: 600; font-style: normal; white-space: nowrap; }

/* Print-book page reference badge above each entry */
.pb-page-badge {
  display: inline-block;
  margin: 0.4rem 0 1.1rem;
  padding: 0.32em 0.75em;
  background: rgba(179, 137, 61, 0.10);
  border: 1px solid rgba(179, 137, 61, 0.35);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: default;
}
.pb-page-badge strong { color: var(--rust); }

/* Prose pages (about / license) */
.prose { max-width: 720px; margin: 0 auto; }
.prose h1 { margin: 1rem 0 0.8rem; }
.prose p { margin: 0.7rem 0; }

/* Loading spinner */
.loading {
  text-align: center; padding: 4rem 0; color: var(--light); font-style: italic;
}

/* Print-book CTA */
.print-book {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 1.4rem;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  margin: 2rem 0;
}
.print-book.banner { margin: 2.5rem 0 1rem; }
.print-book .pb-cover { display: block; line-height: 0; }
.print-book .pb-cover img {
  width: 100%; height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}
.print-book .pb-cover:hover img { transform: translateY(-2px) scale(1.01); }
.print-book h2 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  color: var(--ink);
}
.print-book p {
  margin: 0 0 1rem;
  color: var(--ink);
  line-height: 1.5;
}
.pb-cta {
  display: inline-block;
  padding: 0.55em 1.1em;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
}
.pb-cta.primary {
  background: var(--rust);
  color: white;
  border: 1px solid var(--rust);
}
.pb-cta.primary:hover {
  background: #5e2d20;
  text-decoration: none;
}
.pb-cta.disabled {
  background: transparent;
  color: var(--light);
  border: 1px dashed var(--line);
  cursor: not-allowed;
  font-style: italic;
}
.pb-cta.secondary {
  background: transparent;
  color: var(--rust);
  border: 1px solid var(--rust);
  margin-left: 0.5rem;
}
.pb-cta.secondary:hover {
  background: rgba(122, 61, 44, 0.08);
  text-decoration: none;
}
.pb-cta-note {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--light);
  font-style: italic;
}
@media (max-width: 640px) {
  .pb-cta.secondary { margin-left: 0; margin-top: 0.5rem; }
  .print-book {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .print-book .pb-cover img {
    max-width: 200px;
    margin: 0 auto;
  }
}

/* Print-book CTA */
.print-book {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 1.4rem;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  margin: 2rem 0;
}
.print-book.banner { margin: 2.5rem 0 1rem; }
.print-book .pb-cover { display: block; line-height: 0; }
.print-book .pb-cover img {
  width: 100%; height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}
.print-book .pb-cover:hover img { transform: translateY(-2px) scale(1.01); }
.print-book h2 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  color: var(--ink);
}
.print-book p {
  margin: 0 0 1rem;
  color: var(--ink);
  line-height: 1.5;
}
.pb-cta {
  display: inline-block;
  padding: 0.55em 1.1em;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
}
.pb-cta.primary {
  background: var(--rust);
  color: white;
  border: 1px solid var(--rust);
}
.pb-cta.primary:hover {
  background: #5e2d20;
  text-decoration: none;
}
.pb-cta.disabled {
  background: transparent;
  color: var(--light);
  border: 1px dashed var(--line);
  cursor: not-allowed;
  font-style: italic;
}
.pb-cta.secondary {
  background: transparent;
  color: var(--rust);
  border: 1px solid var(--rust);
  margin-left: 0.5rem;
}
.pb-cta.secondary:hover {
  background: rgba(122, 61, 44, 0.08);
  text-decoration: none;
}
.pb-cta-note {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--light);
  font-style: italic;
}
@media (max-width: 640px) {
  .pb-cta.secondary { margin-left: 0; margin-top: 0.5rem; }
  .print-book {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .print-book .pb-cover img {
    max-width: 200px;
    margin: 0 auto;
  }
}

/* Wall of Shame page */
.wall {
  max-width: 720px; margin: 0 auto; text-align: center;
}
.wall-title {
  font-size: 2.4rem;
  margin: 0.6rem 0 0.4rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.wall-sub {
  margin: 0 0 1rem;
  color: var(--light);
  font-style: italic;
  font-size: 1.05rem;
}
.wall-glyph {
  font-family: 'LXGW WenKai TC', 'Noto Serif TC', serif;
  font-size: 6rem;
  line-height: 1;
  color: var(--rust);
  margin: 1.2rem 0 1.6rem;
}
.wall-intro {
  text-align: left;
  margin: 0.7rem auto;
  max-width: 680px;
  color: var(--ink);
  line-height: 1.6;
}

/* Entries */
.wall-entries {
  max-width: 720px;
  margin: 1.5rem auto;
  display: grid;
  gap: 0.8rem;
}
.wall-entry {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
}
.wall-entry h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  color: var(--rust);
}
.wall-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.6rem;
  padding: 0.18rem 0;
  align-items: baseline;
}
.wall-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--rust);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wall-body {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}
.wall-body.wall-tattoo {
  font-family: 'LXGW WenKai TC', 'Noto Serif TC', serif;
  font-size: 1.6rem;
  line-height: 1.1;
  color: var(--ink);
}
@media (max-width: 540px) {
  .wall-row { grid-template-columns: 1fr; gap: 0.1rem; }
  .wall-body.wall-tattoo { font-size: 1.4rem; }
}

/* Closing CTA wrapper */
.wall-cta-wrap {
  max-width: 720px;
  margin: 2.2rem auto 1rem;
  text-align: center;
}
.wall-cta-wrap h2 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.wall-cta-wrap > p {
  color: var(--ink);
  line-height: 1.55;
  max-width: 620px;
  margin: 0 auto 1.2rem;
}
