@import url("./fonts/zen-maru-gothic.css");

:root {
  color-scheme: light;
  --ink: #354D59;
  --teal: #527B76;
  --teal-dark: #3E645F;
  --mist: #A9BFBD;
  --ground: #F3EFE7;
  --gold: #C6AB78;
  --paper: #FCFAF5;
  --line: #D9D3C6;
  --muted: #52656C;
  --control-line: #838F8B;
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--ground);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; }
button, select, textarea { font: inherit; }
p, h1, h2 { margin: 0; }

button:focus-visible, select:focus-visible, textarea:focus-visible, .choice input:focus-visible + span {
  outline: 2px solid var(--teal-dark);
  outline-offset: 3px;
}

.page {
  width: min(100% - 2rem, 40rem);
  margin-inline: auto;
  padding-block: clamp(2.3rem, 6.2vh, 4.4rem) 2.5rem;
}

.masthead { text-align: center; }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .2em;
  line-height: 1.5;
}

.brand::before, .brand::after {
  content: "";
  width: 1.15rem;
  height: 1px;
  background: var(--gold);
}

.motif {
  display: block;
  width: clamp(7rem, 24vw, 10.5rem);
  height: auto;
  margin: 1.35rem auto 1.3rem;
}

.page-title, .result-heading, .reading-section h2 {
  font-weight: 500;
  letter-spacing: .035em;
}

.page-title, .result-heading { color: var(--teal); }

.page-title {
  font-size: clamp(1.8rem, 5.2vw, 2.7rem);
  line-height: 1.43;
  margin-block-end: 1.85rem;
}

.page-title span { display: inline-block; }
.masthead h1:focus { outline: none; }

.paper {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 2px;
  margin-inline: auto;
}

.form-paper {
  width: min(100%, 32.5rem);
  padding: clamp(1.1rem, 5vw, 2.45rem) clamp(1.05rem, 5.3vw, 2.7rem) 1.38rem;
}

fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0;
}

legend {
  padding: 0;
  margin-block-end: .58rem;
  font-size: .9375rem;
  font-weight: 500;
  letter-spacing: .035em;
  line-height: 1.55;
}

.date-fields + .date-fields { margin-top: 1.15rem; }

.date-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.23fr) repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

select {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: .5rem 1.65rem .5rem .65rem;
  border: 1px solid var(--control-line);
  border-radius: 3px;
  background: #FFFDF9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%23527B76' stroke-width='1.25'/%3E%3C/svg%3E") right .65rem center / .65rem auto no-repeat;
  color: var(--ink);
  cursor: pointer;
}

select:required:invalid { color: var(--muted); }
select option { color: var(--ink); }

select:disabled {
  background-color: #F4F2EC;
  border-color: #D4D9D0;
  color: var(--muted);
  opacity: 1;
  -webkit-text-fill-color: var(--muted);
  cursor: default;
}

.form-paper .relationship-fields {
  margin-block-start: 1.3rem;
}

.form-paper .relationship-fields legend {
  padding-top: .94rem;
  border-top: 1px solid var(--line);
}

.relationship-fields legend { float: left; width: 100%; }
.relationship-fields .choices { clear: both; }

.choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}

.choice { position: relative; min-width: 0; cursor: pointer; }

.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  height: 100%;
  width: 100%;
  margin: 0;
  cursor: pointer;
}

.choice span {
  display: grid;
  place-items: center;
  min-height: 2.85rem;
  padding: .45rem .22rem;
  border: 1px solid var(--control-line);
  border-radius: 3px;
  color: var(--ink);
  background: #FFFDF9;
  font-size: .875rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.45;
}

.choice input:checked + span {
  border-color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px var(--teal-dark);
  background: #E1ECE8;
  background: color-mix(in srgb, var(--mist) 37%, #FFFDF9);
  color: #304C48;
}

.button {
  display: block;
  min-height: 3.15rem;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: .65rem .75rem;
  font-weight: 500;
  letter-spacing: .045em;
  line-height: 1.45;
  cursor: pointer;
}

.primary {
  background: var(--teal);
  color: #FFF;
}

.secondary {
  border-color: var(--teal);
  background: transparent;
  color: var(--teal-dark);
}

.form-paper .primary {
  width: 100%;
  margin-top: 1.35rem;
}

.primary:disabled {
  background: #DCE5DF;
  border-color: #D3DED6;
  color: #4E6661;
  cursor: default;
}

.free-note {
  text-align: center;
  font-size: .8125rem;
  line-height: 1.65;
  color: var(--muted);
  margin-top: .75rem;
  letter-spacing: .07em;
}

.no-script { margin-top: .65rem; line-height: 1.65; }

@media (hover: hover) {
  .primary:not(:disabled):hover { background: var(--teal-dark); }
  .secondary:hover, .choice input:not(:checked):hover + span { background: #EDF3EF; }
}

.result-heading {
  font-size: clamp(1.45rem, 4.5vw, 1.85rem);
  line-height: 1.4;
}

.result-number {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.45rem;
  font-size: clamp(5.3rem, 13vw, 7.15rem);
  font-weight: 300;
  line-height: 1.1;
  margin-block: .35rem .15rem;
}

.result-number::before, .result-number::after {
  content: "";
  width: 1.4rem;
  height: 1px;
  background: var(--gold);
}

.keywords {
  color: var(--teal-dark);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .085em;
  margin-bottom: 1.8rem;
}

.result-paper {
  padding: clamp(1.2rem, 5vw, 2.65rem) clamp(1.05rem, 6vw, 3.1rem) 1.75rem;
}

.reading-section h2 {
  font-size: clamp(1.25rem, 4.8vw, 1.7rem);
  line-height: 1.6;
  margin-bottom: .9rem;
  text-wrap: pretty;
}

.reading-text { font-size: 1rem; line-height: 1.95; }
.reading-text p + p { margin-top: .8rem; }

.result-relationships {
  margin-top: 1.45rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.result-relationships .reading-text { margin-top: .85rem; }

.personal-message {
  margin-top: 1.55rem;
  border-left: 2px solid var(--gold);
  padding: 1rem 1.05rem;
  background: #F4F0E7;
}

.personal-message h2 {
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .06em;
  margin-bottom: .45rem;
}

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.actions .button { flex: 1 1 8rem; }

.status {
  font-size: .875rem;
  line-height: 1.55;
  text-align: center;
}

.status:not(:empty) { margin-top: .6rem; }

#copy-text {
  display: block;
  width: 100%;
  margin-top: .6rem;
  padding: .65rem;
  color: var(--ink);
  background: #FFFDF9;
  border: 1px solid var(--teal);
  border-radius: 3px;
  resize: vertical;
}

.reset-button {
  display: block;
  min-height: 2.75rem;
  margin: .6rem auto 0;
  padding: .3rem .75rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: .22em;
  cursor: pointer;
}

.notice {
  padding: 0 .3rem;
  margin: 1.2rem auto 0;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.75;
}

.notice p + p { margin-top: .4rem; }

@media (max-width: 35rem) {
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .motif { margin-block: 1.05rem .95rem; width: 7.65rem; }
  .page-title span { display: block; }
  .page-title { margin-block-end: 1.4rem; }
}
