/* The overview of the Days of Creation (js/creation.js, js/creation-world.js): one picture of the world in three
   framed realms, each between the day that divides it (left, in the blue of dividing) and the day that fills it
   (right, in the gold of filling), with Day 7 as a foundation beneath; then the refrains as one chant. Each frame is a
   plate set into the page: its drawing keeps the night's palette in both themes, while the words around it follow
   the theme. Each picture is seen in order by its own buttons, and each step is drawn in motion (see "in order, in
   motion" below), its verse written beneath the drawing, inside the frame, before the drawing moves; with reduced
   motion every step simply appears. On a phone each frame takes the full width, with its buttons beneath it and its
   two captions side by side beneath them. */

#panel-creation { --cr-mid: 30rem; }
.cr-ref { margin: 2px 0 16px; text-align: center; font-style: normal; color: var(--muted); font-size: 1rem; }
.cr-over { max-width: 40rem; margin: 0 auto; text-align: center; font-style: normal; font-size: 1rem; color: var(--muted); text-wrap: balance; }
.cr-hint { max-width: 38rem; margin: 10px auto 0; text-align: center; font-size: 1rem; line-height: 1.45; color: var(--muted); text-wrap: balance; }
.cr-hint b { font-weight: var(--caps-wt); font-family: var(--caps); letter-spacing: 0.01em; color: var(--ink); }
.cr-hint b.dv { color: var(--form-ink); }
.cr-hint b.fl { color: var(--fill-ink); }

/* ---- the heads: also the key ---- */
.cr-heads, .cr-band { display: grid; grid-template-columns: minmax(0, 1fr) var(--cr-mid) minmax(0, 1fr); column-gap: 22px; }
.cr-heads { align-items: start; margin: 14px 0 40px; }
.cr-h { display: block; }
.cr-h.divide { grid-column: 1; text-align: right; }
.cr-h.fill { grid-column: 3; text-align: left; }
.cr-h-t { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 400; font-size: 1.55rem; line-height: 1.15; letter-spacing: 0.03em; }
.cr-h.divide .cr-h-t { justify-content: flex-end; color: var(--form-ink); }
.cr-h.fill .cr-h-t { color: var(--fill-ink); }
.smp-line { flex: none; width: 24px; height: 2px; background: var(--form-ink); }
.smp-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--fill-ink); }
.cr-h-k { display: block; margin-top: 4px; font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; color: var(--muted); }
.cr-h-d { display: block; font-style: normal; font-size: 0.95rem; line-height: 1.35; color: var(--muted); }
.cr-h-d .short { display: none; }
.cr-h-k .br { display: none; }

/* ---- the picture: a frame to each pair of days ---- */
.cr-world { margin: 0; }
.cr-bands { display: grid; gap: 40px; margin: 0; padding: 0; list-style: none; }
.cr-band { position: relative; width: 100%; margin: 0; padding: 0; grid-template-areas: "l art r" ". order ." ". words go"; align-items: center; row-gap: 8px; }
.cr-cap { display: block; min-width: 0; line-height: 1.3; }
.cr-cap.l { grid-area: l; text-align: right; }
.cr-cap.r { grid-area: r; }
.cr-cap .k { display: block; font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; }
.cr-cap.l .k { color: var(--form-ink); }
.cr-cap.r .k { color: var(--fill-ink); }
.cr-cap .s { display: block; margin-top: 1px; font-style: normal; font-size: 1.02rem; color: var(--ink); }
.cr-art { grid-area: art; position: relative; display: block; }
.cr-frame {
  /* the plate's own palette, the night's, whatever the theme */
  --cw-ink: #a3bff1; --cw-gold: #efcb74; --cw-bg: #1b1020; --cw-deep: #120a15; --cw-rule: #6a4c78; --cw-warn: #eec262; --cw-pale: #b7a8c3;
  display: block; border: 1.5px solid var(--rule); border-radius: 18px 18px 0 0; overflow: hidden; background: var(--cw-deep); transition: border-color .2s;
}
.cr-frame svg { display: block; width: 100%; height: auto; }
.cw-narrow { display: none !important; }
/* the verse of the step in view, beneath the drawing: before in the pale ink, the day that divides in its blue, the
   day that fills in its gold, and the reference after it, pale. It is set large, to be read with the picture, and
   given the lines its longest verse takes (three here, four on a phone, five on the smallest), whether a verse needs
   them or not, so that the three frames are of one height */
.cr-say { display: grid; min-height: calc(3 * 1.35em + 20px); padding: 10px 18px; border-top: 1px solid var(--cw-rule); background: var(--cw-deep); font-size: 1.25rem; line-height: 1.35; }
.cr-v { grid-area: 1 / 1; align-self: center; font-style: normal; text-align: center; text-wrap: balance; color: var(--cw-pale); }
.cr-v.divide { color: var(--cw-ink); }
.cr-v.fill { color: var(--cw-gold); }
.cr-v .nw { color: var(--cw-pale); font-size: 0.92em; }
.cr-plate {
  position: absolute; z-index: 1; left: 50%; top: 0; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px; padding: 3px 16px 3px 4px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--bg);
  font-family: var(--caps); font-weight: var(--caps-wt); font-size: 1.12rem; letter-spacing: 0.01em; line-height: 1.2; color: var(--ink); white-space: nowrap;
}
.cr-n {
  display: inline-flex; align-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1.5px solid transparent;
  background: linear-gradient(90deg, var(--form-soft) 50%, var(--fill-soft) 50%) padding-box,
              linear-gradient(90deg, var(--form-edge) 50%, var(--fill-edge) 50%) border-box;
  font-family: var(--display); font-weight: 400; font-size: 0.95rem; line-height: 1; letter-spacing: 0;
}
/* on the plate of each frame, the pair's two days, set large to name the frame */
.cr-plate .cr-n { width: 2.15rem; height: 2.15rem; font-size: 1.2rem; }
.cr-n > span { flex: 1; text-align: center; }
.cr-n > span + span { border-left: 1px solid var(--rule); }
.cr-n .divide { color: var(--form-ink); }
.cr-n .fill { color: var(--fill-ink); }
.cr-words { grid-area: words; display: block; text-align: center; font-style: normal; font-size: 0.95rem; line-height: 1.35; color: var(--muted); }
.cr-go {
  grid-area: go; align-self: center; justify-self: start; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 2px;
  border: 0; background: none; font: inherit; font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; color: var(--rubric); white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cr-go:hover { text-decoration: underline; text-underline-offset: 4px; }
.cr-go:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cr-go.pg-read { position: relative; }
.cr-band:has(.cr-go:hover) .cr-frame, .cr-band:has(.cr-go:focus-visible) .cr-frame, .cr-band.sel .cr-frame { border-color: var(--rubric); }
.cr-band.sel .cr-plate { border-color: var(--rubric); }
/* the pair last opened: a ring round its frame (and inside Day 7's rules), not colour alone, and not the look of a hover */
.cr-band.sel .cr-frame { box-shadow: 0 0 0 2px var(--rubric); }
.cr-found.sel { box-shadow: inset 0 0 0 2px var(--rubric); }

/* each picture's own steps: Without Form, the day that divides, the day that fills */
.cr-order { grid-area: order; justify-self: center; display: flex; gap: 6px; }
.cr-order button {
  min-height: 34px; padding: 3px 14px; border: 1px solid var(--rule); border-radius: 999px; background: none; color: var(--muted);
  font: inherit; font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; line-height: 1.2; white-space: nowrap; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: color .2s, border-color .2s, background-color .2s;
}
.cr-order button.divide { color: var(--form-ink); }
.cr-order button.fill { color: var(--fill-ink); }
@media (hover: hover) { .cr-order button:hover { border-color: color-mix(in srgb, var(--rubric) 55%, var(--rule)); } }
.cr-order button[aria-pressed="true"] { border-color: var(--rubric); background: var(--surface-3); color: var(--ink); }
.cr-order button[aria-pressed="true"]::before { content: "◆ "; content: "◆ " / ""; font-family: var(--sym); font-size: 0.7em; vertical-align: 0.12em; color: var(--rubric); }
.cr-order button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* the drawing's inks: dividing in blue line, filling in solid gold */
.cw-f-deep { fill: var(--cw-deep); }
.cw-w-deep { fill: none; stroke: var(--cw-rule); stroke-opacity: 0.55; stroke-width: 1.3; }
.cw-f-night { fill: var(--cw-deep); }
.cw-f-day { fill: color-mix(in srgb, var(--cw-ink) 20%, var(--cw-bg)); }
.cw-f-air { fill: color-mix(in srgb, var(--cw-ink) 6%, var(--cw-bg)); }
.cw-f-water { fill: color-mix(in srgb, var(--cw-ink) 14%, var(--cw-deep)); }
.cw-f-earth { fill: color-mix(in srgb, var(--cw-ink) 22%, var(--cw-bg)); }
.cw-f-ink { fill: var(--cw-ink); }
.cw-hatch { fill: none; stroke: var(--cw-ink); stroke-opacity: 0.16; stroke-width: 1; }
.cw-ln { fill: none; stroke: var(--cw-ink); stroke-linecap: round; stroke-linejoin: round; }
circle.cw-ln { fill: color-mix(in srgb, var(--cw-ink) 22%, var(--cw-bg)); }
.cw-wave { fill: none; stroke: var(--cw-ink); stroke-opacity: 0.55; stroke-width: 1.4; }
.cw-nm { fill: var(--cw-ink); font-family: var(--draw-caps); font-size: 15px; letter-spacing: 0.08em; }
.cw-f-gold { fill: var(--cw-gold); }
.cw-g-s { fill: none; stroke: var(--cw-gold); stroke-linecap: round; stroke-linejoin: round; }

/* ---- the foundation: day 7, beneath all six ---- */
.cr-found {
  position: relative; display: block; width: 100%; max-width: 40rem; margin: 46px auto 0; padding: 30px 22px 16px;
  border: 0; color: var(--ink); font: inherit; text-align: center; cursor: pointer;
  background:
    linear-gradient(var(--rest-edge), var(--rest-edge)) top / 100% 3px no-repeat,
    linear-gradient(var(--rest-edge), var(--rest-edge)) 0 6px / 100% 1px no-repeat,
    linear-gradient(var(--rest-edge), var(--rest-edge)) bottom / 100% 3px no-repeat,
    linear-gradient(var(--rest-edge), var(--rest-edge)) 0 calc(100% - 6px) / 100% 1px no-repeat,
    color-mix(in srgb, var(--rest-soft) 70%, transparent);
}
.cr-found:hover, .cr-found:focus-visible, .cr-found.sel { background-color: color-mix(in srgb, var(--rubric) 10%, var(--rest-soft)); }
.cr-found:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.cr-found > span { display: block; }
.cr-n.cr-n7 {
  position: absolute; top: 3px; left: 50%; transform: translate(-50%, -50%);
  display: flex; justify-content: center; width: 2.5rem; height: 2.5rem; border: 2px solid var(--rest-edge); background: var(--rest-soft);
  color: var(--rest-ink); font-size: 1.25rem;
}
.cr-found .k { font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; color: var(--rest-ink); }
.cr-found .t { font-family: var(--display); font-weight: 400; font-size: 1.7rem; line-height: 1.15; color: var(--rest-ink); }
.cr-found .s { max-width: 34rem; margin: 2px auto 0; font-style: normal; font-size: 1.02rem; line-height: 1.4; text-wrap: pretty; }
.cr-found .ref { margin-top: 2px; font-size: 0.95rem; font-style: normal; color: var(--muted); }
.cr-found:hover .t, .cr-found:focus-visible .t { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.cr-loose { max-width: 40rem; margin: 14px auto 0; text-align: center; font-size: 0.95rem; line-height: 1.5; color: var(--muted); text-wrap: pretty; }

/* ---- the second story: one chant, three breaks ---- */
.cr-chant {
  display: block; width: 100%; max-width: 34rem; margin: 46px auto 0; padding: 14px 18px 12px;
  border: 1px solid var(--rule); background: color-mix(in srgb, var(--ink) 2%, transparent);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.cr-chant > span { display: block; }
.cr-chant:hover, .cr-chant:focus-visible { border-color: color-mix(in srgb, var(--rubric) 60%, var(--rule)); background: color-mix(in srgb, var(--rubric) 6%, transparent); }
.cr-chant:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.cr-chant-t { font-family: var(--display); font-weight: 400; font-size: 1.22rem; line-height: 1.25; text-wrap: balance; }
.cr-chant-s { margin: 2px 0 12px; font-size: 0.95rem; line-height: 1.4; color: var(--muted); }
.cr-rib { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cr-rib .c { display: flex; flex-direction: column; align-items: center; padding: 5px 0 2px; border-top: 3px solid; text-align: center; }
.cr-rib .d { border-color: var(--form-edge); } .cr-rib .d .n { color: var(--form-ink); }
.cr-rib .f { border-color: var(--fill-edge); } .cr-rib .f .n { color: var(--fill-ink); }
.cr-rib .rs { border-color: var(--rest-edge); } .cr-rib .rs .n { color: var(--rest-ink); }
.cr-rib .n { font-family: var(--display); font-weight: 400; font-size: 1.15rem; line-height: 1.2; }
.cr-rib .x { margin-top: 2px; font-family: var(--sym); font-size: 0.9rem; line-height: 1.2; color: var(--bad); }
.cr-rib .xl { width: 5.4rem; margin-top: 3px; font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; line-height: 1.2; color: var(--bad); text-wrap: balance; }
.cr-rib .c:last-child .xl { align-self: flex-end; text-align: right; }
.cr-chant-go { margin-top: 6px; text-align: right; font-family: var(--caps); font-weight: var(--caps-wt); font-size: 0.95rem; letter-spacing: 0.01em; color: var(--rubric); }

/* ---- the notes on the page: one level of drawers, and the instructions in a small one of their own ---- */
.cr-notes-h { margin-top: 40px; }
.cr-notes > details.tb-drop + details.tb-drop { border-top: 1px dotted color-mix(in srgb, var(--rule) 70%, transparent); }
.cr-notes > .cr-using { margin-top: 16px; }
.cr-using > summary .tb-drop-t { font-size: 0.98rem; color: var(--muted); }
.cr-using > summary .tb-drop-s { font-size: 0.95rem; }

/* ---- each picture in order, in motion ----
   data-stage on the picture: 0 before (the deep), 1 the day that divides, 2 the day that fills. A step chosen is played
   from its own start (js/creation.js sets the step before it without motion first), so Day 2 always shows the waters
   lifted and Day 5 always shows the creatures coming in. Going back, to Without Form or to the day that divides, is
   quick and has no delays: only arriving is staged. Each picture begins at Without Form.
   The verse comes first: the step's own is written in at once (the others go at once, so two are never seen
   together), and the drawing holds still for --cr-lead before it moves, so the word is read and then answered.
   Going back to Without Form has no wait. */
.cr-band { --cr-lead: .6s; }
.cr-band[data-stage="0"] { --cr-lead: 0s; }
.cr-v { visibility: hidden; opacity: 0; transform: translateY(5px); }
.cr-band[data-stage="0"] .cr-v[data-v="0"], .cr-band[data-stage="1"] .cr-v[data-v="1"], .cr-band[data-stage="2"] .cr-v[data-v="2"] {
  visibility: visible; opacity: 1; transform: none; transition: opacity .45s ease-out, transform .45s ease-out;
}
.cr-band .cw-deep { opacity: 0; transition: opacity .5s var(--cr-lead, 0s); }
.cr-band[data-stage="0"] .cw-deep { opacity: 1; }
.cr-band .cw-lw { transition: opacity .45s var(--cr-lead, 0s); }
.cr-band[data-stage="0"] .cw-lw { opacity: 0; }
.cr-band[data-stage="0"] .cr-frame { border-color: var(--line); }
/* day 1: the dividing line drawn down, and the day spreading out from it */
.cw-draw-y { transform-box: fill-box; transform-origin: 50% 0; transition: transform .7s cubic-bezier(.3, .7, .2, 1) calc(var(--cr-lead, 0s) + .3s); }
.cr-band[data-stage="0"] .cw-draw-y { transform: scaleY(0); }
.cw-grow-x { transform-box: fill-box; transform-origin: 0 50%; transition: transform 1.2s cubic-bezier(.3, .7, .2, 1) calc(var(--cr-lead, 0s) + .85s); }
.cr-band[data-stage="0"] .cw-grow-x { transform: scaleX(0); }
/* day 2: the upper waters lie on the waters below, then are lifted, and the sky opens between them */
.cw-up { transition: transform 1.6s cubic-bezier(.45, .05, .2, 1) calc(var(--cr-lead, 0s) + .55s); }
.cr-band[data-stage="0"] .cw-up { transform: translateY(var(--up)); }
/* day 3: the dry land rises out of the gathered seas, then its plants spring up */
.cw-rise { transition: transform 1.4s cubic-bezier(.3, .7, .2, 1) calc(var(--cr-lead, 0s) + .4s); }
.cr-band[data-stage="0"] .cw-rise { transform: translateY(var(--rise)); }
.cw-sprout { transition: opacity .5s calc(var(--cr-lead, 0s) + 1.6s), transform .7s cubic-bezier(.3, .7, .2, 1) calc(var(--cr-lead, 0s) + 1.6s); }
.cr-band[data-stage="0"] .cw-sprout { opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; }
/* the names God gives come last */
.cw-names { transition: opacity .6s calc(var(--cr-lead, 0s) + 1.9s); }
.cr-band[data-stage="0"] .cw-names { opacity: 0; transition: opacity .3s; }
/* days 4–6: the figures come in from the right, the filling side, one after another, in their gold */
.cw-in { transition: transform 1.1s cubic-bezier(.2, .75, .25, 1) calc(var(--cr-lead, 0s) + .15s + var(--i) * .14s); }
.cr-band:not([data-stage="2"]) .cw-in { transform: translateX(var(--dx)); transition: transform .45s ease-in; }
/* the captions of a day not yet reached stand back, in the muted ink (which still reads), not faded */
.cr-band .cr-cap :is(.k, .s) { transition: color .4s; }
.cr-band[data-stage="0"] .cr-cap :is(.k, .s), .cr-band[data-stage="1"] .cr-cap.r :is(.k, .s) { color: var(--muted); }
.cr-band.snap, .cr-band.snap * { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .cr-band *, .cr-frame, .cr-order button { transition: none !important; }
}

/* ---- narrower screens: each picture full width, its steps beneath it, its two captions side by side beneath them ---- */
@media (max-width: 899px) {
  .cr-heads, .cr-band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; max-width: 34rem; margin-left: auto; margin-right: auto; }
  .cr-heads { margin-top: 12px; margin-bottom: 34px; }
  .cr-h.divide { grid-column: 1; text-align: left; }
  .cr-h.divide .cr-h-t { justify-content: flex-start; }
  .cr-h.fill { grid-column: 2; text-align: right; }
  .cr-h.fill .cr-h-t { justify-content: flex-end; }
  .cr-h-t { font-size: 1.3rem; gap: 8px; }
  .cr-h-d .long { display: none; } .cr-h-d .short { display: inline; }
  .cr-h-k .dot { display: none; } .cr-h-k .br { display: block; }
  .cr-band { grid-template-areas: "art art" "order order" "l r" "words words" "go go"; align-items: start; row-gap: 0; }
  .cr-order { width: 100%; max-width: 24rem; margin-top: 10px; }
  .cr-order button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 4px 4px; }
  .cr-order button[data-st="0"] { flex-grow: 1.6; }   /* “Without Form” is the longest of the three */
  .cr-go { justify-self: end; min-height: 44px; margin-top: 10px; }
  .cr-cap { padding-top: 7px; }
  .cr-cap.l { text-align: left; } .cr-cap.r { text-align: right; }
  .cr-cap .k { font-size: 0.95rem; }
  .cr-cap .s { font-size: 0.95rem; line-height: 1.3; }
  .cr-words { padding-top: 6px; font-size: 0.95rem; }
  .cr-found { margin-top: 40px; }
}
@media (max-width: 560px) {
  .cw-wide { display: none !important; } .cw-narrow { display: block !important; }
  .cr-say { min-height: calc(4 * 1.35em + 20px); padding: 10px; font-size: 1.2rem; }
  .cr-ref { margin-bottom: 10px; }
  .cr-heads { margin-top: 8px; margin-bottom: 32px; }
  .cr-plate { font-size: 1.02rem; }
  .cr-plate .cr-n { width: 2rem; height: 2rem; font-size: 1.1rem; }
  .cr-found { padding: 28px 14px 14px; }
  .cr-found .s { font-size: 0.96rem; }
  .cr-chant { padding: 12px 10px 10px; }
  .cr-rib { gap: 3px; }
  .cr-rib .xl { width: 4.2rem; }
}
/* below 375px a verse takes five lines, so it is set a little smaller */
@media (max-width: 374px) {
  .cr-say { min-height: calc(5 * 1.35em + 20px); font-size: 1.1rem; }
}
@media (max-width: 370px) {
  .cr-rib .xl { width: 3.6rem; }
  .cr-order button { font-size: min(0.86rem, 3.9vw); letter-spacing: 0.02em; }
  .cr-h-t { font-size: 1.15rem; }
}
/* printed, every picture stands finished, whatever step it was left at, since its buttons are not printed */
@media print {
  .cr-order, .cr-go { display: none; }
  .cr-frame { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cr-band, .cr-band * { transition: none !important; }
  .cr-band .cw-deep { opacity: 0 !important; }
  .cr-band :is(.cw-lw, .cw-names, .cw-sprout) { opacity: 1 !important; }
  .cr-band :is(.cw-in, .cw-up, .cw-rise, .cw-sprout, .cw-draw-y, .cw-grow-x) { transform: none !important; }
  .cr-band .cr-cap.l .k { color: var(--form-ink) !important; }
  .cr-band .cr-cap.r .k { color: var(--fill-ink) !important; }
  .cr-band .cr-cap .s { color: var(--ink) !important; }
  /* and its verse is the finished day's */
  .cr-band .cr-v { visibility: hidden !important; }
  .cr-band .cr-v[data-v="2"] { visibility: visible !important; opacity: 1 !important; transform: none !important; }
}
