/* ==========================================================================
   ilovemybeautifulgirlfriend.com
   You shouldn't need to touch this file. All the words live in index.html.
   If you want to change the colors, the palette is right below.
   ========================================================================== */

:root {
  /* palette */
  --paper:    #FAF2E6;  /* the page */
  --card:     #FFFCF6;  /* note cards */
  --ink:      #4B403A;  /* main text */
  --ink-soft: #7E6E64;  /* captions, labels */
  --rose:     #DC8A8E;  /* dusty rose */
  --sage:     #9FBE9C;  /* sage */
  --sage-ink: #6E9269;  /* sage, dark enough to read as text */
  --butter:   #F5CE79;  /* butter yellow */

  /* tape color, as an rgb triplet so sections can retint it */
  --tape-rgb: 245, 206, 121;

  /* type */
  --hand:  "Caveat", "Bradley Hand", cursive;
  --body:  "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --type:  "Special Elite", "Courier New", monospace;

  /* rhythm */
  --pad-y: clamp(2.75rem, 6vw, 4.25rem);
  --gut:   clamp(1.25rem, 5vw, 2.5rem);
  --maxw:  64rem;

  --lift: 0 12px 26px -16px rgba(75, 64, 58, .45),
          0 2px 5px rgba(75, 64, 58, .07);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, .97rem + .2vw, 1.08rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
p  { margin: 0; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gut);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* Paper grain over the whole page. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------- TAPE ---------------------------------- */
/* One strip of washi tape, stuck on the top edge of whatever it's added to. */

.tape { position: relative; }

.tape::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -.8rem;
  left: 50%;
  width: 5.5rem;
  height: 1.65rem;
  transform: translateX(-50%) rotate(-2.5deg);
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, .22) 0 3px, transparent 3px 7px),
    rgba(var(--tape-rgb), .62);
  clip-path: polygon(4% 3%, 100% 0, 96% 100%, 0 96%);
  mix-blend-mode: multiply;
}

.tape--wide::before { width: 8rem; rotate: 1.5deg; }

/* Corner strip, for the photo. */
.tape--corner::before {
  top: -.9rem;
  left: -1.1rem;
  width: 5rem;
  transform: rotate(-38deg);
}

/* -------------------------------- SECTIONS -------------------------------- */

.section { padding-block: var(--pad-y); }

.hero { padding-block: clamp(2.5rem, 7vw, 4.5rem) 0; }

/* --------------------------------- COVER ---------------------------------- */

.cover {
  position: relative;
  max-width: 40rem;
  margin-inline: auto;
  padding: clamp(2.25rem, 6vw, 3.5rem) clamp(1.5rem, 5vw, 3rem);
  text-align: center;
  background: var(--card);
  border-radius: 3px;
  box-shadow: var(--lift);
  rotate: -.7deg;
}

.cover__eyebrow {
  font-family: var(--type);
  font-size: clamp(.66rem, .6rem + .3vw, .78rem);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.cover__title {
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: 1.02;
  letter-spacing: .01em;
}

.squiggle {
  display: inline-block;
  color: var(--rose);
  padding-bottom: .12em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 12'%3E%3Cpath d='M2 8 Q 12 1.5, 21 8 T 40 8 T 59 8 T 78 8' fill='none' stroke='%23DC8A8E' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: 0 100%;
  background-size: 4.5rem .5em;
}

.dot {
  font-family: var(--type);
  font-size: .26em;
  letter-spacing: .01em;
  color: var(--sage-ink);
  vertical-align: .42em;
  margin-left: .12em;
}

.cover__sub {
  max-width: 26rem;
  margin: 1.5rem auto 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.pen {
  font-family: var(--hand);
  font-size: 1.35em;
  font-weight: 600;
  color: var(--rose);
}

.heart {
  position: absolute;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--rose);
  opacity: .65;
}

.heart--a { top: 1.4rem; right: 1.6rem; }
.heart--b { bottom: 1.5rem; left: 1.7rem; color: var(--sage); font-size: 1.1rem; }

/* -------------------------------- TICKET ---------------------------------- */

.ticket {
  --tape-rgb: 159, 190, 156;
  max-width: 30rem;
  margin: clamp(2rem, 5vw, 3rem) auto 0;
  padding: 1.5rem 1.25rem 1.35rem;
  text-align: center;
  background: var(--card);
  border: 1px dashed rgba(75, 64, 58, .22);
  border-radius: 3px;
  box-shadow: var(--lift);
  rotate: .9deg;
}

.ticket__label,
.ticket__note {
  font-family: var(--type);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ticket__label { margin-bottom: .9rem; }
.ticket__note  { margin-top: .9rem; }

.ticket__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(.7rem, 3.5vw, 1.6rem);
}

.unit dd {
  margin: 0;
  font-family: var(--type);
  font-size: clamp(1.3rem, 1rem + 1.5vw, 1.9rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.unit dt {
  margin-top: .35rem;
  font-family: var(--body);
  font-weight: 700;
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.unit--secs dd { color: var(--rose); }

/* -------------------------------- LETTER ---------------------------------- */

.letter {
  display: grid;
  gap: clamp(3rem, 7vw, 4rem);
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 58rem) {
  .letter { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}

.sheet {
  padding: clamp(1.75rem, 5vw, 2.75rem);
  background: var(--card);
  border-radius: 3px;
  box-shadow: var(--lift);
  rotate: -.5deg;
}

.sheet__hi {
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 1.35rem;
}

.sheet p + p { margin-top: 1.1em; }

.sheet > p {
  font-size: 1rem;
  line-height: 1.75;
  color: rgba(75, 64, 58, .88);
}

.sheet__signoff {
  margin-top: 1.9rem;
  font-family: var(--hand);
  font-size: 1.6rem;
  line-height: 1.3;
  color: var(--ink-soft);
}

.sheet__signoff span { color: var(--rose); font-weight: 600; }

/* -------------------------------- POLAROID --------------------------------- */

.polaroid {
  --tape-rgb: 220, 138, 142;
  margin: 0;
  padding: .8rem .8rem .3rem;
  background: #FFFDFA;
  border-radius: 2px;
  box-shadow: var(--lift);
  rotate: 1.8deg;
}

.polaroid__window {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  background: #F6EEE1;
  overflow: hidden;
}

.polaroid__window img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.polaroid__empty {
  padding: 1rem;
  font-family: var(--type);
  font-size: .74rem;
  line-height: 2;
  text-align: center;
  color: var(--ink-soft);
}

.polaroid__empty code { color: var(--rose); }

/* When the photo loads, drop the placeholder text. */
.polaroid__window img ~ .polaroid__empty { display: none; }

.polaroid figcaption {
  padding: .85rem .3rem .6rem;
  font-family: var(--hand);
  font-size: 1.15rem;
  line-height: 1.35;
  text-align: center;
  color: var(--ink-soft);
}

/* --------------------------------- NOTES ----------------------------------- */

.scrawl {
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem);
  line-height: 1.1;
  text-align: center;
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}

.scrawl__note {
  display: block;
  margin-top: .4rem;
  font-family: var(--body);
  font-weight: 400;
  font-size: .82rem;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

.notes {
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.5rem);
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) { .notes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .notes { grid-template-columns: repeat(3, 1fr); } }

.note {
  padding: 1.65rem 1.4rem 1.5rem;
  background: var(--note-bg, var(--card));
  border-radius: 2px;
  box-shadow: var(--lift);
}

.note h3 {
  font-family: var(--hand);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
  margin-bottom: .55rem;
}

.note p {
  font-size: .92rem;
  line-height: 1.65;
  color: rgba(75, 64, 58, .78);
}

/* Colors and angles cycle so the wall never looks laid out on a grid. */
.note:nth-child(3n + 1) { --note-bg: #FDF1DA; --tape-rgb: 159, 190, 156; }
.note:nth-child(3n + 2) { --note-bg: #FBE6E6; --tape-rgb: 245, 206, 121; }
.note:nth-child(3n + 3) { --note-bg: #EAF1E7; --tape-rgb: 220, 138, 142; }

.note:nth-child(4n + 1) { rotate: -1.3deg; }
.note:nth-child(4n + 2) { rotate:  .9deg; }
.note:nth-child(4n + 3) { rotate: -.5deg; }
.note:nth-child(4n + 4) { rotate: 1.5deg; }

@media (min-width: 60rem) {
  .note:nth-child(2) { margin-top: 1.6rem; }
  .note:nth-child(3) { margin-top: .7rem; }
  .note:nth-child(5) { margin-top: 1.1rem; }
}

/* ------------------------------ CERTIFICATE -------------------------------- */

.cert {
  position: relative;
  max-width: 32rem;
  margin-inline: auto;
  padding: clamp(1.75rem, 5vw, 2.5rem) clamp(1.4rem, 4vw, 2.25rem);
  text-align: center;
  background: var(--card);
  border: 2px dashed rgba(220, 138, 142, .45);
  border-radius: 3px;
  box-shadow: var(--lift);
  rotate: -.8deg;
}

.cert__top {
  font-family: var(--type);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cert__name {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(2.1rem, 1.6rem + 2.2vw, 3rem);
  line-height: 1.1;
  color: var(--rose);
  margin: .35rem 0 1.4rem;
}

.cert__list {
  display: grid;
  gap: .6rem;
  padding-top: 1.3rem;
  border-top: 1px dashed rgba(75, 64, 58, .2);
  font-family: var(--type);
  font-size: .76rem;
}

.cert__list > div {
  display: grid;
  gap: .1rem;
  justify-items: center;
}

@media (min-width: 30rem) {
  .cert__list > div {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: .75rem;
    justify-items: start;
    text-align: left;
  }
}

.cert__list dt {
  color: var(--ink-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .66rem;
}

.cert__list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.cert__stamp {
  position: absolute;
  right: 1.1rem;
  bottom: .9rem;
  font-size: 2.4rem;
  line-height: 1;
  color: rgba(220, 138, 142, .3);
  rotate: -14deg;
}

/* --------------------------------- FOOTER ---------------------------------- */

.footer {
  padding-block: clamp(2.25rem, 5vw, 3.5rem) clamp(3rem, 7vw, 4.5rem);
  text-align: center;
}

.footer__line {
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  line-height: 1.25;
  color: var(--ink);
}

.footer__meta {
  margin-top: .8rem;
  font-family: var(--type);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* --------------------------------- MOTION ----------------------------------- */

/* Page-load sequence. Only applied when JS is on, so a JS failure can never
   leave the page invisible. */
.js .cover,
.js .ticket {
  opacity: 0;
  animation: settle .75s cubic-bezier(.2, .7, .3, 1) forwards;
  animation-delay: calc(var(--i, 0) * 160ms + 120ms);
}

@keyframes settle {
  from { opacity: 0; transform: translateY(1rem) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* Scroll reveals. `rotate` is its own property, so each card keeps the
   crooked angle set above while it slides in. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .3, 1);
}

.js [data-reveal].in {
  opacity: 1;
  transform: none;
}

.heart {
  animation: bob 3.6s ease-in-out infinite;
}

.heart--b { animation-delay: -1.8s; }

@keyframes bob {
  0%, 100% { transform: translateY(0)      rotate(-6deg); }
  50%      { transform: translateY(-.35rem) rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .js .cover,
  .js .ticket,
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
  .heart { animation: none; }
}
