/* ============================================================================
 * Winter WanderLand — the landing screen and the short opening.
 *
 * The first thing a person sees. index.html decides which before the first
 * paint and puts one class on <html>:
 *
 *   .lnd-first    a first visit to the home route: the landing (.lnd), and
 *                 the sleigh pick as its second page
 *   .lnd-open     a later visit to the home route: the opening (.lnd-opening),
 *                 the mark over the ground while the list loads
 *   neither       a link to a display, a tour, a card, the feed: nothing here
 *                 is drawn at all
 *
 * The markup is in index.html so it paints with the page; js/landing.js makes
 * it work. Tokens come from css/style.css; the sleigh tiles and the switch on
 * the second page are css/sleigh.css's own. docs/brand.md is the spec.
 * ========================================================================= */

.lnd, .lnd-opening { display: none; }

/* ------------------------------------------------------------ landing --- */

html.lnd-first .lnd { display: block; }
.lnd {
  position: fixed; inset: 0;
  z-index: 2000;                      /* over everything, toasts included */
  background: var(--night);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: contain;
  transition: opacity .28s ease;
}
.lnd.is-leaving { opacity: 0; pointer-events: none; }

.lnd-page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  transition: opacity .26s ease, transform .26s cubic-bezier(.2, .8, .3, 1), visibility 0s linear 0s;
}
/* the second page waits to the right; the first leaves to the left */
.lnd-sleigh { opacity: 0; visibility: hidden; transform: translateX(28px); transition-delay: 0s, 0s, .26s; }
.lnd.is-step2 .lnd-hello { opacity: 0; visibility: hidden; transform: translateX(-28px); transition-delay: 0s, 0s, .26s; }
.lnd.is-step2 .lnd-sleigh { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

/* A night street, out of focus, over the top of the page. The words sit on
   the solid ground under it, so nothing is ever set on a busy picture. */
.lnd-photo { position: absolute; left: 0; right: 0; top: 0; height: 72%; overflow: hidden; }
.lnd-photo i {
  position: absolute; inset: 0;
  background: var(--night) url(../assets/art/landing.webp) 84% 100% / cover no-repeat;
  transform-origin: 70% 60%;
  animation: lndSettle 9s cubic-bezier(.2, .6, .2, 1) both;
}
.lnd-photo::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(11, 22, 18, .5) 0, rgba(11, 22, 18, 0) 26%),
    linear-gradient(to bottom, rgba(11, 22, 18, 0) 58%, rgba(11, 22, 18, .82) 86%, var(--night) 100%);
}
@keyframes lndSettle { from { transform: scale(1.07); } to { transform: scale(1); } }

.lnd-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px;
  padding: calc(var(--safe-top) + 10px) 20px 0;
  box-sizing: content-box;
}
.lnd-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 17px/1 var(--display); letter-spacing: -.01em; color: var(--text);
}
.lnd-brand img { width: 28px; height: 28px; }
.lnd-about {
  padding: 14px 4px;
  font: 500 14px/1 var(--display); color: var(--text-2); text-decoration: none;
}

.lnd-body {
  position: relative; z-index: 2;
  margin-top: auto;
  padding: 0 24px calc(var(--safe-bottom) + 14px);
}
.lnd-eyebrow {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.lnd-eyebrow b { color: var(--amber); font-weight: 600; font-variant-numeric: tabular-nums; }
.lnd-eyebrow span { transition: opacity .15s ease; }
.lnd-eyebrow span.is-swap { opacity: 0; }
/* the one place a heading goes past the scale's 28: a cover has one line to say */
.lnd-h {
  margin: 0;
  font: 600 34px/1.08 var(--display);
  letter-spacing: -.025em;
  color: var(--text);
  text-wrap: balance;
}
.lnd-p {
  margin: 12px 0 0;
  font-size: 16px; line-height: 1.45; font-weight: 400;
  color: var(--text-2);
  text-wrap: balance;
}
/* the one lit control: the shared .btn.glow, a size up */
.lnd-cta {
  width: 100%;
  margin-top: 24px;
  min-height: 52px;
  font-size: 16px;
  border-radius: 12px;
}
.lnd-cta.is-busy, .lnd-quiet .is-busy { opacity: .6; }
.lnd-quiet { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.lnd-quiet button {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 8px;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  font: 500 15px/1.2 var(--display); color: var(--text); white-space: nowrap;
  transition: background .12s ease;
}
.lnd-quiet button:active { background: var(--night-3); }
.lnd-quiet button + button::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 1px; background: var(--line-2);
}
.lnd-quiet svg { width: 18px; height: 18px; color: var(--text-2); }

@keyframes lndUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.lnd-hello .lnd-body > * { animation: lndUp .5s cubic-bezier(.2, .8, .3, 1) both; }
.lnd-hello .lnd-body > :nth-child(2) { animation-delay: .05s; }
.lnd-hello .lnd-body > :nth-child(3) { animation-delay: .1s; }
.lnd-hello .lnd-body > :nth-child(4) { animation-delay: .15s; }
.lnd-hello .lnd-body > :nth-child(5) { animation-delay: .2s; }

/* ---------------------------------------------- page two: your sleigh --- */

.lnd-sleigh { background: radial-gradient(120% 50% at 50% 0%, #12261E 0%, var(--night) 70%); }
.lnd-steps { display: flex; align-items: center; gap: 6px; padding: 14px 0; }
.lnd-steps i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.lnd-steps i.is-on { width: 18px; border-radius: 3px; background: var(--amber); }
.lnd-pick {
  position: relative; z-index: 2;
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 30px 24px 20px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
}
.lnd-pick .lnd-h { font-size: 28px; letter-spacing: -.02em; line-height: 1.15; }
.lnd-pick .lnd-p { margin: 10px 0 22px; font-size: 15px; }
.lnd-pick .sl-tiles { grid-template-columns: repeat(3, 1fr); }
.lnd-pick .sl-honest { margin: 2px 0 0; }
.lnd-sleigh .lnd-body { margin-top: 0; padding-top: 10px; }
.lnd-sleigh .lnd-cta { margin-top: 0; }
.lnd-skip {
  display: block; width: 100%; margin-top: 8px; min-height: 44px;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  font: 500 15px/1.2 var(--display); color: var(--text-2);
}
.lnd-skip:active { background: var(--night-3); }

/* ------------------------------------------------------- other sizes --- */

/* Wide, and a phone on its side. The picture was drawn for this: dark on the
   left for the words, the street on the right. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4), (orientation: landscape) and (max-height: 560px) {
  .lnd-photo { height: 100%; }
  .lnd-photo i { background-position: 100% 62%; transform-origin: 80% 60%; }
  .lnd-photo::after {
    background:
      linear-gradient(to bottom, rgba(11, 22, 18, .45) 0, rgba(11, 22, 18, 0) 22%),
      linear-gradient(to right, var(--night) 0, rgba(11, 22, 18, .78) 30%, rgba(11, 22, 18, 0) 66%);
  }
  .lnd-top { padding-left: max(24px, 5vw); padding-right: max(24px, 5vw); }
  .lnd-hello .lnd-body { margin-bottom: auto; padding: 0 max(24px, 5vw) 4vh; width: min(760px, 62vw); }
  .lnd-hello .lnd-cta { display: flex; width: fit-content; min-width: 264px; }
  .lnd-hello .lnd-quiet { display: inline-grid; grid-template-columns: auto auto; margin: 10px 0 0 -16px; }
  .lnd-hello .lnd-quiet button { padding: 0 16px; }
}
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .lnd-h { font-size: 48px; letter-spacing: -.03em; }
  .lnd-p { font-size: 18px; }
  .lnd-top { padding-top: calc(var(--safe-top) + 22px); }
  .lnd-brand { font-size: 19px; }
  .lnd-brand img { width: 32px; height: 32px; }
  .lnd-hello .lnd-cta { margin-top: 30px; }
}
/* A tablet held upright, or a tall window: the phone's page, the words kept
   to a column in the middle. */
@media (min-width: 600px) and (max-aspect-ratio: 5/4) {
  .lnd-photo { height: 76%; }
  .lnd-hello .lnd-body {
    width: 100%; max-width: 560px; margin-left: auto; margin-right: auto;
    padding-bottom: calc(var(--safe-bottom) + 56px);
  }
}
/* the sleigh page is a column in the middle on anything wider than a phone */
@media (min-width: 600px) {
  .lnd-pick, .lnd-sleigh .lnd-body { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
  .lnd-pick { flex: 0 1 auto; }
  .lnd-sleigh .lnd-body { margin-bottom: auto; }
}
/* a phone on its side: the five sleighs in one row, the two buttons in another */
@media (orientation: landscape) and (max-height: 560px) {
  .lnd-pick, .lnd-sleigh .lnd-body { max-width: 680px; }
  .lnd-pick { padding-top: 4px; }
  .lnd-pick .lnd-h { font-size: 22px; }
  .lnd-pick .lnd-p { margin: 4px 0 12px; }
  .lnd-pick .sl-tiles { grid-template-columns: repeat(5, 1fr); margin-bottom: 8px; }
  .lnd-pick .sl-tile { min-height: 92px; padding: 8px 4px; }
  .lnd-pick .sl-tile .sl-art { width: 44px; height: 44px; }
  .lnd-sleigh .lnd-body { display: flex; flex-direction: row-reverse; gap: 8px; padding-top: 6px; }
  .lnd-sleigh .lnd-cta { min-height: 48px; }
  .lnd-skip { width: auto; margin-top: 0; padding: 0 22px; min-height: 48px; white-space: nowrap; }
}
/* a short phone: the picture gives way before the words do */
@media (max-height: 700px) and (max-width: 599px) and (orientation: portrait) {
  .lnd-photo { height: 64%; }
  .lnd-h { font-size: 30px; }
  .lnd-hello .lnd-cta { margin-top: 18px; }
  .lnd-pick { padding-top: 14px; }
  .lnd-pick .lnd-p { margin-bottom: 16px; }
  .lnd-pick .sl-tile { min-height: 96px; padding: 10px 6px; gap: 6px; }
  .lnd-pick .sl-tile .sl-art { width: 48px; height: 48px; }
  .lnd-pick .sl-tiles { margin-bottom: 10px; }
}
/* the narrowest phones */
@media (max-width: 350px) {
  .lnd-body, .lnd-pick { padding-left: 18px; padding-right: 18px; }
  .lnd-top { padding-left: 14px; padding-right: 14px; }
  .lnd-h { font-size: 28px; }
  .lnd-p { font-size: 15px; }
  .lnd-quiet button { font-size: 14px; gap: 6px; padding: 0 4px; }
}

/* ------------------------------------------------------------ opening --- */

/* A later visit: the mark over the ground for about half a second while the
   list loads behind it. It never takes a tap, and it leaves by itself even if
   no script runs: js/landing.js only lets it go sooner. */
html.lnd-open .lnd-opening { display: grid; }
.lnd-opening {
  position: fixed; inset: 0;
  z-index: 2000;
  place-items: center;
  background: radial-gradient(90% 50% at 50% 44%, #12261E 0%, var(--night) 70%);
  pointer-events: none;
  animation: lndOpeningOut .25s ease 1.5s both;
}
.lnd-opening.is-done { animation: lndOpeningGone .25s ease both; }
@keyframes lndOpeningOut { to { opacity: 0; visibility: hidden; } }
@keyframes lndOpeningGone { to { opacity: 0; visibility: hidden; } }
.lnd-opening-in { text-align: center; transform: translateY(-3%); }
.lnd-opening-in img {
  display: block; width: 112px; height: 112px; margin: 0 auto -10px;
  animation: lndBulbOn .5s ease-out both;
}
.lnd-opening-in span {
  display: block;
  font: 600 30px/1.1 var(--display); letter-spacing: -.025em; color: var(--text);
}
@keyframes lndBulbOn { from { opacity: .3; transform: scale(.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .lnd, .lnd-page, .lnd-eyebrow span, .lnd-quiet button { transition: none; }
  .lnd-photo i, .lnd-hello .lnd-body > *, .lnd-opening-in img { animation: none; }
  /* no fade: it is there, then it is not */
  .lnd-opening { animation-duration: .01s; }
  .lnd-opening.is-done { animation-duration: .01s; }
}
