:root {
  color-scheme: light;
  --page: #f4f1e9;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #17201d;
  --muted: #5b625f;
  --line: #aeb5b1;
  --line-soft: #d8d9d3;
  --accent: #006b5b;
  --accent-hover: #005044;
  --accent-soft: #d8eee7;
  --highlight: #f2c14e;
  --error: #a52222;
  --shadow: 0 18px 50px rgba(23, 32, 29, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #111614;
  --surface: #1a211e;
  --surface-strong: #222b27;
  --ink: #f7f4ec;
  --muted: #bcc5c0;
  --line: #77807b;
  --line-soft: #46504b;
  --accent: #52c7ae;
  --accent-hover: #7dd8c4;
  --accent-soft: #173f36;
  --highlight: #f2c14e;
  --error: #ff9292;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Manrope", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="date"] {
  min-height: 48px;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--page);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 3px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  background: var(--ink);
  color: var(--page);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
}

.theme-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 22px;
}

.language-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.intro {
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  padding: 56px clamp(20px, 7vw, 110px) 100px;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(16, 27, 23, 0.94) 0%, rgba(16, 27, 23, 0.72) 58%, rgba(16, 27, 23, 0.38) 100%),
    url("https://images.unsplash.com/photo-1506784983877-45594efa4cbe?auto=format&fit=crop&w=1800&q=85") center 42% / cover;
}

.intro-copy {
  width: min(830px, 100%);
}

.kicker {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1,
h2 {
  font-family: "Source Serif 4", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.02;
}

.intro-copy > p:last-child {
  max-width: 650px;
  margin: 22px 0 0;
  font-size: 18px;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(728px, calc(100% - 40px));
  min-height: 90px;
  margin: 24px auto 0;
  padding: 14px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ad-slot .adsbygoogle {
  display: block;
  width: 100%;
  min-height: 90px;
}

.ad-label {
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ad-copy {
  font-size: 13px;
}

.calculator-shell,
.results,
.method {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.calculator-shell {
  position: relative;
  margin-top: 30px;
}

.calculator,
.panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator {
  padding: clamp(24px, 4vw, 46px);
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.section-heading h2,
.panel-heading h3,
.section-heading p,
.panel-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 30px;
  line-height: 1.15;
}

.section-heading p:not(.step),
.panel-heading p:not(.step) {
  margin-top: 5px;
  color: var(--muted);
}

.step {
  flex: 0 0 auto;
  width: 42px;
  padding-top: 4px;
  border-top: 3px solid var(--highlight);
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1fr;
  gap: 18px;
  margin: 30px 0 22px;
}

label > span:first-child {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

select,
input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-strong);
  color: var(--ink);
}

.check-control {
  display: flex;
  align-items: flex-start;
  width: fit-content;
  max-width: 620px;
  gap: 13px;
  cursor: pointer;
}

.check-control input {
  position: absolute;
  opacity: 0;
}

.check-box {
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  margin: 1px 0 0;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 3px;
  color: transparent;
  line-height: 1;
}

.check-control input:checked + .check-box {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface-strong);
}

.check-control input:focus-visible + .check-box {
  outline: 3px solid var(--highlight);
  outline-offset: 3px;
}

.check-control strong,
.check-control small {
  display: block;
}

.check-control small {
  margin-top: 2px;
  color: var(--muted);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(420px, 100%);
  margin-top: 28px;
  padding: 14px 18px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

[data-theme="dark"] .primary-button {
  color: #111614;
}

.primary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.form-error {
  margin: 18px 0 0;
  color: var(--error);
  font-weight: 700;
}

.results {
  padding: 78px 0 30px;
}

.result-lead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 0;
  gap: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.result-lead h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1.08;
}

.best-days {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
}

.score {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--highlight);
  color: #17201d;
}

.score strong {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 54px;
  line-height: 1;
}

.score span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.data-status {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.4fr);
  min-width: 0;
  gap: 24px;
  margin-top: 30px;
}

.panel {
  min-width: 0;
  padding: 28px;
  box-shadow: none;
}

.panel h3 {
  font-size: 20px;
}

.ranking {
  min-width: 0;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.ranking-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
}

.ranking-item:last-child {
  border-bottom: 0;
}

.ranking-item:first-child {
  margin-inline: -10px;
  padding-inline: 10px;
  background: var(--accent-soft);
}

.rank-number {
  font-weight: 800;
}

.rank-days strong,
.rank-days small {
  display: block;
}

.rank-days {
  min-width: 0;
}

.rank-days small {
  margin-top: 2px;
  color: var(--muted);
}

.rank-score {
  text-align: right;
  font-size: 20px;
  font-weight: 800;
}

.rank-score small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.holiday-list {
  margin-top: 24px;
}

.holiday-row {
  display: grid;
  grid-template-columns: 98px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.holiday-row:last-child {
  border-bottom: 0;
}

.holiday-date,
.holiday-name small {
  color: var(--muted);
}

.holiday-date {
  font-variant-numeric: tabular-nums;
}

.holiday-name strong,
.holiday-name small {
  display: block;
}

.holiday-status {
  min-width: 92px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.holiday-status.used {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.empty-state {
  margin: 24px 0 0;
  padding: 24px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.method {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: clamp(30px, 8vw, 100px);
  padding: 76px 0 90px;
}

.method h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
}

.method > p {
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 18px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 28px clamp(20px, 5vw, 72px);
  border-top: 1px solid #38403d;
  background: #17201d;
  color: #dce3df;
  font-size: 13px;
}

footer p {
  margin: 0;
}

.faq {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 90px;
}

.faq h2 {
  max-width: 640px;
  margin: 0 0 28px;
  font-size: 36px;
  line-height: 1.15;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.faq article {
  padding: 22px;
  border-top: 3px solid var(--accent);
  background: var(--surface);
}

.faq h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.faq article p {
  margin: 12px 0 0;
  color: var(--muted);
}

.noscript-message {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 30px;
  padding: 16px;
  border: 1px solid var(--error);
  color: var(--error);
  font-weight: 700;
}

@media (max-width: 900px) {
  .form-grid,
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }

  .result-grid .panel:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .intro {
    min-height: 400px;
    padding-bottom: 92px;
    background-position: 62% center;
  }

  h1 {
    font-size: 40px;
  }

  .calculator-shell,
  .results,
  .method {
    width: min(100% - 24px, 1120px);
  }

  .ad-slot {
    width: calc(100% - 24px);
    min-height: 58px;
    margin-top: 14px;
    padding: 10px 14px;
  }

  .ad-slot .adsbygoogle {
    min-height: 58px;
  }

  .calculator {
    padding: 24px 18px;
  }

  .form-grid,
  .result-grid,
  .method {
    grid-template-columns: minmax(0, 1fr);
  }

  .faq {
    width: min(100% - 24px, 1120px);
  }

  .result-grid .panel:last-child {
    grid-column: auto;
  }

  .result-lead {
    align-items: stretch;
    flex-direction: column;
  }

  .score {
    justify-content: center;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .panel {
    padding: 22px 16px;
  }

  .ranking-item {
    grid-template-columns: 26px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .holiday-row {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
  }

  .holiday-name strong {
    overflow-wrap: anywhere;
  }

  .holiday-status {
    grid-column: 2;
    justify-self: start;
  }

  footer {
    flex-direction: column;
  }
}

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