/* Front Porch Printables */
:root {
  --cream: #FBF7EE;
  --sheet: #FFFFFF;
  --red: #A8262B;
  --red-dark: #7C1A1E;
  --navy: #1F3A5F;
  --navy-dark: #152A45;
  --blue-soft: #E3EAF3;
  --line: #CDD6E1;
  --ink: #1C2633;
  --ink-soft: #4A5767;
  --check: rgba(168, 38, 43, .55);
  --display: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red-dark); }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: .2em 0 .35em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin: 0 0 .6em; }
.wrap { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(720px, 100% - 2.5rem); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--sheet); padding: .5rem 1rem; }
.small { font-size: .95rem; color: var(--ink-soft); }
.lede { font-size: 1.2rem; max-width: 62ch; color: var(--ink-soft); margin: 0 0 1.75rem; }

/* ---------- The painted porch sign header ---------- */
.sign {
  background-color: var(--navy);
  color: var(--cream);
  position: relative;
  padding-bottom: 18px;
}
.sign::after, .foot::before {
  content: ""; position: absolute; left: 0; right: 0; height: 18px;
  background-color: #fff;
  background-image:
    linear-gradient(90deg, var(--check) 50%, transparent 50%),
    linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 18px 18px;
}
.sign::after { bottom: 0; }
.sign-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; padding-block: .9rem; }
.wordmark { color: var(--cream); text-decoration: none; display: flex; flex-direction: column; line-height: .95; font-family: var(--display); }
.wordmark:hover { color: #fff; }
.wm-small { font-weight: 500; font-size: 1rem; letter-spacing: .02em; padding-left: .1em; }
.wm-big { font-weight: 700; font-size: 2rem; }
.sign nav { display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; }
.sign nav a { color: var(--cream); text-decoration: none; font-weight: 600; padding: .3rem 0; border-bottom: 2px solid transparent; }
.sign nav a:hover { border-bottom-color: #fff; color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; text-align: center; font: 700 1.05rem/1.2 var(--body); text-decoration: none;
  padding: .85rem 1.3rem; border-radius: 6px; border: 2px solid transparent; cursor: pointer;
}
.btn-red { background: var(--red); color: var(--cream); border-color: var(--red-dark); box-shadow: 0 3px 0 var(--red-dark); }
.btn-red:hover { background: var(--red-dark); color: #fff; }
.btn-sage { background: var(--navy); color: #fff; border-color: var(--navy-dark); box-shadow: 0 3px 0 var(--navy-dark); }
.btn-sage:hover { background: var(--navy-dark); color: #fff; }
.btn-plain { background: var(--sheet); color: var(--ink); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.btn-plain:hover { background: var(--line); color: var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 currentColor; }

/* ---------- Home hero: sheets lying on a gingham tablecloth ---------- */
.hero { position: relative; padding: 3.5rem 0 0; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2rem 3rem; align-items: end; position: relative; z-index: 1; }
.hero-copy { padding-bottom: 180px; }
.hero-copy p { font-size: 1.2rem; max-width: 46ch; color: var(--ink-soft); }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); max-width: 16ch; }
.hero-btns { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.hero-sheets { position: relative; height: 480px; }
.hero-sheet {
  position: absolute; display: block; width: 300px; aspect-ratio: 8.5 / 11; background: var(--sheet);
  border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line), 6px 10px 0 rgba(31,58,95,.13);
  text-decoration: none; color: var(--ink);
}
.hero-sheet.s1 { left: 0; bottom: 22px; transform: rotate(-4deg); padding: 22px 20px; z-index: 2; }
.hero-sheet.s2 { right: 0; bottom: 48px; transform: rotate(5deg); padding: 12px; }
.hero-sheet.s2 img { width: 100%; height: 100%; object-fit: contain; }
.hs-title { display: block; font: 700 1.15rem/1.2 var(--display); text-align: center; margin-bottom: 14px; }
.hs-grid { display: grid; grid-template-columns: repeat(10, 1fr); font: 600 .95rem/1.85 var(--body); text-align: center; color: var(--ink); }
.hs-grid i { font-style: normal; }
.tablecloth {
  height: 140px; margin-top: -140px; position: relative;
  background-color: #fff;
  background-image:
    linear-gradient(90deg, var(--check) 50%, transparent 50%),
    linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 32px 32px;
  border-top: 4px solid var(--red);
}

/* ---------- Sections and cards ---------- */
.group { margin: 3.25rem 0; }
.group h2 a { color: var(--ink); text-decoration: none; }
.group h2 a:hover { color: var(--red); text-decoration: underline; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.group-head a { font-weight: 600; }
.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.75rem 1.5rem; }
.sheet-card { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.sheet-card .mini, .sheet-card img {
  background: var(--sheet); border: 1px solid var(--line); box-shadow: 4px 5px 0 rgba(31,58,95,.1);
  aspect-ratio: 8.5 / 11; width: 100%; object-fit: cover;
}
.sheet-card:hover .mini, .sheet-card:hover img { border-color: var(--red); box-shadow: 4px 5px 0 rgba(168,38,43,.25); }
.mini { display: grid; grid-template-columns: repeat(7, 1fr); align-content: center; padding: 14% 10%; font: 600 1rem/2.1 var(--body); text-align: center; color: var(--ink-soft); }
.mini i { font-style: normal; }
.card-title { font: 700 1.15rem/1.25 var(--display); margin-top: .75rem; }
.sheet-card:hover .card-title { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.card-meta { font-size: .95rem; color: var(--ink-soft); }

.cats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.cats a {
  display: flex; flex-direction: column; padding: 1rem 1.15rem; text-decoration: none; color: var(--ink);
  background: var(--sheet); border: 1px solid var(--line); border-left: 6px solid var(--navy);
}
.cats a:hover { border-left-color: var(--red); }
.cat-name { font: 700 1.2rem/1.2 var(--display); }
.cat-count { font-size: .95rem; color: var(--ink-soft); }

.maker-promo {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem 3rem; flex-wrap: wrap;
  background: var(--blue-soft); border: 1px solid var(--line); padding: 2rem 2.25rem; margin: 3.25rem 0;
}
.maker-promo p { margin: 0; max-width: 58ch; }
.maker-promo h2 { margin-bottom: .35em; }

.etsy {
  background: var(--sheet); border: 1px solid var(--line); border-top: 0; padding: 1.75rem 2rem; margin: 3.25rem 0;
  position: relative;
}
.etsy::before {
  content: ""; position: absolute; left: -1px; right: -1px; top: -14px; height: 14px;
  background-color: #fff;
  background-image:
    linear-gradient(90deg, var(--check) 50%, transparent 50%),
    linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 14px 14px;
}
.etsy p { max-width: 64ch; margin: 0 0 1.25rem; }

/* ---------- Breadcrumbs ---------- */
.crumbs { font-size: .95rem; margin-top: 1.5rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: .25rem; }
.crumbs .sep { margin: 0 .35rem; color: #9AA6B4; }

/* ---------- Puzzle and coloring pages ---------- */
.puzzle-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; align-items: start; }
.paper {
  background: var(--sheet); border: 1px solid var(--line); box-shadow: 6px 8px 0 rgba(31,58,95,.1);
  padding: clamp(1rem, 3vw, 2.25rem);
}
.paper-color { padding: 1rem; }
.ws-grid {
  container-type: inline-size; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  max-width: 640px; margin: 0 auto; user-select: none;
}
.ws-grid span {
  aspect-ratio: 1; display: grid; place-items: center;
  font: 600 calc(62cqi / var(--n)) / 1 var(--body); color: var(--ink);
}
.ws-grid span.hit { background: rgba(168,38,43,.2); color: var(--red-dark); }
.ws-grid span.focus { background: rgba(31,58,95,.22); color: var(--navy-dark); }
.find { text-align: center; font-size: 1.3rem; margin: 1.75rem 0 .75rem; }
.wordlist { list-style: none; padding: 0; margin: 0 auto; max-width: 640px; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .15rem 1rem; }
.wordlist button, .wordlist li { font: 600 1rem/1.3 var(--body); color: var(--ink); }
.wordlist button { background: none; border: 0; padding: .35rem .25rem; cursor: pointer; text-align: left; }
.wordlist button:hover, .wordlist button.on { color: var(--red); text-decoration: underline; }
.wordlist li:not(:has(button)) { padding: .35rem .25rem; }
.puzzle-side { display: grid; gap: 1.5rem; position: sticky; top: 1.5rem; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-top: 5px solid var(--red); padding: 1.4rem; display: grid; gap: .75rem; }
.panel h2 { font-size: 1.35rem; margin: 0; }
.panel .small { margin: 0; }
.facts { margin: 0; padding: 0 .25rem; }
.facts dt { font-weight: 700; font-size: .95rem; margin-top: .8rem; }
.facts dd { margin: 0; color: var(--ink-soft); }
.prose { max-width: 70ch; margin-top: 2.75rem; }
.prose h2 { margin-top: 1.4em; }
.more { margin: 3rem 0; }
.empty { font-size: 1.15rem; }

/* ---------- Word search maker ---------- */
.maker { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.maker-form label, .maker-form legend { font-weight: 700; }
.maker-form input[type=text], .maker-form textarea {
  width: 100%; font: 1.05rem/1.4 var(--body); color: var(--ink); padding: .6rem .7rem;
  border: 2px solid var(--line); border-radius: 4px; background: #fff;
}
.maker-form textarea { resize: vertical; text-transform: uppercase; }
.maker-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .3rem; }
.maker-form .radio, .maker-form .check { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
.maker-form input[type=radio], .maker-form input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--red); }
.error { color: var(--red); font-weight: 700; margin: 0; min-height: 0; }
.error:empty { display: none; }
.m-sheet-title { text-align: center; font-size: 1.8rem; }
.maker-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.print-credit { display: none; }
#m-hint { margin-top: 1rem; }
.large .ws-grid span { font-weight: 700; font-size: calc(72cqi / var(--n)); }
.large .wordlist li { font-size: 1.25rem; }

/* ---------- Footer ---------- */
.foot { background: var(--navy); color: #E6ECF4; margin-top: 4rem; padding: 3.5rem 0 1.5rem; position: relative; }
.foot::before { top: 0; }
.foot a { color: #fff; }
.foot a:hover { color: #fff; }
.foot-inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.foot-inner p { max-width: 52ch; margin: 0 0 .6rem; }
.foot-name { font: 700 1.4rem/1.2 var(--display); color: var(--cream); }
.foot nav { display: grid; gap: .4rem; align-content: start; }
.copy { font-size: .9rem; color: #B8C4D3; margin-top: 1.5rem; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-copy { padding-bottom: 0; }
  .hero-sheets { height: 400px; max-width: 520px; width: 100%; margin: 0 auto; }
  .hero-sheet { width: 240px; }
  .hs-grid { font-size: .78rem; }
  .puzzle-layout, .maker { grid-template-columns: 1fr; }
  .puzzle-side { position: static; }
}
@media (max-width: 520px) {
  .hero-sheets { height: 330px; }
  .hero-sheet { width: 190px; }
  .hero-sheet.s1 { padding: 14px 12px; }
  .hs-title { font-size: .9rem; margin-bottom: 8px; }
  .hs-grid { font-size: .62rem; }
  .card-row { grid-template-columns: repeat(2, 1fr); gap: 1.25rem 1rem; }
  .cats { grid-template-columns: 1fr 1fr; }
  .wm-big { font-size: 1.6rem; }
  .btn { width: 100%; }
  .hero-btns { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Printing (word search maker and puzzle pages) ---------- */
@media print {
  @page { size: letter; margin: 0.5in; }
  body { background: #fff; font-size: 12pt; }
  .sign, .foot, .crumbs, .lede, .puzzle-side, .prose, .more, .etsy, .maker-form, .maker-actions, #m-hint, h1, .skip { display: none !important; }
  .maker, .puzzle-layout { display: block; }
  .wrap { width: 100%; }
  .paper { border: 0; box-shadow: none; padding: 0; }
  .ws-grid { max-width: 7in; border: 1.5pt solid #000; padding: 6pt; }
  .ws-grid span { color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ws-grid span.hit { background: #ddd; }
  .ws-grid span.focus { background: none; color: #000; }
  .wordlist { max-width: 7in; grid-template-columns: repeat(3, 1fr); }
  .print-credit { display: block; text-align: center; font-size: 9pt; color: #555; margin-top: 18pt; }
}
