:root {
  color-scheme: dark;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.preview-nav {
  position: relative;
  z-index: 5;
  display: flex;
  width: min(100% - 36px, 1160px);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 12px;
  font: 600 12px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  letter-spacing: 0.12em;
}

.preview-nav a {
  color: inherit;
  text-decoration: none;
}

.preview-nav span {
  opacity: 0.62;
}

.experience {
  position: relative;
  width: min(100% - 36px, 1160px);
  margin: 0 auto;
  padding: 42px 0 max(54px, env(safe-area-inset-bottom));
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(34px, 7vw, 104px);
  align-items: center;
  min-height: min(780px, calc(100vh - 90px));
}

.masthead {
  position: relative;
}

.eyebrow,
.section-no,
.date-panel label span,
.privacy,
.result-summary,
footer,
.dialog-note,
.theme-note {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.eyebrow {
  margin: 0 0 22px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.2em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 26px;
  font-size: clamp(58px, 9vw, 112px);
  font-weight: 500;
  line-height: 0.92;
}

.lead {
  max-width: 26em;
  margin: 0;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.9;
}

.moon-stage {
  position: relative;
  width: min(72vw, 430px);
  aspect-ratio: 1;
  margin: 46px auto 0;
}

.moon-portrait {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: url("./moon-texture.png") center / cover no-repeat;
}

.moon-orbit,
.moon-orbit::before {
  position: absolute;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.35;
}

.moon-orbit {
  inset: 1%;
}

.moon-orbit::before {
  inset: 6%;
}

.theme-note {
  position: absolute;
  right: 0;
  bottom: 7%;
  max-width: 10em;
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  letter-spacing: 0.08em;
}

.date-panel,
.result {
  position: relative;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 30px;
}

.section-no {
  font-size: 11px;
  letter-spacing: 0.14em;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.date-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 10px;
}

.date-panel label span {
  display: block;
  margin: 0 0 9px 2px;
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 58px;
  padding: 0 15px;
  border-radius: 0;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 19px;
  -moz-appearance: textfield;
}

input::-webkit-inner-spin-button,
input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.form-error {
  min-height: 24px;
  margin: 10px 0 4px;
  font: 13px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.privacy {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.result[hidden] {
  display: none;
}

.result {
  width: min(100%, 820px);
  margin: 40px auto 0;
  padding-top: 58px;
}

#moon-card {
  display: block;
  width: 100%;
  height: auto;
}

.result-poem {
  margin: 26px 0 8px;
  padding-left: 20px;
}

.result-poem p {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.8;
}

.result-poem cite {
  font: normal 12px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.result-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0 24px;
  font-size: 13px;
  line-height: 1.7;
}

.result-summary p {
  margin: 0;
}

.result-summary p:last-child {
  max-width: 20em;
  text-align: right;
}

@media (min-width: 761px) {
  .result-summary p:last-child {
    white-space: nowrap;
  }
}

.result-summary strong,
.result-summary span {
  display: block;
}

.result-summary strong {
  font-size: 16px;
  font-weight: 650;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.text-button {
  min-width: 136px;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 15px;
}

footer {
  width: min(100%, 820px);
  margin: 54px auto 0;
  padding-top: 28px;
  font-size: 11px;
  line-height: 1.85;
}

footer p {
  margin-bottom: 6px;
}

.brand-signoff {
  margin-top: 26px;
  letter-spacing: 0.13em;
}

dialog {
  width: min(calc(100% - 24px), 620px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border-radius: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.dialog-inner {
  position: relative;
  padding: 30px 18px 20px;
  overflow: auto;
}

.dialog-inner h2 {
  margin-bottom: 22px;
  font-size: 22px;
  font-weight: 500;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 28px;
}

#saved-image {
  display: block;
  width: min(100%, 430px);
  margin: 0 auto 16px;
  -webkit-touch-callout: default;
  user-select: auto;
}

.download-link {
  margin-top: 8px;
}

.dialog-note {
  margin: 12px 0 0;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 760px) {
  .experience {
    padding-top: 18px;
  }

  .hero-grid {
    display: block;
    min-height: 0;
  }

  .masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(132px, 42vw);
    column-gap: 12px;
    align-items: center;
    padding-top: 22px;
  }

  .eyebrow {
    grid-column: 1 / -1;
    margin-bottom: 16px;
  }

  h1 {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
    font-size: clamp(48px, 14vw, 66px);
  }

  .moon-stage {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    margin: 0;
  }

  .lead {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.75;
  }

  .theme-note {
    display: none;
  }

  .date-panel {
    margin-top: 32px;
  }
}

@media (max-width: 440px) {
  .preview-nav,
  .experience {
    width: min(100% - 32px, 1160px);
  }

  .date-grid {
    gap: 7px;
  }

  input {
    padding: 0 10px;
  }

  .result-summary {
    display: block;
  }

  .result-summary p:last-child {
    max-width: none;
    margin-top: 8px;
    text-align: left;
  }

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

  .text-button {
    min-height: 52px;
  }
}

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