/* The page declares the "Sorg Noto Serif" font faces, because a browser
   does not read @font-face inside a shadow root. */

:host {
  display: block;
}

.ljos {
  --top: #cc6054;
  --bottom: #6d322b;
  --accent: #ea6c5c;
  --cream: #ffeedb;
  --candle: 200px;

  box-sizing: border-box;
  position: relative;
  /* The glow of a candle near the top edge stays inside. */
  overflow: hidden;
  background: linear-gradient(var(--top), var(--bottom));
  color: var(--cream);
  /* The site loads Roboto. The plugin does not ship it. */
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

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

h2,
h3,
p {
  margin: 0;
  font-weight: 400;
}

/* Headings, buttons and greetings use Novantique Serif Bold when the
   Adobe web project has it. The Display family is the second choice,
   because its thin strokes look weak at small sizes. Without a web
   project ID they use the next font in the list. */
h2,
h3,
.btn,
.greeting,
.featured-message,
.drift-item p,
.wall-grid p {
  font-family: novantique-serif, novantique-serif-display, "Sorg Noto Serif", "Noto Serif", Georgia, serif;
  font-weight: 700;
}

h2 {
  font-size: clamp(32px, 5.2vw, 50px);
  line-height: 1.15;
}

h2:focus {
  outline: none;
}

h3 {
  font-size: 28px;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.small {
  font-size: 14px;
}

.error {
  background: var(--cream);
  color: var(--bottom);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 15px;
}

/* ---------- buttons ---------- */

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

.btn {
  display: inline-block;
  background: var(--cream);
  color: var(--bottom);
  border: 1px solid var(--cream);
  border-radius: 6px;
  padding: 10px 26px;
  text-decoration: none;
  cursor: pointer;
}

.btn.quiet {
  background: transparent;
  color: var(--cream);
  font-size: 15px;
  padding: 7px 18px;
}

.btn:disabled,
.link:disabled {
  opacity: 0.5;
  cursor: default;
}

.link {
  background: none;
  border: 0;
  padding: 4px;
  text-decoration: underline;
  cursor: pointer;
}

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

/* ---------- candle ---------- */

.candle {
  position: relative;
  display: inline-block;
  font-size: var(--candle);
  line-height: 0;
  /* Room for the flame above the wick. */
  margin-top: 0.18em;
}

.candle img {
  position: relative;
  display: block;
  width: auto;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

/* A candle that can light has two images of the same size: the white
   wick below and the burnt wick above it. */
.candle img.unlit + img.burnt,
.candle img.wick-front,
.candle .fx {
  position: absolute;
  left: 0;
  top: 0;
}

.candle img.burnt,
.candle img.wick-front,
.candle .fx {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.candle.lit img.burnt,
.candle.lit img.wick-front,
.candle.lit .fx {
  opacity: 1;
}

/* The white wick goes when the burnt wick covers it. */
.candle.lit img.unlit {
  opacity: 0;
  transition: opacity 0.3s ease 0.5s;
}

/* The flame is an SVG in the pixel grid of the image. */
.candle .fx {
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/* The warm light behind the flame. The script sets its place and size. */
.candle .glow {
  position: absolute;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.candle .glow i {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 190, 120, 0.5) 0%, rgba(255, 140, 90, 0.2) 16%, rgba(255, 120, 80, 0) 42%);
}

.candle.lit .glow {
  opacity: 1;
}

/* ---------- floating candles ---------- */

.drift-mount {
  position: absolute;
  inset: 0;
}

.drift {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  pointer-events: none;
}

.drift-item {
  position: absolute;
  top: 100%;
  width: 0;
  animation: rise linear infinite;
}

.drift-sway {
  width: 12em;
  margin-left: -6em;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sway 9s ease-in-out infinite alternate;
}

.drift-item p {
  margin-top: 8px;
  font-style: italic;
  font-size: 14px;
  line-height: 1.3;
  max-width: 11em;
  overflow-wrap: anywhere;
}

.drift-item.far {
  --candle: 70px;
  opacity: 0.35;
}

.drift-item.mid {
  --candle: 105px;
  opacity: 0.7;
}

.drift-item.near {
  --candle: 140px;
}

@keyframes rise {
  to {
    transform: translateY(calc(-100cqh - 100%));
  }
}

@keyframes sway {
  from {
    transform: translateX(-10px);
  }
  to {
    transform: translateX(10px);
  }
}

/* ---------- hero ---------- */

.hero,
.sky {
  position: relative;
  min-height: min(80vh, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  overflow: hidden;
}

/* The hero is as tall as the photo hero that it replaces on the front
   page (504 px). The row of cards under it has a top margin of -130 px,
   so the hero adds that much room below its content. */
.hero {
  --card-row: 130px;
  min-height: calc(504px + var(--card-row));
  padding-bottom: calc(48px + var(--card-row));
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.hero-buttons .btn.quiet {
  font-size: inherit;
  padding: 10px 26px;
}

.hero-center,
.sky-center {
  position: relative;
  max-width: 30em;
}

.hero-center,
.sky-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ---------- flow ---------- */

/* The flow section has one height for all steps, and each step is in
   the middle of it. The height fits the tallest step, which is the share
   step. The script raises it if a step is taller.
   On a wide screen the section also fits in the window under the site
   header (90px), so the last link of the share step stays in view. The
   candle of that step gets smaller to make room, down to 140px. The
   other parts of the step need about 640px. */
.view-flow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--flow-height);
  container-type: inline-size;
  --flow-height: 1000px;
}

/* On a phone the content starts at the top, so a short step does not
   begin far down the screen. */
@media (max-width: 899px) {
  .view-flow {
    justify-content: flex-start;
  }
}

@media (min-width: 900px) {
  .view-flow {
    --flow-height: clamp(810px, calc(100svh - 90px), 1000px);
  }

  .view-flow .scene {
    --candle: clamp(140px, calc((100svh - 730px) / 1.18), 320px);
  }
}

.view-flow .panel {
  width: 100%;
}

.panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* The carousel uses the full width of the section. The other steps
   stay in a narrow column. */
.panel.choose {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.carousel {
  position: relative;
  width: 100%;
  container-type: inline-size;
}

.carousel-stage {
  --candle: min(300px, 62vw);
  position: relative;
  height: calc(var(--candle) * 1.2);
  overflow: hidden;
  touch-action: pan-y;
}

.carousel-item {
  position: absolute;
  left: 50%;
  bottom: 0;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  /* The candles spread out when the section is wide. */
  --step: clamp(calc(var(--candle) * 0.42), 17cqw, calc(var(--candle) * 0.8));
  transform: translateX(calc(-50% + var(--offset) * var(--step))) scale(var(--scale, 1));
  transform-origin: 50% 70%;
  transition: transform 0.45s ease, opacity 0.45s ease;
}

.carousel-item[data-distance="1"] {
  --scale: 0.72;
  opacity: 0.45;
}

.carousel-item[data-distance="2"] {
  --scale: 0.55;
  opacity: 0.2;
}

.carousel-item[data-distance="3"] {
  --scale: 0.45;
  opacity: 0;
  pointer-events: none;
}

.arrow {
  position: absolute;
  top: 55%;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--cream);
  color: var(--bottom);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 4px;
}

/* The arrows stay inside the content width of the site (1140 px),
   also when the section is as wide as the window. */
.arrow.prev {
  left: max(16px, calc(50% - 570px));
}

.arrow.next {
  right: max(16px, calc(50% - 570px));
}

.write {
  align-items: stretch;
  max-width: 440px;
  gap: 8px;
}

/* The form is narrow, but its heading stays on one line where the
   section has room. */
.write h2 {
  align-self: center;
  width: max-content;
  max-width: calc(100cqw - 40px);
  margin-bottom: 12px;
}

.write-candle {
  --candle: 150px;
  align-self: center;
  margin-bottom: 12px;
}

.write label {
  text-align: left;
  font-size: 15px;
}

.write textarea,
.write input[type="email"] {
  width: 100%;
  background: var(--cream);
  color: var(--bottom);
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  resize: vertical;
}

.count-row {
  text-align: right;
  font-size: 13px;
  margin-bottom: 4px;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.scene {
  --candle: min(320px, 60vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.greeting {
  font-style: italic;
  font-size: clamp(20px, 3.4vw, 28px);
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 20em;
  opacity: 0;
  transition: opacity 1.2s ease 0.8s;
}

.greeting.shown {
  opacity: 1;
}

.scene-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 30em;
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* The mailing list note breaks into lines of about the same length. */
.scene-actions .small {
  text-wrap: balance;
}

/* The note stands in a cream band as wide as the section. */
.note-band {
  align-self: center;
  flex: none;
  box-sizing: border-box;
  width: 100cqw;
  margin-top: 8px;
  padding: 14px 20px;
  background: var(--cream);
  color: var(--bottom);
  text-align: center;
}

.note-band p {
  max-width: 30em;
  margin: 0 auto;
}

.note-band a {
  color: inherit;
}

.scene-actions.shown {
  opacity: 1;
}

.platforms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.platform-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 30em;
}

/* ---------- wall ---------- */

.featured {
  --candle: min(260px, 55vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.featured-label,
.featured-date {
  font-size: 14px;
}

.featured-message {
  font-style: italic;
  font-size: 24px;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.archive {
  padding: 40px 20px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  background: var(--bottom);
}

.wall-grid {
  --candle: 120px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 32px 16px;
}

.wall-grid:empty {
  display: none;
}

/* Each candle stands on the same line. The greeting hangs below it. */
.wall-grid li {
  display: grid;
  grid-template-rows: calc(var(--candle) * 1.18) auto;
  justify-items: center;
  align-items: start;
  gap: 8px;
}

.wall-grid .candle {
  align-self: end;
}

.wall-grid p {
  font-style: italic;
  font-size: 15px;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .drift-sway {
    animation: none;
  }

  .carousel-item {
    transition: none;
  }
}

/* On a phone the floating greetings would cover the text in the middle. */
@media (max-width: 600px) {
  .drift-item p {
    display: none;
  }

  .drift-item.near {
    --candle: 100px;
  }

  .drift-item.mid {
    --candle: 80px;
  }
}
