/* ==========================================================================
   Styles for the holding page.

   The big letters and charts are drawn by holding.js on a "canvas" (a blank
   drawing surface). This file styles everything else: the paper, the small
   print, the caption and the big red button.
   ========================================================================== */

/* The colours below are only the starting set. holding.js swaps them every
   time the poster changes. */
:root {
  --paper: #ffd93b;
  --text: #161616;
  --ink1: #ff4fae;
  --ink2: #1560d4;
  --ink3: #f2542d;
  --mix1: #15209a;
  --mix2: #141f25;
  --mix3: #f21a1f;

  --margin: clamp(16px, 3.6vw, 48px);    /* the gap round the edge of the page */
  --button: clamp(88px, 10.5vw, 136px);  /* how wide the big red button is */
  --bottom: 172px;                       /* the height kept clear for the caption and button */
}

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

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

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background-color: var(--paper);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', Times, serif;
  transition: background-color 0.6s ease, color 0.6s ease;
}

/* Everything that turns upside down for the "Australian edition" stunt */
#world {
  position: fixed;
  inset: 0;
  transition: transform 1s cubic-bezier(0.3, 1.4, 0.45, 1);
}
body.flipped #world { transform: rotate(180deg); }

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* The second drawing layer (confetti and flying pie) sits on top of everything */
#fx {
  position: fixed;
  z-index: 10;
  pointer-events: none;
}

/* ----- The printed sheet: all the words and the button ----- */

.sheet {
  position: absolute;
  inset: 0;
  /* the max(...) keeps the words clear of a phone's notch and rounded corners */
  padding:
    max(var(--margin), env(safe-area-inset-top))
    max(var(--margin), env(safe-area-inset-right))
    max(var(--margin), env(safe-area-inset-bottom))
    max(var(--margin), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  pointer-events: none;          /* clicks pass through to the artwork... */
  -webkit-user-select: none;
  user-select: none;
}
.sheet button { pointer-events: auto; }   /* ...except on the buttons */

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.imprint {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.9em;
}
.imprint strong { font-weight: 700; }

.poster-no {
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.02em;
  text-transform: none;
}

.sound {
  flex: none;
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1.5px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.middle {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

/* The plain "Back soon" heading. It only shows if the script cannot run;
   otherwise it is hidden from view but still read out by screen readers. */
.headline {
  margin: 0;
  font: italic 700 clamp(64px, 19vw, 260px) / 0.86 Georgia, serif;
  letter-spacing: -0.04em;
  text-align: center;
}
.js .headline,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.bottom {
  height: var(--bottom);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: clamp(12px, 3vw, 40px);
}

.words {
  min-width: 0;
  max-width: 34em;
}

.caption {
  margin: 0 0 14px;
  font-size: clamp(17px, 1.9vw, 25px);
  font-style: italic;
  line-height: 1.24;
  text-wrap: balance;
}
.caption b {
  font-style: normal;
  font-weight: 700;
}
.caption.fresh { animation: arrive 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(10px); }
}

/* ----- Printer's marks: colour swatches, a registration target, small print ----- */

.marks {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.swatches { display: flex; }
.swatches i {
  width: 11px;
  height: 11px;
  transition: background-color 0.6s ease;
}
.swatches i:nth-child(1) { background: var(--ink1); }
.swatches i:nth-child(2) { background: var(--mix1); }
.swatches i:nth-child(3) { background: var(--ink2); }
.swatches i:nth-child(4) { background: var(--mix2); }
.swatches i:nth-child(5) { background: var(--ink3); }
.swatches i:nth-child(6) { background: var(--mix3); }

.reg {
  flex: none;
  width: 16px;
  height: 16px;
}

/* Little corner marks, like the ones printers use to trim a sheet */
.crop {
  position: absolute;
  width: 14px;
  height: 14px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 0 0 / 1.5px 100% no-repeat;
}
.crop.tl { left: 9px; top: 9px; }
.crop.tr { right: 9px; top: 9px; transform: scaleX(-1); }
.crop.bl { left: 9px; bottom: 9px; transform: scaleY(-1); }
.crop.br { right: 9px; bottom: 9px; transform: scale(-1); }

/* ----- The big red button ----- */

.button-zone {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.note {
  margin: 0 4px 2px 0;
  font-size: clamp(14px, 1.3vw, 17px);
  font-style: italic;
  white-space: nowrap;
}

.arrow {
  width: 34px;
  height: 26px;
  margin: 0 calc(var(--button) * 0.4) 6px 0;
  overflow: visible;
}

/* The button is three stacked shapes: a black base, a dark red wall, and a
   bright red top that slides down when pressed. */
.press {
  position: relative;
  width: var(--button);
  height: calc(var(--button) * 0.84);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.press span {
  position: absolute;
  left: 0;
  right: 0;
  display: block;
}
.press .base {
  left: -6%;
  right: -6%;
  bottom: 0;
  height: 52%;
  border-radius: 50%;
  background: #161616;
}
.press .wall {
  bottom: 7%;
  height: calc(var(--button) * 0.76);
  border-radius: 50% / calc(var(--button) * 0.31);
  background: #a30d21;
}
.press .cap {
  top: 0;
  height: calc(var(--button) * 0.62);
  border-radius: 50%;
  background: #e8192f;
  transition: transform 0.07s ease-out;
}
.press .cap::after {   /* a flat highlight, so it looks shiny */
  content: '';
  position: absolute;
  left: 16%;
  top: 14%;
  width: 34%;
  height: 24%;
  border-radius: 50%;
  background: #ff7d7d;
  transform: rotate(-18deg);
}
.press:active .cap { transform: translateY(calc(var(--button) * 0.1)); }

/* A clear outline for people using a keyboard */
button:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 5px;
}

/* ----- If the script cannot run: a plain, still page ----- */

html:not(.js) canvas,
html:not(.js) .button-zone,
html:not(.js) .sound,
html:not(.js) .poster-no { display: none; }

/* ----- Small screens ----- */

@media (max-width: 759px) {
  .crop { display: none; }
  .marks .small { display: none; }   /* keep the swatches, drop the small print */
}

/* ----- For people who have asked their device to reduce motion ----- */

@media (prefers-reduced-motion: reduce) {
  body,
  #world,
  .swatches i { transition: none; }
  .caption.fresh { animation: none; }
}
