/* ZestyWorksheets — shared design system
   Playful "craft table" palette: warm paper background, coral primary accent,
   teal + yellow supporting accents. Distinct from ZestyTools (neutral utility)
   and PlainTally (conservative finance). No external fonts/requests — system
   font stack only, kept heavy on headings for a chunky, hand-labeled feel. */

:root {
  --bg: #fffaf0;
  --surface: #ffffff;
  --ink: #23262b;
  --ink-soft: #5c6169;
  --accent: #ff6b4a;
  --accent-dark: #e14f30;
  --accent-ink: #ffffff;
  --teal: #1fa89a;
  --teal-soft: #e3f6f3;
  --yellow: #ffc845;
  --yellow-soft: #fff4d9;
  --purple: #7c5cfc;
  --border: #ece2cd;
  --border-strong: #d8cbac;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 6px 20px rgba(35, 38, 43, 0.08);
  --shadow-sm: 0 2px 8px rgba(35, 38, 43, 0.06);
  --max-width: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent-dark);
}

a:hover {
  color: var(--accent);
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
}

p {
  color: var(--ink-soft);
}

/* ---------- Header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.logo:hover {
  color: var(--ink);
}

.logo .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  transform: rotate(-6deg);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.main-nav a:hover {
  background: var(--yellow-soft);
}

.main-nav a.current {
  background: var(--ink);
  color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-block;
  }
  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-bottom: 10px;
  }
  .main-nav.open {
    display: flex;
  }
  .main-nav a {
    padding: 10px 12px;
  }
  .site-header .wrap {
    flex-wrap: wrap;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero .eyebrow {
  display: inline-block;
  background: var(--yellow-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero p.lede {
  max-width: 640px;
  margin: 14px auto 0;
  font-size: 1.08rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  cursor: pointer;
  text-decoration: none;
  background: var(--surface);
  color: var(--ink);
  transition: transform 0.08s ease;
}

.btn:hover {
  transform: translateY(-1px);
  color: var(--ink);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* ---------- Cards / tool grid ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.tool-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.tool-card:hover {
  color: var(--ink);
  transform: translateY(-2px);
}

.tool-card .icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--teal-soft);
}

.tool-card h3 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.tool-card p {
  margin: 0;
  font-size: 0.92rem;
}

.tool-card .badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
}

.tool-card.soon {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.tool-card.soon .badge {
  background: var(--ink-soft);
}

/* ---------- Generic sections ---------- */

section {
  padding: 28px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 6px;
}

.section-sub {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 20px;
}

.faq dt {
  font-weight: 700;
  margin-top: 16px;
}

.faq dd {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* ---------- Breadcrumb ---------- */

.breadcrumb {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 14px 0 0;
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ---------- Handwriting practice ---------- */

.hw-word-block {
  margin: 0 0 26px;
  page-break-inside: avoid;
}

.hw-word-label {
  font-size: 0.7rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.ruled-line {
  position: relative;
  height: 52px;
  border-bottom: 2px solid #333;
  overflow: hidden;
}

.ruled-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed #aaa;
}

.ruled-line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  border-top: 1px dashed #ddd;
}

.trace-fill {
  position: absolute;
  left: 0;
  bottom: 2px;
  white-space: nowrap;
  color: #b7b7b7;
  font-family: "Comic Sans MS", "Segoe Print", cursive, var(--font);
  letter-spacing: 0.35em;
}

/* ---------- Crossword ---------- */

.crossword-grid {
  border: 2px solid #111;
}

.crossword-grid td {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #999;
  position: relative;
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.crossword-grid td.block {
  background: #222;
  border-color: #222;
}

.cw-num {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.55rem;
  font-weight: 600;
  color: #555;
  font-family: var(--font);
}

.clue-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

.clue-columns h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.clue-list {
  margin: 0;
  padding-left: 22px;
  font-size: 0.88rem;
}

.clue-list li {
  margin-bottom: 5px;
}

/* ---------- Sudoku grid ---------- */

.sudoku-grid {
  border-collapse: collapse;
  margin: 0 auto;
  border: 3px solid #111;
}

.sudoku-grid td {
  width: 42px;
  height: 42px;
  text-align: center;
  vertical-align: middle;
  font-size: 1.2rem;
  font-weight: 700;
  border: 1px solid #999;
  font-family: "Courier New", monospace;
}

.sudoku-grid td.given {
  color: #111;
}

.sudoku-grid td.solved-only {
  color: #b04a3a;
}

.sudoku-grid tr:nth-child(3n) td {
  border-bottom: 2px solid #111;
}

.sudoku-grid td:nth-child(3n) {
  border-right: 2px solid #111;
}

/* ---------- Ad slots ---------- */

.ad-unit {
  margin: 24px 0;
  text-align: center;
  overflow: hidden;
  min-height: 90px;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 24px 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.015),
    rgba(0, 0, 0, 0.015) 10px,
    transparent 10px,
    transparent 20px
  );
}

/* ---------- Generator layout ---------- */

.generator {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 24px;
  align-items: start;
  margin: 24px 0;
}

@media (max-width: 860px) {
  .generator {
    grid-template-columns: 1fr;
  }
}

.controls label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 14px 0 6px;
}

.controls label:first-child {
  margin-top: 0;
}

.controls .hint {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.78rem;
  display: block;
  margin-top: 2px;
}

.controls input[type="text"],
.controls input[type="number"],
.controls select,
.controls textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 9px 11px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}

.controls textarea {
  resize: vertical;
  min-height: 110px;
}

.controls input:focus,
.controls select:focus,
.controls textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.controls .row {
  display: flex;
  gap: 10px;
}

.controls .row > * {
  flex: 1;
}

.controls .radio-group,
.controls .check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.controls .radio-group label,
.controls .check-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  margin: 0;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

.controls .actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-pane {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.error-msg {
  background: #fdeceb;
  border: 2px solid #e2564a;
  color: #a3271c;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-top: 10px;
  display: none;
}

.error-msg.show {
  display: block;
}

/* printable sheet */

.sheet {
  background: #fff;
  color: #111;
}

.sheet-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.sheet-name-date {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #444;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.watermark {
  text-align: center;
  font-size: 0.72rem;
  color: #999;
  margin-top: 18px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 3px solid var(--ink);
  margin-top: 50px;
  padding: 28px 0;
  background: var(--surface);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.site-footer nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- Puzzle grids (word search / sudoku-style) ---------- */

.grid-table {
  border-collapse: collapse;
  margin: 0 auto;
}

.grid-table td {
  width: 30px;
  height: 30px;
  text-align: center;
  vertical-align: middle;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  font-family: "Courier New", monospace;
}

.grid-table td.hl {
  background: var(--yellow-soft);
  color: var(--accent-dark);
  border-radius: 4px;
}

.word-bank {
  columns: 3;
  column-gap: 18px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.word-bank li {
  break-inside: avoid;
  padding: 3px 0;
}

.word-bank li.skipped {
  text-decoration: line-through;
  color: #b04a3a;
}

.page-break {
  page-break-before: always;
  border-top: 2px dashed var(--border-strong);
  margin-top: 26px;
  padding-top: 20px;
}

@media print {
  .page-break {
    border-top: none;
    margin-top: 0;
  }
}

.sheet-subtitle {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 10px;
}

/* ---------- Bingo cards ---------- */

.bingo-cards {
  display: grid;
  gap: 24px;
}

.bingo-card {
  border: 2px solid #111;
  border-radius: 10px;
  padding: 14px;
}

.bingo-card h3 {
  text-align: center;
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.bingo-card table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.bingo-card td {
  border: 1px solid #333;
  height: 62px;
  text-align: center;
  vertical-align: middle;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px;
  word-break: break-word;
}

.bingo-card td.free {
  background: var(--yellow-soft);
  font-weight: 800;
  text-transform: uppercase;
}

@media print {
  .bingo-cards {
    display: block;
  }
  .bingo-card {
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
}

/* ---------- Scramble / math worksheet lists ---------- */

.problem-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 30px;
}

.problem-list li {
  break-inside: avoid;
  padding: 10px 0;
  border-bottom: 1px dotted #ccc;
  font-size: 1rem;
}

.problem-list .num {
  font-weight: 700;
  margin-right: 8px;
  color: var(--accent-dark);
}

.scramble-word {
  letter-spacing: 0.08em;
  font-weight: 800;
  font-family: "Courier New", monospace;
}

.hint {
  color: #777;
  font-size: 0.82rem;
  font-style: italic;
}

.answer-line {
  display: inline-block;
  min-width: 160px;
  border-bottom: 1px solid #666;
  margin-left: 6px;
}

.math-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px 24px;
}

.math-problem {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: right;
  border-bottom: 1px solid #999;
  padding-bottom: 18px;
}

.math-problem .op {
  display: block;
  text-align: right;
}

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .ad-unit,
  .controls,
  .no-print {
    display: none !important;
  }
  .generator {
    display: block;
  }
  .preview-pane {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  body {
    background: #fff;
  }
}
