/* Elijah's Gift Shop. One page, no build step.
   To restyle the whole shop, change the colours in :root. */

:root {
  --ground: #2A3DE8;       /* page background */
  --ground-deep: #1C299C;  /* ticker, footer, the "base" under tiles */
  --accent: #FFD23F;       /* Buy buttons, wordmark, gift box */
  --accent-deep: #C2A030;  /* the side of a pushed-up button */
  --box-side: #D9B336;
  --box-top: #FFE282;
  --ribbon: #FF5C8A;
  --ribbon-side: #D64D74;
  --ribbon-top: #FF80A4;
  --ink: #0B1238;
  --ink-soft: #474D75;
  --font-display: 'DynaPuff', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --font-text: 'Figtree', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--ground);
  background-image: radial-gradient(rgba(255, 255, 255, 0.13) 1.6px, rgba(255, 255, 255, 0) 2.2px);
  background-size: 24px 24px;
  color: #FFFFFF;
  font-family: var(--font-text);
}

button, a, input { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Buttons that look raised and push down when pressed */
.push { transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease; }
.push:active { transform: translateY(5px); box-shadow: 0 0 0 rgba(0, 0, 0, 0) !important; }
@media (hover: hover) { .push:hover { filter: brightness(1.05); } }

/* ---------- Ticker ---------- */

.ticker {
  overflow: hidden;
  padding: 9px 0;
  background: var(--ground-deep);
}
.ticker__track { display: flex; width: max-content; }
.ticker.is-running .ticker__track { animation: gs-ticker 36s linear infinite; }
.ticker__run {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-right: 22px;
  white-space: nowrap;
  font-size: 0.75rem;
  line-height: 16px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ticker__run i {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Hero and logo ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 16px 26px;
}

.giftbox {
  display: block;
  margin: 0;
  padding: 44px 40px 28px;
  border: 0;
  border-radius: 28px;
  background: transparent;
  cursor: pointer;
}
.giftbox:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }
.giftbox__stage { display: block; position: relative; width: 94px; height: 86px; }
.giftbox__shadow {
  display: block;
  position: absolute;
  left: -15px;
  top: 70px;
  width: 124px;
  height: 36px;
  border-radius: 50%;
  background: var(--ground-deep);
  animation: gs-shadow 3.2s ease-in-out infinite;
}
.giftbox__bob { display: block; position: relative; z-index: 1; animation: gs-bob 3.2s ease-in-out infinite; }
.giftbox__lens { display: block; width: 94px; height: 86px; perspective: 560px; }
.giftbox__tilt {
  display: block;
  position: relative;
  width: 94px;
  height: 86px;
  transform-style: preserve-3d;
  transform: rotateX(-24deg);
}
.giftbox__pop,
.giftbox__spin {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 94px;
  height: 86px;
  transform-style: preserve-3d;
}
.giftbox__spin { animation: gs-spin 11s linear infinite; }
.giftbox__pop.is-popping { animation: gs-pop 0.9s ease-in-out 1; }

.face { position: absolute; display: flex; justify-content: center; background: var(--accent); }
.face i { display: block; width: 18px; height: 100%; background: var(--ribbon); }
.face--body { left: 5px; top: 24px; width: 84px; height: 62px; --z: 42px; }
.face--lid { left: 0; top: 0; width: 94px; height: 26px; --z: 47px; box-shadow: inset 0 -3px 0 rgba(11, 18, 56, 0.16); }
.face--front { transform: translateZ(var(--z)); }
.face--back { transform: rotateY(180deg) translateZ(var(--z)); }
.face--right { transform: rotateY(90deg) translateZ(var(--z)); }
.face--left { transform: rotateY(-90deg) translateZ(var(--z)); }
.face--right, .face--left { background: var(--box-side); }
.face--right i, .face--left i { background: var(--ribbon-side); }

.giftbox__lid {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 94px;
  height: 26px;
  transform-style: preserve-3d;
  animation: gs-lid 5.5s ease-in-out infinite;
}
.lid-top {
  position: absolute;
  left: 0;
  top: -47px;
  width: 94px;
  height: 94px;
  background: var(--box-top);
  transform: rotateX(90deg);
}
.lid-top i { position: absolute; background: var(--ribbon-top); }
.lid-top i:first-child { left: 38px; top: 0; width: 18px; height: 94px; }
.lid-top i:last-child { left: 0; top: 38px; width: 94px; height: 18px; }

.bow {
  position: absolute;
  top: -24px;
  width: 26px;
  height: 24px;
  box-sizing: border-box;
  border: 7px solid var(--ribbon);
  border-radius: 50%;
}
.bow--l { left: 21px; transform-origin: 100% 100%; transform: rotate(-16deg); }
.bow--r { left: 47px; transform-origin: 0 100%; transform: rotate(16deg); }
.bow-cross {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 94px;
  height: 26px;
  transform-style: preserve-3d;
  transform: rotateY(90deg);
}
.bow-cross .bow { border-color: var(--ribbon-side); }

.wordmark {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  font-weight: 700;
}
.wordmark__name {
  display: flex;
  font-family: var(--font-display);
  font-size: min(60px, 16.5vw);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  text-shadow:
    0 1px 0 var(--accent-deep),
    0 2px 0 var(--accent-deep),
    0 3px 0 var(--accent-deep),
    0 4px 0 var(--accent-deep),
    0 5px 0 var(--accent-deep),
    0 6px 0 var(--accent-deep),
    0 7px 0 var(--accent-deep),
    0 13px 0 var(--ground-deep);
}
.wordmark__name span { display: inline-block; animation: gs-hop 5s ease-in-out infinite; }
.wordmark__name span:nth-child(2) { animation-delay: 0.08s; }
.wordmark__name span:nth-child(3) { animation-delay: 0.16s; }
.wordmark__name span:nth-child(4) { animation-delay: 0.24s; }
.wordmark__name span:nth-child(5) { animation-delay: 0.32s; }
.wordmark__name span:nth-child(6) { animation-delay: 0.4s; }
.wordmark__name span:nth-child(7) { animation-delay: 0.48s; }
.wordmark__name span:nth-child(8) { animation-delay: 0.56s; }
.wordmark__sub {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #FFFFFF;
  text-shadow: 0 3px 0 var(--ground-deep);
}

.tagline {
  margin: 18px 0 0;
  max-width: 31ch;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 600;
  text-wrap: pretty;
}

/* ---------- Search and sort ---------- */

.shop {
  box-sizing: border-box;
  width: 100%;
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 16px 44px;
  display: flex;
  flex-direction: column;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }

.search {
  flex: 1 1 160px;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 4px 0 15px;
  border-radius: 16px;
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ground-deep);
}
.search:focus-within { outline: 3px solid #FFFFFF; outline-offset: 3px; }
.search > svg { flex: 0 0 auto; }
.search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  border-radius: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 1rem; /* 16px or more stops iOS zooming in on focus */
  font-weight: 600;
  color: var(--ink);
}
.search__input::placeholder { color: #565C86; opacity: 1; }
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search__clear {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.search__clear:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.sort {
  flex: 0 0 auto;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 150px;
  height: 50px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ground-deep);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 800;
  cursor: pointer;
}
.sort svg { flex: 0 0 auto; }
.sort[data-sort="asc"],
.sort[data-sort="desc"] { background: var(--accent); box-shadow: 0 5px 0 var(--accent-deep); }
.sort:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }

.count {
  margin: 21px 2px 14px;
  font-size: 0.875rem;
  line-height: 1.3;
  font-weight: 700;
}

/* ---------- Product tiles ---------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* One per row on phones, two on tablets, three on desktop */
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 18px 12px;
}

.card {
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 12px;
  border-radius: 20px;
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 6px 0 var(--ground-deep);
}

.card__photo {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 13px;
  background: var(--tint, #D9ECFF);
  color: #3A4070;
}
.card__photo-label {
  font-size: 0.6875rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.card__photo img {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 8%;
  object-fit: contain;
  /* Lets a white studio background melt into the tile colour */
  mix-blend-mode: multiply;
}
.card__photo.is-cover img { padding: 0; object-fit: cover; mix-blend-mode: normal; }
.card__photo.is-whole img { padding: 0; mix-blend-mode: normal; }
.card__photo.has-image .card__photo-icon,
.card__photo.has-image .card__photo-label { display: none; }

.card__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}
.card__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 800;
  text-wrap: balance;
}
.card__desc {
  margin: 0;
  font-size: 0.84375rem;
  line-height: 1.4;
  font-weight: 500;
  color: var(--ink-soft);
}

.card__buy { display: flex; flex-direction: column; gap: 9px; padding: 0 2px 5px; }
.card__price {
  padding-left: 2px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 700;
}
.buy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--accent-deep);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
}
.buy:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- Empty search ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 16px 12px;
  text-align: center;
}
.empty__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 700;
  text-wrap: balance;
}
.empty__hint { margin: 0; max-width: 30ch; font-size: 0.9375rem; line-height: 1.45; font-weight: 600; }
.empty__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  margin: 0;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--accent-deep);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}
.empty__clear:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }

/* ---------- Footer ---------- */

.footer {
  margin-top: auto;
  padding: 22px 16px 38px;
  text-align: center;
  background: var(--ground-deep);
}
.footer p { margin: 0; font-size: 0.875rem; line-height: 1.45; font-weight: 700; }

/* ---------- Motion ---------- */

@keyframes gs-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes gs-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes gs-shadow { 0%, 100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(0.86); opacity: 0.42; } }
@keyframes gs-lid {
  0%, 60%, 100% { transform: translateY(0) rotateZ(0deg); }
  68% { transform: translateY(-16px) rotateZ(-7deg); }
  76% { transform: translateY(0) rotateZ(0deg); }
  82% { transform: translateY(-5px) rotateZ(3deg); }
  88% { transform: translateY(0) rotateZ(0deg); }
}
@keyframes gs-pop {
  0% { transform: translateY(0) rotateY(0deg) scale(1); }
  45% { transform: translateY(-30px) rotateY(200deg) scale(1.12); }
  100% { transform: translateY(0) rotateY(360deg) scale(1); }
}
@keyframes gs-hop { 0%, 11%, 100% { transform: translateY(0); } 5.5% { transform: translateY(-10px); } }
@keyframes gs-ticker { from { transform: translateX(0); } to { transform: translateX(-25%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
