@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #17231c;
  --muted: #5f6b63;
  --paper: #fffdf8;
  --cream: #f5f0e8;
  --sage: #dbe7dc;
  --green: #1f5b45;
  --green-dark: #143d2f;
  --coral: #e16b4f;
  --line: #cfd7cf;
  --shadow: 0 24px 70px rgba(39, 54, 44, 0.13);
  font-family: "DM Sans", Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 88% 8%, rgba(225, 107, 79, 0.12), transparent 25rem),
    var(--cream);
}

button,
select,
input {
  font: inherit;
}

a {
  color: inherit;
}

.site-header,
.site-footer,
main > section {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(31, 91, 69, 0.17);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.3rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

nav a,
.footer-links a {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.94rem;
}

nav a:hover,
.footer-links a:hover,
.text-link:hover {
  color: var(--coral);
}

.hero {
  min-height: 660px;
  padding: 88px 0 98px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 9%;
}

.eyebrow,
.sheet-kicker {
  margin: 0 0 15px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1,
h2 {
  font-family: "Playfair Display", Georgia, serif;
  color: var(--green-dark);
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(3.4rem, 7vw, 6.8rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.hero-intro {
  max-width: 650px;
  margin: 28px 0 0;
  color: #445249;
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  margin-top: 36px;
}

.button {
  min-height: 50px;
  padding: 13px 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(225, 107, 79, 0.45);
  outline-offset: 3px;
}

.button-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 11px 24px rgba(31, 91, 69, 0.2);
}

.button-primary:hover {
  background: var(--green-dark);
}

.button-secondary {
  border-color: #adc0b1;
  background: #fff;
  color: var(--green-dark);
}

.text-link {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 700;
}

.hero-puzzle {
  position: relative;
  width: min(100%, 490px);
  justify-self: end;
  padding: 28px 28px 20px;
  background: var(--paper);
  border: 1px solid rgba(31, 91, 69, 0.16);
  border-radius: 4px;
  box-shadow: var(--shadow);
  transform: rotate(1.6deg);
}

.hero-puzzle::before {
  content: "";
  position: absolute;
  inset: -16px 24px auto auto;
  width: 98px;
  height: 34px;
  background: rgba(225, 107, 79, 0.32);
  transform: rotate(-4deg);
}

.hero-puzzle p {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.mini-grid,
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid #17231c;
  background: #17231c;
  gap: 1px;
}

.mini-grid span,
.sudoku-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111;
  font-weight: 600;
}

.mini-grid span {
  font-size: clamp(0.78rem, 2vw, 1.15rem);
}

.mini-grid span:nth-child(3n):not(:nth-child(9n)),
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 2px solid #17231c;
}

.mini-grid span:nth-child(n + 19):nth-child(-n + 27),
.mini-grid span:nth-child(n + 46):nth-child(-n + 54),
.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 2px solid #17231c;
}

.generator-section {
  padding: 80px 54px 64px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: end;
}

.section-heading h2,
.content-intro h2,
.difficulty-section h2,
.rules-section h2,
.faq-section h2 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.section-heading > p,
.content-intro > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar {
  margin: 42px 0 0;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 18px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf7;
}

.toolbar label:not(.checkbox-label) {
  display: grid;
  gap: 8px;
}

.toolbar label > span {
  color: var(--green-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.toolbar select {
  width: 100%;
  min-height: 48px;
  padding: 0 38px 0 13px;
  border: 1px solid #b9c6ba;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.checkbox-label {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-label input {
  width: 19px;
  height: 19px;
  accent-color: var(--green);
}

.toolbar-actions {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.print-note {
  margin: 18px 0 28px;
  padding-left: 22px;
  position: relative;
  color: var(--muted);
  font-size: 0.9rem;
}

.print-note::before {
  content: "i";
  position: absolute;
  left: 0;
  top: -1px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--green-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.print-document {
  padding: 34px;
  border: 1px solid #d9ded7;
  background: var(--paper);
}

.sheet-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 19px;
  border-bottom: 2px solid var(--ink);
}

.sheet-header h2,
.solution-heading h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  color: var(--ink);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.sheet-kicker {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.66rem;
}

.sheet-fields {
  display: grid;
  gap: 9px;
  color: #4c554f;
  font-size: 0.8rem;
}

.puzzle-grid,
.solution-grid {
  display: grid;
  gap: 34px;
  margin-top: 34px;
}

.puzzle-grid[data-count="1"] {
  grid-template-columns: minmax(260px, 620px);
  justify-content: center;
}

.puzzle-grid[data-count="2"],
.puzzle-grid[data-count="4"],
.solution-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.puzzle-card {
  min-width: 0;
  break-inside: avoid;
}

.puzzle-card-header {
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.puzzle-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.puzzle-card-header span {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sudoku-board {
  width: 100%;
}

.sudoku-cell {
  font-family: Arial, sans-serif;
  font-size: clamp(0.76rem, 2.15vw, 1.35rem);
  line-height: 1;
}

.puzzle-grid[data-count="1"] .sudoku-cell {
  font-size: clamp(1rem, 3.3vw, 2rem);
}

.solutions {
  margin-top: 54px;
  padding-top: 26px;
  border-top: 2px solid var(--ink);
}

.solution-grid .puzzle-card {
  max-width: 300px;
}

.solution-grid .sudoku-cell {
  font-size: 0.8rem;
}

body:not(.show-solutions) .solutions {
  display: none;
}

.benefits {
  padding: 100px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(31, 91, 69, 0.18);
}

.benefits article {
  padding: 42px;
  background: var(--cream);
}

.feature-number {
  color: var(--coral);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.benefits h2 {
  margin: 25px 0 12px;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.benefits p,
.difficulty-cards p,
.rules-copy p,
.faq-list p {
  color: var(--muted);
  line-height: 1.7;
}

.content-section,
.difficulty-section,
.rules-section,
.faq-section {
  padding: 96px 0;
  border-top: 1px solid rgba(31, 91, 69, 0.17);
}

.content-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10%;
}

.content-intro > p:last-child {
  margin-top: 24px;
}

.steps {
  margin: 0;
  padding: 0;
  display: grid;
  list-style: none;
}

.steps li {
  padding: 24px 0;
  display: grid;
  grid-template-columns: 45px 1fr;
  gap: 18px;
  border-bottom: 1px solid rgba(31, 91, 69, 0.16);
}

.steps li:first-child {
  padding-top: 0;
}

.steps li > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--green-dark);
  font-weight: 700;
}

.steps h3,
.steps p {
  margin: 0;
}

.steps p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.6;
}

.difficulty-cards {
  margin-top: 46px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.difficulty-cards article {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.48);
}

.difficulty-cards h3 {
  margin: 23px 0 8px;
  font-size: 1.18rem;
}

.level-tag {
  width: max-content;
  margin: 0 !important;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--green-dark) !important;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-easy { background: #dbe8c8; }
.level-medium { background: #f3dfb0; }
.level-hard { background: #f1c8bd; }

.rules-section,
.faq-section {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 10%;
}

.rules-copy p:first-child {
  margin-top: 0;
}

.faq-list {
  border-top: 1px solid rgba(31, 91, 69, 0.22);
}

details {
  border-bottom: 1px solid rgba(31, 91, 69, 0.22);
}

summary {
  padding: 22px 36px 22px 0;
  position: relative;
  list-style: none;
  color: var(--green-dark);
  font-weight: 700;
  cursor: pointer;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 20px;
  font-size: 1.4rem;
  font-weight: 400;
}

details[open] summary::after {
  content: "−";
}

.faq-list p {
  margin: -4px 0 22px;
  padding-right: 42px;
}

.site-footer {
  min-height: 220px;
  padding: 48px 0;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: start;
  gap: 36px 70px;
  border-top: 1px solid rgba(31, 91, 69, 0.18);
}

.site-footer p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-tool {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid rgba(31, 91, 69, 0.25);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.75);
  color: var(--green-dark);
  font-weight: 700;
  cursor: pointer;
}

.header-tool:hover,
.header-tool:focus-visible {
  border-color: var(--coral);
  color: var(--coral);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

.footer-links > div {
  display: grid;
  gap: 9px;
}

.footer-links strong {
  margin-bottom: 4px;
  color: var(--green-dark);
}

.footer-note {
  grid-column: 1 / -1;
  margin: 0 !important;
  padding-top: 20px;
  border-top: 1px solid rgba(31, 91, 69, 0.13);
}

.site-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(380px, calc(100% - 44px));
  padding: 14px 18px;
  border-radius: 9px;
  background: var(--green-dark);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.content-page {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.content-page > section {
  width: 100%;
}

.page-hero {
  padding: 92px 0 70px;
  border-bottom: 1px solid rgba(31, 91, 69, 0.18);
}

.page-hero h1 {
  max-width: 920px;
  font-size: clamp(3.2rem, 7vw, 6.4rem);
}

.page-hero > p:not(.eyebrow) {
  max-width: 760px;
  margin: 28px 0 0;
  color: #445249;
  font-size: 1.18rem;
  line-height: 1.75;
}

.page-hero .updated-date {
  font-size: 0.92rem !important;
  font-weight: 700;
}

.article-shell {
  padding: 72px 0 110px;
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1.75fr);
  gap: 8%;
  align-items: start;
}

.article-aside {
  position: sticky;
  top: 28px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.82);
}

.article-aside p:not(.eyebrow) {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.65;
}

.article-content {
  max-width: 760px;
}

.article-content h2 {
  margin: 52px 0 15px;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content h3 {
  margin: 30px 0 8px;
  color: var(--green-dark);
  font-size: 1.18rem;
}

.article-content p,
.article-content li {
  color: #445249;
  font-size: 1.02rem;
  line-height: 1.78;
}

.article-content a {
  color: var(--green);
  font-weight: 700;
}

.article-content ul,
.article-content ol {
  padding-left: 1.4rem;
}

.numbered-guide li {
  margin-bottom: 12px;
}

.content-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.content-card-grid > div,
.callout {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.content-card-grid h3 {
  margin-top: 0;
}

.content-card-grid p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.callout {
  margin: 32px 0;
  border-left: 5px solid var(--coral);
  color: #445249;
  line-height: 1.65;
}

@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
    gap: 14px 24px;
    padding: 18px 0;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 14px;
    border-top: 1px solid rgba(31, 91, 69, 0.12);
  }

  .article-shell {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .article-aside {
    position: static;
  }
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 60px;
  }

  .hero-puzzle {
    justify-self: center;
  }

  .toolbar {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .toolbar-actions .button {
    flex: 1;
  }

  .section-heading,
  .content-section,
  .rules-section,
  .faq-section {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .benefits,
  .difficulty-cards {
    grid-template-columns: 1fr;
  }

  .benefits article {
    padding-inline: 0;
  }
}

@media (max-width: 640px) {
  .site-header,
  .site-footer,
  main > section {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  .primary-nav {
    justify-content: flex-start;
    gap: 20px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .hero {
    padding: 64px 0 74px;
  }

  h1 {
    font-size: clamp(3.1rem, 16vw, 4.8rem);
  }

  .generator-section {
    width: 100%;
    padding: 58px 14px 40px;
    border-radius: 0;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .toolbar-actions {
    grid-column: 1;
    flex-direction: column;
  }

  .print-document {
    padding: 16px;
  }

  .sheet-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .puzzle-grid[data-count="2"],
  .puzzle-grid[data-count="4"],
  .solution-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-section,
  .content-section,
  .rules-section,
  .faq-section {
    padding: 72px 0;
  }

  .site-footer {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-note {
    grid-column: 1;
  }

  .page-hero {
    padding: 64px 0 54px;
  }

  .page-hero h1 {
    font-size: clamp(3rem, 14vw, 4.8rem);
  }

  .article-shell {
    padding: 54px 0 76px;
  }

  .content-card-grid {
    grid-template-columns: 1fr;
  }

  .footer-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media print {
  :root {
    background: #fff;
  }

  body {
    background: #fff;
    color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .site-header,
  .hero,
  .section-heading,
  .toolbar,
  .print-note,
  .benefits,
  .content-section,
  .difficulty-section,
  .rules-section,
  .faq-section,
  .site-footer {
    display: none !important;
  }

  .site-toast {
    display: none !important;
  }

  main,
  .generator-section,
  .print-document {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  .sheet-header {
    padding-bottom: 3mm;
  }

  .sheet-header h2 {
    font-size: 18pt;
  }

  .sheet-kicker,
  .sheet-fields {
    font-size: 7pt;
  }

  .puzzle-grid {
    margin-top: 5mm;
    gap: 6mm 9mm;
  }

  .puzzle-grid[data-count="1"] {
    width: 160mm;
    margin-inline: auto;
    grid-template-columns: 1fr;
  }

  .puzzle-grid[data-count="2"] {
    width: 108mm;
    margin-inline: auto;
    grid-template-columns: 1fr;
    gap: 5mm;
  }

  .puzzle-grid[data-count="4"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 5mm 8mm;
  }

  .puzzle-card-header {
    margin-bottom: 2mm;
  }

  .puzzle-card h3 {
    font-size: 8.5pt;
  }

  .puzzle-card-header span {
    font-size: 6.5pt;
  }

  .sudoku-board {
    border-width: 1.1pt;
    gap: 0;
  }

  .sudoku-cell {
    border-right: 0.35pt solid #999;
    border-bottom: 0.35pt solid #999;
    font-size: 12pt;
  }

  .puzzle-grid[data-count="1"] .sudoku-cell {
    font-size: 18pt;
  }

  .puzzle-grid[data-count="4"] .sudoku-cell {
    font-size: 9pt;
  }

  .sudoku-cell:nth-child(9n) {
    border-right: 0;
  }

  .sudoku-cell:nth-child(n + 73) {
    border-bottom: 0;
  }

  .solutions {
    break-before: page;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .solution-heading {
    padding-bottom: 3mm;
    border-bottom: 1.1pt solid #000;
  }

  .solution-heading h2 {
    font-size: 18pt;
  }

  .solution-grid {
    margin-top: 7mm;
    grid-template-columns: repeat(2, 68mm);
    justify-content: center;
    gap: 8mm 12mm;
  }

  .solution-grid .puzzle-card {
    max-width: none;
  }

  .solution-grid .sudoku-cell {
    font-size: 7.5pt;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
