/* =========================================================
   Home page
   ========================================================= */

/* ---------- hero layout ---------- */
.home-hero .hero-title { --w-base: 112; }
.home-hero .scribble { margin-left: .1em; }

/* ---------- name tag on a lanyard ---------- */
.rig { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.anim .rig { visibility: hidden; }
.anim .rig.is-in { visibility: visible; }
.strap { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.strap-band {
  fill: none; stroke: var(--yellow); stroke-width: 26;
  stroke-linecap: butt; stroke-linejoin: round;
}
.strap-text {
  fill: var(--ink);
  font-family: var(--sans); font-size: 12.5px;
  font-variation-settings: "wdth" 125, "wght" 850;
  letter-spacing: .06em;
}

.badge {
  --bw: clamp(232px, 21vw, 318px);
  --card-h: calc(var(--bw) * .68);
  --clip: 30px;
  position: absolute; left: 0; top: 0;
  width: var(--bw); height: calc(var(--card-h) + var(--clip));
  transform-origin: 50% 0;
  pointer-events: auto; touch-action: none;
  user-select: none; -webkit-user-select: none;
  perspective: 1100px;
  cursor: grab;
  will-change: transform;
}
.badge.is-dragging { cursor: grabbing; }
.badge:focus-visible { outline: none; }
.badge:focus-visible .badge-face { outline: 4px solid var(--yellow); outline-offset: 4px; }

.badge-clip {
  position: absolute; left: 50%; top: -4px; z-index: 2;
  width: 30px; height: 40px; margin-left: -15px;
  border-radius: 7px 7px 5px 5px;
  background: linear-gradient(90deg, #7f8790, #eef1f4 38%, #c4cad1 55%, #8a929b);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25), 0 2px 3px rgba(0, 0, 0, .3);
}
.badge-clip::after {
  content: ""; position: absolute; left: 50%; top: 9px;
  width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--cobalt-deep); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
}

.badge-card {
  position: absolute; left: 0; right: 0; top: var(--clip); height: var(--card-h);
  transform-style: preserve-3d;
  transform: rotateY(var(--spin, 0deg));
}
.badge-face {
  position: absolute; inset: 0;
  border-radius: 18px;
  overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 18px 30px -12px rgba(0, 0, 20, .55);
}
/* plastic sheen */
.badge-face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .38) 42%, rgba(255, 255, 255, 0) 54%);
  transform: translateX(var(--sheen, -30%));
}
.badge-front { display: flex; flex-direction: column; transform: translateZ(1px); }
.tag-band {
  background: var(--red); color: var(--paper);
  padding: calc(var(--bw) * .055) 0 calc(var(--bw) * .03);
  text-align: center;
}
.tag-hello {
  display: block;
  font-size: calc(var(--bw) * .2); line-height: .82;
  font-variation-settings: "wdth" 122, "wght" 900;
  letter-spacing: .02em;
}
.tag-my {
  display: block; margin-top: calc(var(--bw) * .015);
  font-size: calc(var(--bw) * .062); line-height: 1;
  font-variation-settings: "wdth" 110, "wght" 640;
  letter-spacing: .04em;
}
.tag-name {
  flex: 1; display: grid; place-items: center;
  font-family: var(--hand);
  font-size: calc(var(--bw) * .175); line-height: 1;
  color: var(--ink);
}
.tag-name span { display: inline-block; transform: rotate(-4deg) translateY(4%); }
.tag-foot { height: calc(var(--bw) * .07); background: var(--red); }

.badge-back {
  transform: rotateY(180deg) translateZ(1px);
  padding: calc(var(--bw) * .07) calc(var(--bw) * .08);
  display: flex; flex-direction: column; justify-content: center;
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(var(--bw) * .085), rgba(35, 55, 255, .14) calc(var(--bw) * .085) calc(var(--bw) * .089)),
    var(--paper);
}
.back-q {
  font-family: var(--hand);
  font-size: calc(var(--bw) * .14); line-height: 1;
  transform: rotate(-3deg);
}
.back-list { margin-top: calc(var(--bw) * .05); font-family: var(--hand); font-size: calc(var(--bw) * .062); line-height: 1.4; }
.back-list li { display: flex; align-items: center; gap: .5em; }
.back-list li::before {
  content: ""; width: .8em; height: .8em; flex: none;
  border: 2px solid var(--ink); border-radius: 3px;
}
.back-list li.tick::before {
  background: linear-gradient(45deg, transparent 44%, var(--red) 44% 56%, transparent 56%),
              linear-gradient(-45deg, transparent 44%, var(--red) 44% 56%, transparent 56%);
}

/* glow-in-the-dark */
.lights-off .badge-face { box-shadow: 0 0 0 2px rgba(46, 229, 157, .9), 0 0 40px 6px rgba(46, 229, 157, .55); }
.lights-off .strap-band { stroke: #8af5c8; }

/* ---------- stickers on the hero ---------- */
.st-hi    { --size: clamp(96px, 9vw, 150px);   --x: 47%; --y: 12%; }
.st-smile { --size: clamp(78px, 7.4vw, 122px); --x: 55%; --y: 74%; }
.st-chai  { --size: clamp(84px, 7.8vw, 128px); --x: 88%; --y: 48%; }
.st-human { --size: clamp(98px, 9.2vw, 150px); --x: 74%; --y: 66%; }
.st-note  { --size: auto;                      --x: 67%; --y: 86%; }

/* ---------- mood check ---------- */
.mood {
  position: relative;
  background: var(--yellow); color: var(--ink);
  padding: clamp(140px, 15vw, 220px) var(--pad) clamp(90px, 10vw, 150px);
}
@media (min-width: 1000px) {
  .mood {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 6vw;
  }
  .mood-title, .mood-hint { grid-column: 1; }
  .moods { grid-column: 2; grid-row: 1 / span 2; align-self: end; margin-top: 0; }
  .chat { grid-column: 2; grid-row: 3; }
}
.mood-title {
  font-size: var(--t-xl); line-height: .9;
  font-variation-settings: "wdth" 76, "wght" 900;
  letter-spacing: -.01em;
  max-width: 12ch;
}
.mood-hint {
  font-family: var(--hand); font-size: var(--t-l);
  margin-top: 20px; transform: rotate(-2deg); transform-origin: 0 50%;
}
.moods { display: flex; flex-wrap: wrap; gap: 14px 12px; margin-top: 42px; max-width: 1000px; }
.mood-btn {
  --r: 0deg;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px 14px 15px;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px;
  font-size: clamp(18px, 1.6vw, 22px); line-height: 1;
  font-variation-settings: "wdth" 108, "wght" 800;
  transform: rotate(var(--r));
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .35s var(--spring), box-shadow .12s, background-color .2s, color .2s;
}
.mood-btn:nth-child(1) { --r: -2.5deg; }
.mood-btn:nth-child(2) { --r: 1.8deg; }
.mood-btn:nth-child(3) { --r: -1deg; }
.mood-btn:nth-child(4) { --r: 2.6deg; }
.mood-btn:nth-child(5) { --r: -2deg; }
.mood-btn:nth-child(6) { --r: 1.2deg; }
.mood-btn:hover { transform: rotate(0deg) translateY(-3px); box-shadow: 0 8px 0 var(--ink); }
.mood-btn:active { transform: rotate(0deg) translateY(4px); box-shadow: 0 1px 0 var(--ink); transition-duration: .08s; }
.mood-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.mood-btn .e { font-size: 1.35em; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

.chat {
  margin-top: 46px; max-width: 780px; min-height: 140px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg {
  max-width: min(560px, 90%);
  padding: 14px 20px 15px;
  border-radius: 26px;
  font-size: clamp(19px, 1.9vw, 25px); line-height: 1.25;
  animation: pop .5s var(--spring) both;
}
.msg-you {
  align-self: flex-end;
  background: var(--ink); color: var(--paper);
  border-bottom-right-radius: 8px;
  font-variation-settings: "wdth" 104, "wght" 700;
}
.msg-me {
  align-self: flex-start;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-bottom-left-radius: 8px;
  font-family: var(--hand);
}
.msg-who {
  display: block; margin-bottom: 4px;
  font-family: var(--sans); font-size: 13px;
  font-variation-settings: "wdth" 100, "wght" 700;
  opacity: .55;
}
.typing { display: inline-flex; gap: 6px; padding: 6px 2px; }
.typing i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); animation: bob 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-6px); opacity: 1; } }
@keyframes pop { from { transform: scale(.6) translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

body.shake main { animation: shake .55s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px) rotate(-.2deg); }
  20%, 80% { transform: translateX(4px) rotate(.25deg); }
  30%, 50%, 70% { transform: translateX(-7px) rotate(-.35deg); }
  40%, 60% { transform: translateX(7px) rotate(.35deg); }
}

/* ---------- responsive ---------- */
/* phones and portrait tablets: the tag hangs at the top, the greeting sits under it */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .home-hero {
    --stack-bw: min(58vw, 330px);
    justify-content: flex-start;
    padding-top: calc(var(--topbar) + var(--stack-bw) * .68 + 96px);
    padding-bottom: 300px; /* a strip at the bottom for the stickers */
  }
  .home-hero .hero-title { font-size: 26.5vw; --w-base: 84; }
  .home-hero .scribble { font-size: 8.6vw; }
  .badge { --bw: var(--stack-bw); }
  /* stickers sit in the bottom strip, so they never land on the words */
  .st-hi    { --size: clamp(84px, 16vw, 140px); --x: 4%;  --y: calc(var(--topbar) + 22px); }
  .st-chai  { --size: clamp(72px, 14vw, 120px); --x: 72%; --y: calc(100% - 268px); }
  .st-smile { --size: clamp(78px, 15vw, 126px); --x: 7%;  --y: calc(100% - 250px); }
  .st-human { --size: clamp(96px, 18vw, 150px); --x: 44%; --y: calc(100% - 212px); }
  .st-note  { --x: 13%; --y: calc(100% - 118px); font-size: 13px; }
}

/* phones held sideways */
@media (orientation: landscape) and (max-height: 520px) {
  .badge { --bw: 200px; }
}
