:root {
  color-scheme: dark;
  --night: #030d12;
  --night-soft: #071a21;
  --panel: rgba(5, 20, 25, .92);
  --panel-solid: #0a2027;
  --line: rgba(155, 220, 207, .22);
  --line-strong: rgba(217, 181, 93, .55);
  --text: #fbf8ed;
  --muted: #b8c7c5;
  --aqua: #7fd4c7;
  --aqua-deep: #3c9f95;
  --gold: #d9b55d;
  --gold-pale: #f2d98f;
  --ember: #ea784d;
  --success: #96e3b2;
  --error: #ff9c91;
  --shadow: 0 28px 90px rgba(0, 0, 0, .48);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--night);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, select { touch-action: manipulation; }
a { color: inherit; }

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

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--gold-pale);
  color: #12201d;
  font-weight: 850;
  transform: translateY(-160%);
  transition: transform .15s ease;
}

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

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 13, 18, .9);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  fill: var(--aqua);
  stroke: var(--gold);
  stroke-width: 1.8;
  filter: drop-shadow(0 5px 18px rgba(127, 212, 199, .22));
}

.brand strong,
.brand small { display: block; }

.brand strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  letter-spacing: .12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  margin-top: 1px;
  color: var(--aqua);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .06em;
}

.language-switcher {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(217, 181, 93, .22);
  border-radius: 999px;
  background: rgba(0, 0, 0, .34);
}

.language-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.43rem;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.language-button:hover { transform: translateY(-1px); }
.language-button.is-active {
  border-color: var(--gold);
  background: rgba(217, 181, 93, .11);
  box-shadow: inset 0 0 0 3px rgba(217, 181, 93, .06);
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: 770px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #06141a;
}

.hero-art,
.hero-shade {
  position: absolute;
  z-index: -2;
  inset: 0;
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
}

.hero-shade {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(2, 12, 17, .96) 0%, rgba(2, 12, 17, .79) 37%, rgba(2, 12, 17, .16) 76%),
    linear-gradient(0deg, rgba(3, 13, 18, .98) 0%, transparent 42%),
    linear-gradient(180deg, rgba(3, 13, 18, .35), transparent 30%);
}

.hero-inner { padding-block: 64px 54px; }

.hero-copy { max-width: 610px; }

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--gold-pale);
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 700px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.15rem, 7.6vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .88;
  text-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}

.hero h1 em {
  color: var(--aqua);
  font-weight: 500;
}

.hero-lead {
  max-width: 560px;
  margin: 25px 0 0;
  color: #e7eee9;
  font-size: clamp(1.02rem, 1.8vw, 1.19rem);
}

.calculator {
  max-width: 960px;
  margin-top: 44px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(5, 20, 25, .97), rgba(7, 29, 34, .94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.calculator-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 23px 26px 18px;
}

.calculator-heading .section-kicker { margin-bottom: 3px; color: var(--ember); }
.calculator h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.035em; }

.basis-pill {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}

#date-form {
  padding: 0 26px 21px;
  border-bottom: 1px solid var(--line);
}

.date-fields {
  display: grid;
  grid-template-columns: 78px minmax(155px, 1fr) 112px 118px auto;
  gap: 10px;
  align-items: end;
}

.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }

.field label {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 780;
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid rgba(155, 220, 207, .28);
  border-radius: 11px;
  outline: 0;
  background: #041116;
  color: var(--text);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.field input:focus,
.field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(217, 181, 93, .11);
}

.calculate-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 19px;
  border: 1px solid var(--gold-pale);
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold-pale), var(--gold));
  color: #172019;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
  transition: filter .15s ease, transform .15s ease;
}

.calculate-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.calculate-button:active { transform: translateY(0); }

.range-note,
.error-message {
  margin: 10px 0 0;
  font-size: .79rem;
  line-height: 1.45;
}

.range-note { color: #9eb4b1; }
.error-message { min-height: 1.2em; color: var(--error); font-weight: 800; }
.has-error input,
.has-error select { border-color: rgba(255, 156, 145, .7); }

.result-panel {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(340px, 1.1fr);
  gap: 24px;
  align-items: center;
  padding: 24px 26px 27px;
  background: radial-gradient(circle at 12% 10%, rgba(127, 212, 199, .12), transparent 19rem);
  transition: opacity .15s ease;
}

.result-panel.is-muted { opacity: .42; }
.result-label { margin: 0 0 3px; color: var(--aqua); font-size: .79rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }

.result-date {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.7vw, 3.45rem);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: 1.02;
}

.festival-badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  padding: 7px 11px;
  border: 1px solid rgba(217, 181, 93, .45);
  border-radius: 999px;
  background: rgba(217, 181, 93, .1);
  color: var(--gold-pale);
  font-size: .84rem;
  font-weight: 850;
}

.festival-badge[hidden] { display: none; }
.festival-badge svg { width: 22px; height: 22px; flex: 0 0 auto; fill: var(--aqua); stroke: var(--gold); stroke-width: 1.5; }
.festival-badge.is-emphasized {
  border-color: var(--gold-pale);
  background: linear-gradient(135deg, rgba(217, 181, 93, .2), rgba(127, 212, 199, .13));
  box-shadow: 0 0 28px rgba(217, 181, 93, .14);
}

.result-details { display: grid; gap: 10px; margin: 0; }
.result-details div {
  display: grid;
  grid-template-columns: minmax(105px, .38fr) minmax(0, 1fr);
  gap: 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(155, 220, 207, .11);
}
.result-details div:last-child { padding-bottom: 0; border-bottom: 0; }
.result-details dt { color: #91aaa6; font-size: .82rem; font-weight: 760; }
.result-details dd { margin: 0; color: #e5ece8; font-size: .9rem; font-weight: 730; }

.explanation { padding-block: 76px 82px; }
.explanation-title { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.explanation-title .section-kicker { margin: 0; color: var(--ember); }
.explanation h2 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 36px;
}

.info-grid article {
  min-height: 230px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(10, 32, 39, .82), rgba(4, 18, 23, .9));
}

.info-number { color: var(--gold); font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }
.info-grid h3 { margin: 41px 0 9px; font-size: 1.16rem; }
.info-grid p { margin: 0; color: var(--muted); }

.sunset-note {
  margin: 18px 0 0;
  padding-left: 15px;
  border-left: 3px solid var(--aqua-deep);
  color: #92aaa6;
  font-size: .88rem;
}

.site-footer { border-top: 1px solid var(--line); background: #02090d; }
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  padding-block: 30px;
}
.footer-brand { display: flex; min-width: 0; align-items: center; gap: 12px; }
.footer-brand svg { width: 38px; height: 38px; flex: 0 0 auto; fill: var(--aqua); stroke: var(--gold); stroke-width: 1.8; }
.footer-brand strong,
.footer-brand span { display: block; }
.footer-brand strong { font-family: Georgia, "Times New Roman", serif; letter-spacing: .11em; }
.footer-brand span { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; color: #879c99; font-size: .79rem; }
.footer-meta a { color: var(--aqua); text-decoration: none; }
.footer-meta a:hover { color: var(--gold-pale); }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(242, 217, 143, .75);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 900px) {
  .hero { min-height: 0; }
  .hero-shade {
    background:
      linear-gradient(90deg, rgba(2, 12, 17, .92), rgba(2, 12, 17, .38)),
      linear-gradient(0deg, rgba(3, 13, 18, .99) 0%, rgba(3, 13, 18, .2) 60%);
  }
  .hero-inner { padding-top: 56px; }
  .calculator { max-width: none; }
  .date-fields { grid-template-columns: 82px minmax(170px, 1fr) 120px 122px; }
  .calculate-button { grid-column: 1 / -1; }
  .result-panel { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .info-grid article { min-height: 0; }
  .info-grid h3 { margin-top: 22px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-meta { justify-content: flex-start; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1160px); }
  .header-inner { min-height: 70px; gap: 10px; }
  .brand-mark { width: 37px; height: 37px; }
  .brand strong { font-size: .87rem; letter-spacing: .08em; }
  .brand small { display: none; }
  .language-switcher { gap: 2px; padding: 3px; }
  .language-button { width: 36px; height: 36px; font-size: 1.18rem; }
  .hero { padding-top: 204px; }
  .hero-art { height: 260px; bottom: auto; }
  .hero-art img { object-position: center center; }
  .hero-shade {
    height: 310px;
    bottom: auto;
    background: linear-gradient(0deg, var(--night) 0%, rgba(3, 13, 18, .08) 72%);
  }
  .hero-inner { padding-block: 26px 34px; }
  .hero h1 { font-size: clamp(2.7rem, 14vw, 4.35rem); }
  .hero-lead { margin-top: 18px; }
  .calculator { margin-top: 28px; border-radius: 19px; }
  .calculator-heading { align-items: flex-start; padding: 20px 17px 15px; }
  .basis-pill { display: none; }
  #date-form { padding: 0 17px 18px; }
  .date-fields { grid-template-columns: minmax(84px, .8fr) minmax(150px, 1.2fr); }
  .field-year,
  .field-era { grid-row: 2; }
  .calculate-button { grid-column: 1 / -1; }
  .result-panel { gap: 21px; padding: 21px 17px 23px; }
  .result-details div { grid-template-columns: 1fr; gap: 2px; }
  .festival-badge { align-items: flex-start; border-radius: 14px; }
  .explanation { padding-block: 55px 60px; }
  .explanation-title { align-items: flex-start; flex-direction: column; gap: 8px; }
  .info-grid { margin-top: 26px; }
  .footer-brand { align-items: flex-start; }
  .footer-meta { flex-direction: column; }
}

@media (max-width: 390px) {
  .brand strong { font-size: .8rem; }
  .language-button { width: 34px; height: 34px; }
  .date-fields { grid-template-columns: 1fr; }
  .field-year,
  .field-era { grid-row: auto; }
}
