/* Public deck theme. It applies the /memo surfaces to the exported slides:
   Sand paper grain, an Ember wordmark, a framed slide, the analog hero for the cover
   and the Dusk field for the closing statement. */

html,
body {
  height: 100%;
}

body {
  --sand: #f2eade;
  --ink: #2b1812;
  --ember: #bf4306;
  --dusk: #3977a8;
  --bone: #fcf4e6;
  --gold: #e8c48e;
  --frame: 20px;
  display: grid;
  grid-template-rows: 88px minmax(0, 1fr) 88px;
  margin: 0;
  padding: 0;
  background: var(--sand) url('/images/memo/paper-grain.webp') repeat;
  color: var(--ink);
}

/* Wordmark: the same lockup as the memo reading header. */
.deck-brand {
  display: flex;
  align-items: center;
  padding: 0 40px;
  color: var(--ember);
}

.deck-brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: inherit;
  font: 500 28px/1 var(--font-body);
  letter-spacing: -0.04em;
  text-decoration: none;
}

.deck-brand img {
  display: block;
  width: 40px;
  height: auto;
}

.deck-brand a:focus-visible,
.deck-nav button:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 6px;
}

/* Slide frame. */
.viewport {
  position: relative;
  width: auto;
  height: auto;
  margin: 0 40px;
  overflow: visible;
  cursor: e-resize;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.viewport[data-side='prev'] {
  cursor: w-resize;
}

.viewport a {
  cursor: pointer;
}

.stage {
  overflow: hidden;
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgb(43 24 18 / 6%),
    0 2px 6px rgb(43 24 18 / 6%),
    0 30px 80px -20px rgb(43 24 18 / 28%);
}

.deck-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  height: 6px;
  background: var(--ember);
  transition: width 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Navigation: two arrows and the slide count, in the memo's quiet Ink. */
.deck-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font: 500 15px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.deck-nav button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(43 24 18 / 22%);
  border-radius: 50%;
  background: rgb(252 244 230 / 55%);
  color: var(--ink);
  font: 400 18px/1 var(--font-body);
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.deck-nav button:hover:not(:disabled) {
  border-color: var(--ember);
  background: var(--ember);
  color: var(--bone);
}

.deck-nav button:disabled {
  opacity: 0.3;
  cursor: default;
}

.deck-count {
  min-width: 64px;
  text-align: center;
  opacity: 0.7;
}

/* Demo slide: the thumbnail opens the Supercut player in an overlay. */
.v10.demo10 .demo-preview-link {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.v10.demo10 .demo-preview-link:hover {
  transform: scale(1.01);
}

.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgb(24 18 15 / 88%);
  animation: video-in 0.25s ease-out;
}

.video-frame {
  width: min(90vw, 90vh * 16 / 9);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 30px 90px rgb(0 0 0 / 45%);
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgb(252 244 230 / 35%);
  border-radius: 50%;
  background: rgb(252 244 230 / 10%);
  color: var(--bone);
  font: 300 32px/1 var(--font-body);
  cursor: pointer;
  transition: background 0.2s;
}

.video-close:hover {
  background: var(--ember);
  border-color: var(--ember);
}

.video-close:focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 4px;
}

@keyframes video-in {
  from {
    opacity: 0;
  }
}

/* Raise slide gate: the public page has a decoy slide. Its title stays readable. The rest is
   a joke for anyone who removes the blur. The real slide comes from /api/deck-access. */
.raise-decoy10 {
  margin-top: 40px;
  filter: blur(22px);
  user-select: none;
}

.raise-decoy10 strong {
  display: block;
  color: var(--ember);
  font: 700 155px/1.05 var(--font-heading);
  letter-spacing: -0.06em;
}

.raise-decoy10 h3 {
  margin: 12px 0 18px;
  font-size: 39px;
}

.raise-decoy10 p {
  margin: 0 0 10px;
  color: var(--muted-text);
  font-size: 26px;
}

.deck-gate {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: min(520px, calc(100% - 32px));
  box-sizing: border-box;
  padding: 32px;
  border-radius: 16px;
  background: var(--bone);
  box-shadow:
    0 0 0 1px rgb(43 24 18 / 8%),
    0 24px 60px -12px rgb(43 24 18 / 30%);
  transform: translate(-50%, -50%);
  cursor: default;
}

.deck-gate[hidden] {
  display: none;
}

.deck-gate-kicker {
  margin: 0 0 10px;
  color: var(--ember);
  font: 500 13px/1 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.deck-gate h2 {
  margin: 0 0 20px;
  font: 700 26px/1.15 var(--font-heading);
  letter-spacing: -0.04em;
}

.deck-gate-row {
  display: flex;
  gap: 8px;
}

.deck-gate input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgb(43 24 18 / 22%);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 400 16px/1.2 var(--font-body);
}

.deck-gate input:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 1px;
}

.deck-gate button {
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--ember);
  color: var(--bone);
  font: 500 16px/1.2 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}

.deck-gate button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.deck-gate button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.deck-gate-error {
  margin: 12px 0 0;
  color: #a03909;
  font: 500 14px/1.35 var(--font-body);
}

/* Friends version: an open quote spot. */
.quotes10 .quote-grid .quote-open10 {
  align-items: center;
  justify-content: center;
  border-top-style: dashed;
  color: var(--ember);
  font: 700 260px/1 var(--font-heading);
  opacity: 0.85;
}

/* Cover: the memo hero image, shade and film grain, with a Bone logo. */
.v10.cover-v7 {
  background: #18364b url('/images/hero-studies/analog-vellum-v1.jpg') center /
    cover;
}

.v10.cover-v7::before,
.v10.closing10::after,
.v10.cover-v7::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.v10.cover-v7::before {
  background: linear-gradient(
    rgb(9 19 26 / 8%),
    rgb(9 19 26 / 15%) 45%,
    rgb(9 19 26 / 48%)
  );
}

.v10.cover-v7::after,
.v10.closing10::after {
  background: url('/images/memo/film-grain.svg') repeat;
  background-size: 180px;
  opacity: 0.18;
  mix-blend-mode: soft-light;
}

.v10.cover-v7 > img,
.v10.closing10 > img {
  z-index: 1;
  filter: brightness(0) invert(96%) sepia(6%);
}

.v10.cover-v7 > img {
  position: relative;
}

/* Closing statement: the memo footer's Dusk field. */
.v10.closing10 {
  background:
    radial-gradient(ellipse at 95% 0, rgb(252 244 230 / 8%), transparent 60%),
    radial-gradient(ellipse at 5% 100%, #18364b, transparent 75%), var(--dusk);
  color: var(--bone);
}

.v10.closing10 .closing-message10 {
  position: relative;
  z-index: 1;
}

.v10.closing10 .closing-premise10 {
  color: rgb(252 244 230 / 78%);
}

.v10.closing10 h2,
.v10.closing10 h2 > span {
  color: var(--bone);
}

.v10.closing10 h2 em {
  color: var(--gold);
}

.v10.closing10 .folio,
.v10.cover-v7 .folio {
  color: var(--bone);
}

@media (max-width: 700px) {
  body {
    grid-template-rows: 72px minmax(0, 1fr) 80px;
  }

  .deck-brand {
    padding: 0 20px;
  }

  .deck-brand a {
    font-size: 24px;
  }

  .deck-brand img {
    width: 34px;
  }

  .viewport {
    margin: 0 12px;
  }

  .stage {
    border-radius: 28px;
  }
}

/* Rotate hint: hidden except on phones in portrait. */
.deck-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 20px;
  color: var(--ink);
  font: 500 16px/1.2 var(--font-body);
  letter-spacing: -0.01em;
}

.deck-hint svg {
  flex: none;
  fill: none;
  stroke: var(--ember);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.deck-hint-phone {
  transform-box: fill-box;
  transform-origin: center;
  animation: deck-rotate 2.8s cubic-bezier(0.6, 0, 0.3, 1) infinite;
}

.deck-hint-arrow {
  opacity: 0.55;
}

@keyframes deck-rotate {
  0%,
  20% {
    transform: rotate(0deg);
  }

  45%,
  80% {
    transform: rotate(-90deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

/* Phones in portrait: hint and slide sit together in the middle of the screen. */
@media (max-width: 700px) and (orientation: portrait) {
  body {
    grid-template-rows: 72px 1fr auto auto 1fr 80px;
  }

  .deck-brand {
    grid-row: 1;
  }

  .deck-hint {
    display: flex;
    grid-row: 3;
  }

  .viewport {
    grid-row: 4;
    height: calc((100vw - 24px) * 9 / 16);
  }

  .deck-nav {
    grid-row: 6;
  }
}

/* Phones in landscape: the slide uses the full height. The arrows move to the side margins. */
@media (orientation: landscape) and (max-height: 540px) {
  body {
    grid-template-rows: minmax(0, 1fr);
  }

  .deck-brand,
  .deck-count {
    display: none;
  }

  .viewport {
    margin: 8px 68px;
  }

  .stage {
    border-radius: 24px;
  }

  .deck-nav {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
  }

  .deck-nav button {
    position: absolute;
    top: 50%;
    margin-top: -22px;
    pointer-events: auto;
  }

  .deck-nav button[data-step='-1'] {
    left: max(12px, env(safe-area-inset-left));
  }

  .deck-nav button[data-step='1'] {
    right: max(12px, env(safe-area-inset-right));
  }

  .deck-gate {
    padding: 18px 20px;
  }

  .deck-gate h2 {
    margin-bottom: 12px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deck-progress,
  .deck-nav button {
    transition: none;
  }

  .video-overlay {
    animation: none;
  }

  .deck-hint-phone {
    animation: none;
    transform: rotate(-90deg);
  }
}
