/* Site styles. Five colours only (see :root). */

:root {
  --kinari: #F3EEE3;
  --kinari-deep: #EBE4D6;
  --white: #FFFFFF;
  --sumi: #15171B;
  --hai: #5B5650;
  --wrap: 42rem;
  --wrap-wide: 70rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--kinari);
  color: var(--sumi);
  font-family: 'Noto Sans JP', 'Noto Sans CJK JP', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.8;
  line-break: strict;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
}

p {
  margin: 0 0 1rem;
}

strong {
  font-weight: 700;
}

a {
  color: var(--sumi);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: background-color 0.12s;
}

a:hover {
  background-color: var(--kinari-deep);
}

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

/* Headings wrap between phrases. */
.ph {
  display: inline-block;
}

/* A number with its unit, and the end of a sentence, stay on one line. */
.nw {
  white-space: nowrap;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

.wrap-wide {
  width: min(100% - 2.5rem, var(--wrap-wide));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--sumi);
  color: var(--white);
  font-weight: 700;
}

.skip:focus {
  top: 0.75rem;
}

.skip:hover {
  background: var(--sumi);
}

.note {
  color: var(--hai);
  font-size: 0.9375rem;
}

/* Placeholder for facts not decided yet. */
.slot {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--kinari-deep);
  border: 2px dashed var(--sumi);
  color: var(--sumi);
  font-weight: 700;
  line-height: 1.6;
}

/* ---------- Header ---------- */

.site-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 1.25rem 1rem;
}

.logo {
  display: block;
  flex: none;
  width: 66px;
  height: auto;
}

.site-id {
  line-height: 1.5;
}

.site-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
}

.site-by {
  margin: 0;
  color: var(--hai);
  font-size: 0.8125rem;
}

/* ---------- Footer ---------- */

.site-foot {
  margin-top: 4rem;
  padding-block: 1.25rem 2.5rem;
  border-top: 1px solid var(--sumi);
  font-size: 0.9375rem;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-block: 0; /* side margins come from .wrap */
  padding: 0;
  list-style: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.625rem 2rem;
  border: 2px solid var(--sumi);
  border-radius: 4px;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}

.btn-primary {
  background: var(--sumi);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--white);
  color: var(--sumi);
}

.btn-secondary {
  background: transparent;
  color: var(--sumi);
}

.btn-secondary:hover {
  background: var(--kinari-deep);
}

.btn:disabled,
.btn:disabled:hover {
  background: var(--kinari-deep);
  border-color: var(--hai);
  color: var(--hai);
  cursor: not-allowed;
}

.btn-sub {
  font-size: 0.8125rem;
  font-weight: 400;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--hai);
  font: inherit;
  font-size: 0.9375rem;
  text-decoration: underline;
  text-underline-offset: 0.22em;
  cursor: pointer;
}

.link-button:hover {
  color: var(--sumi);
}

/* ---------- Intro ---------- */

.page-title {
  margin-top: 1rem;
  font-size: 1.875rem;
  letter-spacing: 0.01em;
}

.lead {
  margin: 0.875rem 0 0;
}

.marks {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  grid-template-areas: "count time for fee";
  margin: 1.5rem 0 0;
  border-top: 2px solid var(--sumi);
  border-bottom: 1px solid var(--sumi);
}

.mark {
  padding: 0.625rem 1.25rem 0.75rem;
  border-left: 1px solid var(--sumi);
}

.mark-count {
  grid-area: count;
  padding-left: 0;
  border-left: 0;
}

.mark-time {
  grid-area: time;
}

.mark-for {
  grid-area: for;
}

.mark-fee {
  grid-area: fee;
}

.mark dt {
  color: var(--hai);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.mark dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
}

.mark-for dd {
  font-size: 1rem;
  line-height: 1.875;
}

.not-do {
  margin-top: 1.5rem;
}

.not-do h2 {
  font-size: 1rem;
}

.dash-list {
  margin: 0.375rem 0 0;
  padding: 0;
  list-style: none;
}

.dash-list li {
  position: relative;
  padding-left: 1.5rem;
}

.dash-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.9em;
  width: 0.75rem;
  border-top: 2px solid var(--sumi);
}

.start {
  margin: 1.5rem 0 0.75rem;
}

.start .btn {
  min-width: min(16rem, 100%); /* never wider than the body */
}

/* ---------- Questions ---------- */

.progress {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--kinari);
  border-bottom: 1px solid var(--sumi);
}

.progress-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 0.5rem;
}

.progress-count {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 0.5rem;
  background: var(--kinari-deep);
  box-shadow: inset 0 0 0 1px var(--hai);
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--sumi);
}

.quiz {
  margin-top: 2rem;
}

.question {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question legend {
  width: 100%;
  padding: 0;
}

.eyebrow {
  display: block;
  color: var(--hai);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.question-text {
  margin-top: 0.25rem;
  font-size: 1.375rem;
  line-height: 1.6;
}

.question-text:focus {
  outline: none;
}

.question-note {
  margin: 0.75rem 0 0;
}

.options {
  display: grid;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  min-height: 3.5rem;
  padding: 0.875rem 1.125rem;
  background: var(--white);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--hai);
  cursor: pointer;
  transition: background-color 0.12s;
}

.option:hover {
  background: var(--kinari-deep);
}

.option.is-selected {
  background: var(--white);
  box-shadow: inset 0 0 0 3px var(--sumi);
}

.option:focus-within {
  outline: 3px solid var(--sumi);
  outline-offset: 3px;
}

.option input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.2rem 0 0;
  background: var(--white);
  border: 2px solid var(--sumi);
  border-radius: 50%;
  cursor: pointer;
}

.option input:focus {
  outline: none;
}

.option input::before {
  content: "";
  width: 0.6875rem;
  height: 0.6875rem;
  border-radius: 50%;
  background: transparent;
}

.option input:checked::before {
  background: var(--sumi);
}

.quiz-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.quiz-nav .btn-secondary {
  flex: none;
  padding-inline: 1.5rem;
}

.quiz-nav .btn-primary {
  flex: 1;
  max-width: 20rem;
  margin-left: auto;
}

.next-hint {
  margin: 0.625rem 0 0;
  text-align: right;
}

.restart {
  margin: 2.5rem 0 0;
}

.notice {
  margin-top: 2rem;
  padding-left: 1rem;
  border-left: 4px solid var(--sumi);
  font-weight: 700;
}

/* ---------- Result ---------- */

.result-title {
  margin-top: 1.5rem;
  font-size: 1.625rem;
}

.result-lead {
  margin: 0.375rem 0 0;
}

.position {
  margin: 1.25rem 0 0;
  border-top: 2px solid var(--sumi);
}

.position-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  align-items: baseline;
  gap: 0 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--sumi);
}

.position dt {
  font-weight: 700;
}

.position dd {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.4;
}

.position dd.is-sentence {
  font-size: 1.25rem;
  line-height: 1.6;
}

.counts {
  margin: 1rem 0 0;
}

.counts strong {
  font-size: 1.25rem;
}

.counts .sep {
  margin-inline: 0.5rem;
}

.section {
  margin-top: 3.5rem;
}

.section-title {
  padding-top: 1rem;
  border-top: 2px solid var(--sumi);
  font-size: 1.3125rem;
}

.section-lead {
  margin: 0.625rem 0 0;
}

.chart-scroll {
  margin-top: 1.25rem;
  overflow-x: auto;
  background: var(--white);
  -webkit-overflow-scrolling: touch;
}

.chart-canvas {
  position: relative;
  min-width: 1000px;
}

.chart-canvas img {
  display: block;
  width: 100%;
  height: auto;
}

.frame {
  position: absolute;
  border: 4px solid var(--sumi);
  border-radius: 9px;
  box-shadow: 0 0 0 2px var(--white);
  pointer-events: none;
}

.frame.is-next {
  border-style: dashed;
}

.chart-hint {
  margin: 0.5rem 0 0;
}

.chart-rows {
  margin: 1.5rem 0 0;
}

.chart-row {
  padding: 0.875rem 0 0.875rem 1.125rem;
  border-left: 4px solid var(--sumi);
}

.chart-row + .chart-row {
  margin-top: 0.875rem;
}

.chart-row.is-next {
  border-left-style: dashed;
}

.chart-row dt {
  font-weight: 700;
}

.chart-row dd {
  margin: 0.125rem 0 0;
}

.priority-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: priority;
}

.priority-item {
  display: grid;
  grid-template-columns: 3rem 1fr;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--sumi);
  counter-increment: priority;
}

.priority-item::before {
  content: counter(priority);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.15;
}

.priority-item h3 {
  font-size: 1.125rem;
}

.priority-answer {
  margin: 0.25rem 0 0.5rem;
}

.priority-item p:last-child {
  margin-bottom: 0;
}

.priority-after {
  margin: 1rem 0 0;
}

.next-row {
  margin-top: 2rem;
}

.next-row h3 {
  font-size: 1.0625rem;
}

.next-row dl {
  margin: 0.75rem 0 0;
}

.booking {
  margin-top: 3.5rem;
  padding-block: 2.5rem 2.25rem;
  background: var(--kinari-deep);
}

.booking h2 {
  font-size: 1.4375rem;
}

.booking-text {
  margin: 0.75rem 0 0;
}

.booking-action {
  margin: 1.5rem 0 1rem;
}

.slot-button {
  min-height: 3.25rem;
  padding: 0.625rem 1.25rem;
  background: var(--white);
  border-width: 3px;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: default;
}

.booking .note {
  margin-bottom: 0;
}

.done-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.done-list li {
  position: relative;
  padding: 0.625rem 0 0.625rem 1.75rem;
  border-bottom: 1px solid var(--sumi);
}

.done-list li::before {
  content: "";
  position: absolute;
  left: 0.125rem;
  top: 1.2em;
  width: 0.625rem;
  height: 0.625rem;
  background: var(--sumi);
}

.done-none {
  margin: 0.75rem 0 0;
}

.caution p {
  margin: 0.75rem 0 0;
}

.again {
  margin-top: 2.5rem;
}

.empty {
  margin-top: 2rem;
}

.empty h1 {
  font-size: 1.5rem;
}

.empty p {
  margin: 0.75rem 0 1.5rem;
}

/* ---------- Privacy ---------- */

.doc h1 {
  margin-top: 1.5rem;
  font-size: 1.625rem;
}

.doc h2 {
  margin-top: 2.5rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--sumi);
  font-size: 1.125rem;
}

.doc h2 + p,
.doc h2 + ul {
  margin-top: 0.625rem;
}

.doc ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.doc li + li {
  margin-top: 0.25rem;
}

.doc .back {
  margin-top: 2.5rem;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 40rem) {
  .page-title {
    font-size: 1.5625rem;
  }

  .marks {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "count time fee"
      "for for for";
  }

  .mark {
    padding-inline: 0.875rem;
  }

  .mark-for {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--sumi);
  }

  .question-text {
    font-size: 1.25rem;
  }

  .position-row {
    grid-template-columns: 1fr;
  }

  .position dd {
    font-size: 1.625rem;
  }

  .position dd.is-sentence {
    font-size: 1.125rem;
  }

  .start .btn {
    width: 100%;
    padding-inline: 0.75rem; /* fits one line at 200% text size */
  }

  .priority-item {
    grid-template-columns: 2.5rem 1fr;
  }
}

/* ---------- Narrow screens with large text (container queries) ---------- */

.marks-box,
.quiz {
  container-type: inline-size;
}

@container (max-width: 19em) {
  .marks {
    grid-template-columns: 1fr;
    grid-template-areas:
      "count"
      "time"
      "fee"
      "for";
  }

  .mark,
  .mark-for {
    padding-left: 0;
    border-left: 0;
  }

  .mark + .mark {
    border-top: 1px solid var(--sumi);
  }

  .quiz-nav {
    flex-wrap: wrap;
  }
}
