/* Layout: a "Hello, my name is" sticker on a cool desk surface. Spinning photo above,
   a short note and links beneath, then a wall of visitor stickers. */
:root {
  --desk: #dfe6ee;
  --desk-ink: #1d2a3a;
  --muted: #556479;
  --tag-red: #d7262f;
  --tag-white: #ffffff;
  --marker: #15181d;
  --tag-sub: #5b6573;
  --peel-back: #ece8e1;
  --link-bg: #0a66c2;
  --link-fg: #ffffff;
  --shadow: rgba(29, 42, 58, 0.18);
  --font-display: "Bricolage Grotesque", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-hand: "Permanent Marker", "Marker Felt", "Comic Sans MS", cursive;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sharpie: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='rotate(45 16 16)'%3E%3Crect x='12' y='1' width='8' height='19' rx='2' fill='%2315181d' stroke='white' stroke-width='1.5'/%3E%3Crect x='12' y='5' width='8' height='5' fill='%23d7262f'/%3E%3Cpath d='M13 20h6l-2 7h-2z' fill='%2315181d' stroke='white' stroke-width='1.2'/%3E%3C/g%3E%3C/svg%3E") 8 24, crosshair;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #121a25; --desk-ink: #e6edf5; --muted: #93a3b8;
    --tag-red: #e0353d; --tag-white: #f7f8fa; --marker: #15181d; --tag-sub: #5b6573;
    --peel-back: #c9c4bc;
    --link-bg: #3b8fe0; --link-fg: #0b1520; --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #121a25; --desk-ink: #e6edf5; --muted: #93a3b8;
  --tag-red: #e0353d; --tag-white: #f7f8fa; --marker: #15181d; --tag-sub: #5b6573;
  --peel-back: #c9c4bc;
  --link-bg: #3b8fe0; --link-fg: #0b1520; --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

[hidden] { display: none !important; }
html { min-height: 100%; overflow-x: clip; cursor: var(--sharpie); }
body {
  margin: 0;
  background: var(--desk);
  color: var(--desk-ink);
  font-family: var(--font-display);
  padding-inline: 16px;
  padding-block: 48px;
  display: grid;
  place-items: center;
  min-height: 100vh;
  box-sizing: border-box;
}
main {
  width: 100%;
  max-width: 30rem;
  display: grid;
  gap: 36px;
  justify-items: center;
  text-align: center;
}
main.dizzy { animation: dizzy 900ms ease-in-out; }
@keyframes dizzy {
  0%, 100% { transform: none; }
  20% { transform: rotate(-2deg) skewX(3deg); }
  40% { transform: rotate(2deg) skewX(-3deg); }
  60% { transform: rotate(-1.2deg) skewX(2deg); }
  80% { transform: rotate(0.8deg) skewX(-1deg); }
}
a, button, label { cursor: pointer; }
input, textarea { cursor: text; }

/* ---------- The name tag ---------- */
.tag {
  --tx: 0px; --ty: 0px; --rot: -2.5deg;
  position: relative;
  width: 100%;
  background: var(--tag-red);
  border-radius: 18px;
  box-shadow: 0 1px 0 var(--shadow), 0 18px 40px -12px var(--shadow);
  transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
  overflow: hidden;
  transition: transform 300ms cubic-bezier(.2,.8,.2,1), box-shadow 200ms ease;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
@media (hover: hover) {
  .tag { cursor: grab; }
  .tag:not(.moved):hover { --rot: 0deg; }
}
.tag.moved { z-index: 10; }
.tag.dragging {
  transition: box-shadow 200ms ease;
  cursor: grabbing;
  z-index: 20;
  box-shadow: 0 1px 0 var(--shadow), 0 34px 60px -18px var(--shadow);
}
.tag-head {
  color: var(--tag-white);
  padding-block: 18px 12px;
  padding-inline: 16px;
  display: grid;
  gap: 2px;
}
.hello {
  font-weight: 800;
  font-size: clamp(2.6rem, 11vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mni {
  font-weight: 400;
  font-size: clamp(1rem, 4.5vw, 1.25rem);
  letter-spacing: 0.02em;
}
.tag-body {
  background: var(--tag-white);
  padding-block: 28px 30px;
  padding-inline: 16px;
}
.name {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 400;
  color: var(--marker);
  font-size: clamp(2.6rem, 12vw, 4rem);
  line-height: 1.05;
  transform: rotate(-3deg);
  text-wrap: balance;
  cursor: pointer;
}
.name .w { display: inline-block; white-space: nowrap; }
.name .ch { display: inline-block; opacity: 0; animation: ink 160ms ease-out forwards; animation-delay: var(--d); }
@keyframes ink {
  from { opacity: 0; transform: translateY(5px) scale(0.55) rotate(-10deg); }
  to { opacity: 1; transform: none; }
}
.tag-domain {
  margin: 10px 0 0;
  font-family: var(--font-hand);
  font-size: clamp(1rem, 4.4vw, 1.25rem);
  color: var(--tag-sub);
  transform: rotate(-2deg);
}
.tag-foot { height: 22px; }

/* Peeling corner: the bottom-right corner lifts to show the sticker's backing. */
.peel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  background: linear-gradient(315deg, var(--desk) 0 48%, rgba(0,0,0,0.22) 50%, var(--peel-back) 53%, #ffffff 100%);
  border-top-left-radius: 6px;
  box-shadow: -2px -2px 6px -2px rgba(0,0,0,0.25);
  transition: width 220ms cubic-bezier(.2,.8,.2,1), height 220ms cubic-bezier(.2,.8,.2,1);
  touch-action: none;
  cursor: grab;
}
.tag:hover .peel, .tag.dragging .peel { width: 52px; height: 52px; }

/* ---------- Note and buttons ---------- */
.note {
  margin: 0;
  max-width: 34ch;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--desk-ink);
  text-wrap: balance;
}
.wave {
  display: inline-block;
  transform-origin: 70% 80%;
  animation: wave 2.4s ease-in-out 0.4s 2;
}
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(16deg); }
  20%, 40% { transform: rotate(-8deg); }
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 999px;
  padding-block: 12px;
  padding-inline: 22px;
  border: 2px solid transparent;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -8px var(--shadow); }
.btn:focus-visible, .photo:focus-visible, .name:focus-visible { outline: 3px solid var(--tag-red); outline-offset: 4px; }
.btn-primary { background: var(--link-bg); color: var(--link-fg); }
.btn-ghost { background: transparent; color: var(--desk-ink); border-color: var(--muted); }
.btn-red { background: var(--tag-red); color: #ffffff; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 1.2em;
  margin: 0;
}

/* ---------- Yellow note card (Arun's page) ---------- */
.ticket {
  --paper: #fff7c2;
  --paper-ink: #2b2410;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 6px;
  padding-block: 20px 24px;
  padding-inline: 20px;
  display: grid;
  gap: 14px;
  transform: rotate(1.5deg);
  box-shadow: 0 1px 0 var(--shadow), 0 16px 34px -14px var(--shadow);
  font-family: var(--font-mono);
}
.ticket::before {
  content: "";
  position: absolute;
  top: -10px; left: 50%;
  width: 64px; height: 20px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.ticket-head { border-bottom: 2px solid var(--paper-ink); padding-bottom: 8px; }
.ticket-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ticket a {
  color: inherit;
  text-decoration-color: var(--tag-red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.ticket-text { margin: 0; font-size: 0.98rem; line-height: 1.6; }
.ticket .hand { font-family: var(--font-hand); font-size: 1.15rem; letter-spacing: 0.01em; }
.stamp {
  justify-self: center;
  margin-top: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.3rem, 6vw, 1.8rem);
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tag-red);
  border: 4px solid var(--tag-red);
  border-radius: 10px;
  padding-block: 8px;
  padding-inline: 16px;
  transform: rotate(-7deg);
  mix-blend-mode: multiply;
  opacity: 0.88;
  animation: thunk 500ms cubic-bezier(.2,1.6,.4,1) 900ms both;
}
@keyframes thunk {
  from { transform: rotate(-7deg) scale(1.8); opacity: 0; }
  to { transform: rotate(-7deg) scale(1); opacity: 0.88; }
}

/* ---------- Spinning photo, doodle and crown ---------- */
.photo-wrap { position: relative; display: grid; justify-items: center; gap: 10px; margin-bottom: -6px; }
.photo-wrap.flying { z-index: 30; }
.photo {
  width: 172px;
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: 50%;
  padding: 0;
  border: 6px solid var(--tag-white);
  box-shadow: 0 0 0 4px var(--tag-red), 0 18px 36px -14px var(--shadow);
  overflow: hidden;
  background: var(--tag-white);
  will-change: transform;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.photo-hint {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--muted);
  min-height: 1.4em;
}
.doodle {
  position: absolute;
  top: 18px;
  left: calc(50% + 98px);
  width: 112px;
  color: var(--desk-ink);
  pointer-events: none;
  text-align: left;
}
.doodle-text {
  display: block;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  line-height: 1;
  transform: rotate(8deg);
  margin-left: 18px;
  white-space: nowrap;
}
.doodle svg { display: block; width: 74px; height: 56px; margin-top: 2px; overflow: visible; }
.doodle path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.crown {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 64px;
  height: 44px;
  transform: translateX(-50%) rotate(-8deg);
  pointer-events: none;
  z-index: 2;
  animation: crown-bob 2.8s ease-in-out infinite;
}
.crown path { stroke: var(--marker); stroke-width: 2.5; stroke-linejoin: round; }
@keyframes crown-bob {
  0%, 100% { transform: translateX(-50%) rotate(-8deg) translateY(0); }
  50% { transform: translateX(-50%) rotate(-4deg) translateY(-4px); }
}
@media (max-width: 440px) {
  .doodle { left: calc(50% + 90px); width: 74px; top: 10px; }
  .doodle-text { font-size: 0.95rem; margin-left: 4px; }
  .doodle svg { width: 52px; height: 44px; }
}
@media (max-width: 350px) { .doodle { display: none; } }

/* ---------- Click doodles and flying stickers ---------- */
.mark {
  position: fixed;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  pointer-events: none;
  z-index: 40;
  transform: rotate(var(--r));
  transition: opacity 600ms ease;
}
.mark path { fill: none; stroke: var(--c); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round;
             stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 520ms ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.mini-tag {
  position: fixed;
  z-index: 50;
  width: 50px;
  pointer-events: none;
  border-radius: 6px;
  background: var(--tag-red);
  color: #ffffff;
  font: 800 9px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-align: center;
  padding-top: 4px;
  box-shadow: 0 6px 12px -6px rgba(0,0,0,0.4);
}
.mini-tag::after { content: ""; display: block; height: 14px; margin-top: 4px; margin-bottom: 4px; background: #ffffff; }

/* ---------- Hidden extra: type "hello" and labels become name tags ---------- */
body.tagified [data-tagify] {
  position: relative;
  display: inline-block;
  background: #ffffff;
  color: var(--marker);
  font-family: var(--font-hand);
  padding: 22px 12px 8px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--tag-red), 0 10px 20px -10px var(--shadow);
  transform: rotate(-2deg);
  animation: pop 320ms cubic-bezier(.2,1.6,.4,1);
}
body.tagified [data-tagify]::before {
  content: "HELLO my name is";
  position: absolute;
  top: 0; left: 0; right: 0;
  background: var(--tag-red);
  color: #ffffff;
  font: 800 9px/1 var(--font-display);
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-radius: 8px 8px 0 0;
  text-transform: none;
}
@keyframes pop { from { transform: scale(0.7) rotate(-8deg); } to { transform: rotate(-2deg); } }

/* ---------- Sticker wall ---------- */
.wall-section { width: 100%; display: grid; gap: 18px; justify-items: center; margin-top: 12px; }
.wall-title { margin: 0; font-weight: 800; font-size: 1.6rem; line-height: 1.15; text-wrap: balance; }
.wall-sub { margin: -8px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.5; max-width: 34ch; }
.blank-tag {
  width: min(100%, 20rem);
  background: var(--tag-red);
  border-radius: 14px;
  overflow: hidden;
  transform: rotate(1.5deg);
  box-shadow: 0 14px 30px -14px var(--shadow);
}
.blank-tag .bt-head { color: #ffffff; padding-block: 10px 6px; display: grid; }
.blank-tag .bt-hello { font-weight: 800; font-size: 1.8rem; line-height: 1; letter-spacing: 0.04em; }
.blank-tag .bt-mni { font-size: 0.9rem; }
.blank-tag .bt-body { background: var(--tag-white); padding-block: 14px 16px; padding-inline: 14px; }
.blank-tag input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 2px dashed #c4ccd6;
  background: transparent;
  font-family: var(--font-hand);
  font-size: 1.7rem;
  color: var(--marker);
  text-align: center;
  padding-block: 4px;
  outline: none;
}
.blank-tag input::placeholder { color: #a7b0bc; }
.blank-tag input:focus { border-bottom-color: var(--tag-red); }
.blank-tag .bt-foot { height: 12px; }
.turnstile-slot:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sticker-form { display: grid; gap: 14px; justify-items: center; width: 100%; }
.sticker-status { margin: 0; min-height: 1.4em; font-family: var(--font-hand); font-size: 1.1rem; }
.sticker-status.error { color: var(--tag-red); }
.wall {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.wall-tag {
  width: 128px;
  background: var(--tag-red);
  border-radius: 9px;
  overflow: hidden;
  transform: rotate(var(--tilt));
  box-shadow: 0 8px 16px -10px var(--shadow);
}
.wall-tag.new { animation: stick 420ms cubic-bezier(.2,1.6,.4,1); }
@keyframes stick {
  from { transform: rotate(calc(var(--tilt) - 20deg)) scale(1.6); opacity: 0; }
  to { transform: rotate(var(--tilt)) scale(1); opacity: 1; }
}
.wall-tag .wt-head { color: #ffffff; font: 800 0.72rem/1 var(--font-display); letter-spacing: 0.08em; padding-block: 6px 4px; }
.wall-tag .wt-name {
  background: var(--tag-white);
  color: var(--marker);
  font-family: var(--font-hand);
  font-size: 1.05rem;
  line-height: 1.15;
  padding-block: 8px;
  padding-inline: 6px;
  overflow-wrap: anywhere;
  margin-bottom: 8px;
}
.wall-empty { margin: 0; color: var(--muted); font-family: var(--font-hand); font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  .wave, .stamp, .crown, .wall-tag.new, main.dizzy, body.tagified [data-tagify] { animation: none; }
  .name .ch { animation: none; opacity: 1; }
  .mark path { animation: none; stroke-dashoffset: 0; }
  .tag, .btn, .peel { transition: none; }
}
