/* Yeonjo's handwriting (letters + basic punctuation). Digits, hyphen, () etc. fall back to Gaegu glyph by glyph. */
@font-face { font-family: 'Hand'; src: url('assets/fonts/hand.woff2') format('woff2'), url('assets/fonts/hand.ttf') format('truetype'); font-display: swap; }

:root {
  --ink: #2A2320;
  --ink-soft: #6E625A;
  --paper: #FAF6EE;
  --line: 2px solid var(--ink);
  --wobble: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-2: 18px 225px 15px 255px / 255px 15px 225px 18px;
  --font: 'Hand', 'Gaegu', 'Comic Sans MS', cursive;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  /* faint warm tint over paper.jpg so the sheet reads slightly cream */
  background: linear-gradient(rgba(246, 232, 208, .28), rgba(246, 232, 208, .28)), url('assets/paper.jpg') repeat, var(--paper);
  background-size: auto, 512px 512px, auto;
  color: var(--ink);
  font-family: var(--font);
  font-size: 22px;
  font-synthesis: none; /* the hand has one weight; never fake-bold it */
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--ink); }
button { font-family: inherit; color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* hand-drawn controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; padding: 0 34px; font-size: 28px; font-weight: 700;
  background: transparent; border: var(--line); border-radius: var(--wobble);
  text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: rgba(237, 201, 163, .35); transform: rotate(-.6deg); }
.btn:focus-visible, .link:focus-visible, .icon-btn:focus-visible, .swatch:focus-visible, .chip:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.link { background: none; border: 0; padding: 6px 2px; font-size: 22px; text-decoration: underline; text-underline-offset: 5px; cursor: pointer; min-height: 44px; }
.icon-btn { width: 56px; height: 56px; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.icon-btn:hover { background: rgba(237, 201, 163, .35); }
.icon-btn svg { width: 30px; height: 30px; }
.chip { font-size: 19px; padding: 6px 16px; border: 1.6px solid var(--ink); border-radius: var(--wobble); background: transparent; cursor: pointer; }
.chip[aria-pressed="true"] { background: rgba(237, 201, 163, .55); }
.muted { color: var(--ink-soft); }

/* screens */
.screen { position: fixed; inset: 0; display: none; }
.screen.is-on { display: block; animation: fade .45s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.topbar { position: absolute; left: 48px; right: 48px; top: 32px; display: flex; justify-content: space-between; align-items: center; z-index: 5; }
.brand { font-size: 22px; color: var(--ink-soft); text-decoration: none; }

/* orbs */
.orb { position: relative; display: inline-block; border-radius: 50%; flex: none; }
.orb__body { position: absolute; inset: 0; border-radius: 50%; background: var(--orb-color); opacity: var(--orb-alpha); }
.orb--pearl .orb__body { box-shadow: inset 0 0 0 1px rgba(110, 98, 90, .25); }
/* texture.png / gloss.png are 256px with the orb circle at radius 112 → scale by 256/224 so it meets the orb edge */
.orb__tex, .orb__gloss { position: absolute; inset: -7.14%; background-position: center; background-size: 100% 100%; pointer-events: none; }
.orb__tex { background-image: url('assets/orb/texture.png'); mix-blend-mode: multiply; opacity: .55; clip-path: circle(43.75% at 50% 50%); }
.orb--matte .orb__tex { opacity: .8; }
.orb__gloss { background-image: url('assets/orb/gloss.png'); opacity: .85; }

/* entry */
#entry .entry-copy { position: absolute; left: 8vw; top: 13vh; display: flex; flex-direction: column; gap: 34px; z-index: 3; }
#entry h1 { margin: 0; font-size: clamp(64px, 6.4vw, 112px); line-height: 1.02; font-weight: 700; }
#entry .entry-sub { margin: 0; font-size: 28px; line-height: 1.35; color: var(--ink-soft); max-width: 540px; }
#entry .entry-actions { position: absolute; right: 9vw; bottom: 22vh; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; z-index: 4; }
.ambient { position: absolute; inset: 0; pointer-events: none; }
.ambient .orb { position: absolute; animation: drift var(--d, 9s) ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(var(--dx, 6px), var(--dy, -10px)); } }
.ground { position: absolute; left: 0; right: 0; bottom: 6vh; height: 200px; pointer-events: none; }
.fp { position: absolute; width: 76px; height: 38px; background-size: contain; background-repeat: no-repeat; animation: fpfade 9s ease forwards; }
@keyframes fpfade { 0% { opacity: 0; } 8% { opacity: .9; } 100% { opacity: 0; } }
.courier { position: absolute; bottom: -8px; height: 210px; left: -200px; }
.courier img { height: 100%; display: block; }
@media (prefers-reduced-motion: reduce) {
  .ambient .orb { animation: none; }
}

/* bundles carousel */
#bundles .stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.slide { display: flex; flex-direction: column; align-items: center; gap: 8px; transition: transform .35s ease, opacity .35s ease; }
.slide.out-l { transform: translateX(-60px); opacity: 0; }
.slide.out-r { transform: translateX(60px); opacity: 0; }
.bundle-btn { position: relative; width: min(46vh, 460px); height: min(46vh, 460px); border: 0; background: transparent; cursor: pointer; padding: 0; }
.bundle-btn .wash { position: absolute; left: 14%; right: 14%; bottom: 7%; height: 18%; border-radius: 50% 46% 52% 48% / 60% 56% 44% 40%; background: var(--cloth); filter: blur(14px); opacity: .85; }
.bundle-btn img { position: relative; width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.bundle-btn:hover img { transform: translateY(-6px) rotate(-1deg); }
.slide h2 { margin: 10px 0 0; font-size: 52px; }
.slide p { margin: 0; }
.nav-side { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; }
.nav-side.l { left: 6vw; } .nav-side.r { right: 6vw; }
.dots { position: absolute; bottom: calc(3.5vh + 48px); left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1.6px solid var(--ink); }
.dot.on { background: var(--ink); }
.hint { position: absolute; bottom: 3.5vh; left: 0; right: 0; text-align: center; font-size: 19px; color: var(--ink-soft); }

/* open bundle */
#open .cloth-wrap { position: absolute; left: 6vw; top: 12vh; width: min(58vw, 980px); height: 78vh; }
#open .cloth-wash { position: absolute; left: 12%; right: 12%; top: 16%; bottom: 14%; border-radius: 46% 54% 50% 48% / 52% 46% 54% 48%; background: var(--cloth); filter: blur(28px); opacity: .7; }
#open .cloth-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
#open .orbs { position: absolute; inset: 0; }
#open .orbs .orb { position: absolute; cursor: pointer; transition: transform .2s ease; border: 0; padding: 0; background: transparent; }
#open .orbs .orb:hover, #open .orbs .orb:focus-visible { transform: scale(1.12); }
#open .orbs .orb.dim { opacity: .18; }
#open .side { position: absolute; right: 6vw; top: 16vh; width: min(28vw, 420px); display: flex; flex-direction: column; gap: 14px; }
#open .side h2 { margin: 0; font-size: 56px; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.peek { position: absolute; z-index: 6; max-width: 280px; padding: 12px 16px; font-size: 19px; background: var(--paper); border: 1.6px solid var(--ink); border-radius: var(--wobble-2); pointer-events: none; box-shadow: 0 6px 0 rgba(42, 35, 32, .06); }
.empty { font-size: 24px; color: var(--ink-soft); }

/* proof modal */
.modal { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(250, 246, 238, .72); backdrop-filter: blur(3px); }
.modal.is-on { display: flex; animation: fade .3s ease; }
.card { position: relative; width: min(680px, 90vw); max-height: 90vh; overflow: auto; padding: 48px 56px 40px; background: var(--paper) url('assets/paper.jpg'); background-size: 512px; border: var(--line); border-radius: var(--wobble-2); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.card .close { position: absolute; right: 14px; top: 14px; }
.card .no { margin: 8px 0 0; font-size: 20px; color: var(--ink-soft); }
.card .body { margin: 0; font-size: 34px; line-height: 1.2; overflow-wrap: anywhere; }
.card .meta { margin: 0; font-size: 21px; color: var(--ink-soft); }
.card .row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 30; padding: 10px 22px; font-size: 20px; background: var(--paper); border: 1.6px solid var(--ink); border-radius: var(--wobble); display: none; }
.toast.is-on { display: block; animation: fade .2s ease; }

/* add */
#add .wrap { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6vw; align-items: center; padding: 11vh 9vw 8vh; }
.preview { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.preview .orb { width: min(30vh, 260px); height: min(30vh, 260px); }
.preview h2 { margin: 0; font-size: 40px; text-align: center; }
.palette { display: grid; grid-template-columns: repeat(5, 52px); gap: 14px; }
.swatch { width: 52px; height: 52px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgba(110, 98, 90, .2); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.finish { display: flex; gap: 12px; }
.finish .chip { min-width: 120px; min-height: 48px; font-size: 22px; }
.clear { width: min(360px, 100%); display: flex; flex-direction: column; gap: 4px; }
.clear label { font-size: 19px; color: var(--ink-soft); display: flex; justify-content: space-between; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.form { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.form label.big { font-size: 42px; font-weight: 700; line-height: 1.05; }
.form .lead { margin: -2px 0 6px; font-size: 22px; color: var(--ink-soft); }
.form textarea, .form input[type=text] { font-family: inherit; font-size: 26px; color: var(--ink); background: rgba(255, 255, 255, .25); }
.form textarea { min-height: 190px; padding: 14px 18px; resize: none; border: var(--line); border-radius: var(--wobble-2); }
.form input[type=text] { padding: 8px 4px; border: 0; border-bottom: var(--line); }
.form textarea:focus, .form input:focus { outline: none; background: rgba(255, 255, 255, .55); }
.count { align-self: flex-end; font-size: 18px; color: var(--ink-soft); }
.err { font-size: 19px; color: #A3402A; min-height: 24px; margin: 0; }
.note { font-size: 19px; color: var(--ink-soft); margin: 4px 0 8px; }
.hp { position: absolute; left: -9999px; }

/* sent */
#sent .scene { position: absolute; left: 0; right: 0; bottom: 8vh; height: 46vh; }
#sent .scene .pick { position: absolute; left: 50%; bottom: 0; height: 100%; aspect-ratio: 540 / 720; transform: translateX(-50%); }
#sent .scene .courier-still { display: block; width: 100%; height: 100%; }
/* pick.png: fingertips at about (92%, 82%), ground at 89% → orb sits on the ground just past the hand */
#sent .scene .pick .orb { position: absolute; left: 88%; bottom: 11%; }
#sent .msg { position: absolute; left: 0; right: 0; top: 14vh; text-align: center; }
#sent .msg h1 { margin: 0; font-size: 72px; }
#sent .msg p { margin: 8px 0 0; font-size: 28px; }
#sent .msg .proof-line { margin-top: 22px; font-size: 26px; color: var(--ink-soft); }
#sent .actions { position: absolute; right: 9vw; bottom: 12vh; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

/* small screens: still usable, not designed for */
@media (max-width: 860px) {
  body { overflow: auto; }
  #add .wrap { position: static; grid-template-columns: 1fr; padding: 90px 24px 40px; }
  #add.is-on { position: relative; display: block; }
  #open .cloth-wrap { left: 4vw; width: 92vw; height: 56vh; top: 10vh; }
  #open .side { left: 6vw; right: 6vw; width: auto; top: auto; bottom: 4vh; }
  #entry .entry-actions { left: 8vw; right: 8vw; align-items: stretch; }
}
