/* Same paper, tape and handwriting as the RSVP scrapbook (site/designs/17-scrapbook-path). */
:root {
  --page: #0d4a32;
  --page-deep: #003d20;
  --paper: #fbf6ec;
  --print: #fffcf5;
  --orange-deep: #8e3a12;
  --gold-soft: #dcc68a;
  --marigold: #e39b37;
  --ink: #1d1a15;
  --muted: #5a5043;
  --error: #9b2614;
  --serif: 'Brygada 1918', Georgia, 'Times New Roman', serif;
  --hand: 'Nothing You Could Do', 'Bradley Hand', 'Segoe Print', cursive;
  --ease-out: cubic-bezier(0.22, 0.8, 0.3, 1);
  --paper-shadow: 0 1px 1px rgba(0, 25, 12, 0.3), 0 14px 24px -14px rgba(0, 12, 6, 0.75);
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .92 0 0 0 0 .82 0 0 0 .55 -.24'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .19 0 0 0 0 .1 0 0 0 .5 -.22'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100dvh;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--paper);
  background-color: var(--page);
  background-image:
    var(--grain-light),
    linear-gradient(180deg, #0f4d35 0%, var(--page) 30%, #0b4430 75%, var(--page-deep) 100%);
}

p,
h1,
h2,
figure,
ul {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
}

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

.page {
  width: min(100% - 2.25rem, 27rem);
  margin-inline: auto;
  padding: calc(1.9rem + env(safe-area-inset-top)) 0 calc(3rem + env(safe-area-inset-bottom));
}

/* ---- The print and the note stuck beside it ---- */

.top {
  position: relative;
  display: flex;
  justify-content: center;
  padding-right: 3.1rem;
}

.print {
  position: relative;
  width: min(66%, 15rem);
  padding: 0.65rem 0.65rem 0;
  background: var(--grain-dark), var(--print);
  box-shadow: var(--paper-shadow);
  transform: rotate(-2.4deg);
}

.print img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 14%;
}

.print figcaption {
  padding: 0.55rem 0 0.7rem;
  font-family: var(--hand);
  font-size: 1.4rem;
  line-height: 1.1;
  color: #3a3226;
  text-align: center;
}

.print__tape {
  left: 30%;
  top: -0.7rem;
  width: 40%;
  --ta: 2deg;
}

.sticky {
  position: absolute;
  right: 0;
  bottom: 0.9rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.1rem;
  width: 7rem;
  min-height: 6.4rem;
  padding: 0.7rem 0.5rem 0.8rem;
  color: #2b1a07;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(120, 60, 0, 0.12), rgba(120, 60, 0, 0) 20%),
    linear-gradient(172deg, #ebaa4f, var(--marigold) 45%, #da902f);
  border-radius: 2px 2px 4px 18px / 2px 2px 4px 9px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 14px 18px -12px rgba(0, 0, 0, 0.7);
  transform: rotate(4.5deg);
}

.sticky__small {
  font-size: 0.95rem;
  line-height: 1.2;
}

.sticky__big {
  font-family: var(--hand);
  font-size: 1.85rem;
  line-height: 1.05;
  white-space: nowrap;
}

.title {
  margin-top: 1.5rem;
  font-family: var(--hand);
  font-size: clamp(1.9rem, 9.6vw, 2.9rem);
  font-weight: 400;
  line-height: 1.15;
  text-align: center;
}

/* ---- Tape ---- */

.tape {
  position: absolute;
  z-index: 3;
  height: 1.5rem;
  opacity: 0.93;
  transform: rotate(var(--ta, 0deg));
  pointer-events: none;
  clip-path: polygon(2% 0, 98% 0, 100% 18%, 97.6% 37%, 100% 56%, 97.8% 75%, 99.4% 100%, 2.2% 100%, 0 80%, 2.4% 62%, 0 44%, 2.2% 25%);
}

.tape--o,
.bar__fill {
  background:
    radial-gradient(circle, rgba(251, 246, 236, 0.55) 0 1.2px, transparent 1.9px) 0 0 / 9px 9px,
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%),
    #c45d27;
}

.tape--c {
  background:
    repeating-linear-gradient(90deg, rgba(168, 137, 47, 0.3) 0 1px, transparent 1px 7px),
    linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%),
    #e6d3ae;
}

/* ---- The sheet of paper ---- */

.paper {
  position: relative;
  margin-top: 1.5rem;
  padding: 1.8rem 1.4rem 1.5rem;
  background: var(--grain-dark), var(--paper);
  color: var(--ink);
  box-shadow: var(--paper-shadow);
}

.paper :focus-visible {
  outline-color: var(--page);
}

.paper__tape {
  left: 34%;
  top: -0.7rem;
  width: 32%;
  --ta: -1.5deg;
}

.paper__heading {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  margin-top: 1.1rem;
  padding: 0.6rem 1.15rem;
  border: 1.5px solid var(--page);
  border-radius: 6px;
  background: var(--page);
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms var(--ease-out);
}

.btn:active {
  transform: scale(0.98);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.btn--quiet {
  background: transparent;
  color: var(--page);
}

.fine {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}

.count {
  margin-top: 0.35rem;
  color: var(--muted);
}

/* The bar is a strip of tape being laid across the page. */
.bar {
  height: 1.05rem;
  margin-top: 0.8rem;
  overflow: hidden;
  background: rgba(13, 74, 50, 0.13);
}

.bar__fill {
  display: block;
  width: 0;
  height: 100%;
  transition: width 240ms linear;
}

.thanks {
  font-family: var(--hand);
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--orange-deep);
  text-align: center;
}

.thanks:focus {
  outline: none;
}

.thanks + p {
  margin-top: 0.4rem;
}

.problems {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(29, 26, 21, 0.16);
  font-size: 0.98rem;
}

.problems__lead {
  font-weight: 600;
}

.problems ul {
  margin-top: 0.3rem;
  padding: 0;
  list-style: none;
  color: var(--error);
}

.problems li {
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}

.problems strong {
  font-weight: 600;
}

.picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- What you've shared: your own little page of prints ---- */

.mine {
  margin-top: 2.3rem;
  text-align: center;
}

.mine__title {
  font-family: var(--hand);
  font-size: 1.95rem;
  font-weight: 400;
  line-height: 1.2;
}

.mine__count {
  margin-top: 0.15rem;
  font-size: 0.98rem;
  color: var(--gold-soft);
}

.mine__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem 0.7rem;
  margin-top: 1.15rem;
  padding: 0;
  list-style: none;
}

.snap {
  transform: rotate(var(--tilt, 0deg));
}

.snap--new {
  animation: land 460ms var(--ease-out) both;
}

@keyframes land {
  from {
    opacity: 0;
    transform: translateY(-16px) rotate(calc(var(--tilt, 0deg) - 8deg)) scale(1.14);
  }
  to {
    opacity: 1;
    transform: rotate(var(--tilt, 0deg));
  }
}

.snap__card {
  position: relative;
  display: block;
  width: 100%;
  padding: 6% 6% 17%;
  border: 0;
  background: var(--grain-dark), var(--print);
  box-shadow: 0 1px 1px rgba(0, 25, 12, 0.32), 0 8px 12px -8px rgba(0, 12, 6, 0.7);
  cursor: zoom-in;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.snap__img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e9e1d1;
}

.snap__none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--hand);
  font-size: 1.15rem;
  color: var(--muted);
}

/* A small play mark, so videos read as videos. */
.snap__play {
  position: absolute;
  left: 50%;
  top: 41%;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: rgba(13, 74, 50, 0.82);
  transform: translate(-50%, -50%);
}

.snap__play::after {
  content: '';
  position: absolute;
  left: 38%;
  top: 27%;
  border-style: solid;
  border-width: 0.5rem 0 0.5rem 0.75rem;
  border-color: transparent transparent transparent var(--paper);
}

/* ---- Looking at one photo or video ---- */

.viewer {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #031e13;
  color: var(--paper);
}

.viewer::backdrop {
  background: rgba(3, 30, 19, 0.9);
}

.viewer__body {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: calc(4rem + env(safe-area-inset-top)) 0.75rem calc(1rem + env(safe-area-inset-bottom));
}

.viewer__body:focus {
  outline: none;
}

.viewer__body img,
.viewer__body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer__note {
  max-width: 22rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.viewer__close {
  position: fixed;
  top: calc(0.75rem + env(safe-area-inset-top));
  right: 0.75rem;
  z-index: 1;
  min-height: 44px;
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--paper);
  border-radius: 6px;
  background: rgba(3, 30, 19, 0.6);
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Keeps the button on the first screen of short phones. */
@media (max-height: 640px) {
  .print {
    width: min(50%, 11.5rem);
  }
  .title {
    margin-top: 1rem;
  }
  .paper {
    margin-top: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snap--new {
    animation: none;
  }
  .bar__fill,
  .btn {
    transition: none;
  }
}
