/*
  To use Maison Neue (licensed), drop the webfont files in assets/fonts and uncomment:

  @font-face {
    font-family: "Maison Neue";
    src: url("assets/fonts/MaisonNeue-Book.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
  }
  @font-face {
    font-family: "Maison Neue";
    src: url("assets/fonts/MaisonNeue-Demi.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
  }
*/

:root {
  --blue: #004dff;
  --black: #000;
  --white: #fff;
  --border: 3px solid var(--blue);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--white);
  color: var(--blue);
  /* "Maison Neue" is used if it's installed / self-hosted (see @font-face note below);
     DM Sans is the free stand-in */
  font-family: "Maison Neue", "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

/* ---------- header ---------- */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "logo nav actions";
  align-items: center;
  gap: 24px;
  padding: 20px clamp(16px, 5vw, 64px);
}

/* "under construction" strip across the top (remove at launch) */
.construction {
  margin: 0;
  padding: 9px 16px 10px;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
  color: var(--white);
  background: var(--blue);
}

.construction a {
  font-weight: 600;
  color: inherit;
  text-underline-offset: 2px;
}

.construction-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 9px 2px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--white);
  border-radius: 999px;
}

.logo { grid-area: logo; justify-self: start; }

.logo img {
  display: block;
  width: clamp(90px, 10vw, 128px);
  height: auto;
}

.nav {
  grid-area: nav;
  display: flex;
  gap: clamp(12px, 2vw, 22px);
  padding-top: 28px; /* headroom for the critters */
}

/* wrapper: creates a stacking context so the critter can sit behind the button */
.nav-link {
  position: relative;
  isolation: isolate;
  display: block;
  text-decoration: none;
  outline: none;
}

/* the button itself */
.label {
  position: relative;
  z-index: 1;
  display: block;
  padding: 10px 22px 11px;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--blue);
  background: var(--white);
  border: var(--border);
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s, color 0.15s;
}

.nav-link:hover .label,
.nav-link:focus-visible .label {
  transform: translate(-1px, -1px);
}

.nav-link:active .label {
  transform: translate(2px, 2px);
}

/* the character: tucked fully behind the button until hover */
.critter {
  --x: 4px;          /* how far in from the side */
  --tilt: -14deg;    /* lean away from the button */
  --rise: -32px;     /* how far it climbs out (override per character with style="--rise: …") */
  position: absolute;
  z-index: 0;
  bottom: 3px;
  left: var(--x);
  width: 46px;
  pointer-events: none;
  transform-origin: 50% 100%;
  transform: translateY(0) rotate(0deg);
  transition: transform 0.45s cubic-bezier(0.34, 1.7, 0.6, 1);
}

.nav-link[data-side="right"] .critter {
  left: auto;
  right: var(--x);
  --tilt: 14deg;
}

.critter img {
  display: block;
  width: 100%;
  height: auto;
}

.nav-link:hover .critter,
.nav-link:focus-visible .critter {
  transform: translateY(var(--rise)) rotate(var(--tilt));
}

/* right side of the header */
.header-actions {
  grid-area: actions;
  justify-self: end;
  display: flex;
  gap: 10px;
  padding-top: 28px; /* line up with the nav buttons */
}

.icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--white);
  border: var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover { transform: translate(-1px, -1px); }
.icon-btn:active { transform: translate(2px, 2px); }

.bag-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white);
  background: var(--blue);
  border: 2px solid var(--white);
  border-radius: 999px;
}

/* ---------- carousel ---------- */
main { flex: 1; }

.carousel {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
  padding: clamp(24px, 5vw, 56px) clamp(16px, 3vw, 40px);
}

.track {
  flex: 1;
  display: flex;
  gap: clamp(16px, 2.5vw, 32px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 8px 12px 4px; /* room for the hover lift */
  scrollbar-width: none;
}

.track::-webkit-scrollbar { display: none; }

.card {
  flex: 0 0 calc((100% - 3 * clamp(16px, 2.5vw, 32px)) / 4);
  scroll-snap-align: start;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translate(-2px, -2px) rotate(-1deg);
}

.photo {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  background:
    radial-gradient(circle at 30% 30%, rgba(0, 77, 255, 0.12), transparent 60%),
    #eef3ff;
  border-bottom: var(--border);
}

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

.card-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 12px 16px;
}

.card-info h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.card-info p { margin: 0; font-weight: 500; }

.arrow {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--white);
  border: var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s;
}

.arrow svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.arrow:hover { transform: translate(-1px, -1px); }
.arrow:active { transform: translate(2px, 2px); }
.arrow:disabled { opacity: 0.35; cursor: default; transform: none; }

/* ---------- intro text ---------- */
.intro {
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(8px, 2vw, 24px) 16px clamp(40px, 6vw, 72px);
  text-align: center;
}

.intro h2 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.intro p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---------- footer ---------- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 16px 32px;
}

.footer-logo { width: 140px; height: auto; }

.site-footer p { margin: 0; font-size: 0.95rem; }

.site-footer .credit { font-size: 0.8rem; opacity: 0.75; }
.site-footer .credit a { text-underline-offset: 2px; }
.site-footer .credit a:hover { opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .card { flex-basis: calc((100% - clamp(16px, 2.5vw, 32px)) / 2); }
}

@media (max-width: 560px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas: "logo actions" "nav nav";
    gap: 8px 16px;
  }
  .header-actions { padding-top: 0; }
  .nav { justify-content: center; }
}

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

/* sticker placeholders until the real product photos arrive */
.photo.placeholder img {
  object-fit: contain;
  padding: 18% 26% 32%;
  transition: transform 0.3s cubic-bezier(0.34, 1.7, 0.6, 1);
}

.card:hover .photo.placeholder img { transform: rotate(-8deg) scale(1.06); }

/* "photo coming soon" banner — only on placeholders, disappears with real photos */
.photo { position: relative; overflow: hidden; }

.photo.placeholder::after {
  content: "photo coming soon";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 10%;
  padding: 6px 0 7px;
  text-align: center;
  font-size: clamp(0.7rem, 1.1vw, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--blue);
  border-block: 3px solid var(--blue);
  transform: rotate(-6deg);
  pointer-events: none;
}

/* ---------- views (single-page routing) ---------- */
.view:not([hidden]) { animation: view-in 0.35s ease both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h2:focus { outline: none; }

/* current page in the nav */
.nav-link[aria-current="page"] .label {
  background: var(--blue);
  color: var(--white);
}

/* ---------- about ---------- */
.about {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 64px) 16px clamp(40px, 6vw, 80px);
  display: grid;
  grid-template-columns: minmax(240px, 400px) 1fr;
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
}

.portrait {
  margin: 0;
  aspect-ratio: 1;
  border: var(--border);
  border-radius: 50%;
  overflow: hidden;
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

/* 珠珠畫室 running down beside the portrait */
.portrait-group {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 24px);
  width: 100%;
}

.portrait-group .portrait { flex: 1; min-width: 0; }

.chars {
  position: relative;
  flex: none;
  display: block;
  cursor: help;
  outline: none;
}

.chars-vertical {
  display: block;
  width: clamp(28px, 3.6vw, 40px);
  height: auto;
}

.about-text h2 {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.about-text p {
  margin: 0 0 12px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.about-text a:not(.pill-btn) {
  font-weight: 600;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* outlined pill link (about + contact) */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 20px 11px;
  font-weight: 600;
  text-decoration: none;
  color: var(--blue);
  background: var(--white);
  border: var(--border);
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s, color 0.15s;
}

.pill-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill-btn:hover { background: var(--blue); color: var(--white); transform: translateY(-1px); }

/* ---------- contact: text with characters drifting around it ---------- */
.contact {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(480px, 72vh, 660px);
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
}

.contact-inner {
  position: relative;
  z-index: 1;
  max-width: min(460px, calc(100% - 120px));
  padding: 0;
}

.orbit { position: absolute; inset: 0; pointer-events: none; }

.orbit img {
  position: absolute;
  top: 0;
  left: 0;
  width: 56px;
  height: auto;
  will-change: transform;
}

@media (max-width: 720px) {
  .about { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .portrait-group { width: min(330px, 88vw); }
  
}

/* little toast that explains the characters on hover / tap */
.chars-tip {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: calc(100% + 10px);
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: max-content;
  padding: 9px 14px 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: left;
  color: var(--white);
  background: var(--blue);
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translate(6px, -50%);
  transition: opacity 0.15s ease, transform 0.2s ease;
}

.chars-tip [lang] { font-weight: 700; font-size: 1rem; }

/* little pointer on the right edge, toward the characters */
.chars-tip::before {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  width: 10px;
  height: 10px;
  background: var(--blue);
  transform: translateY(-50%) rotate(45deg);
}

.chars:hover .chars-tip,
.chars:focus-visible .chars-tip,
.chars:focus .chars-tip {
  opacity: 1;
  transform: translate(0, -50%);
}

/* not enough room on the left (narrow screens): sit above the characters instead */
.chars.tip-above .chars-tip {
  top: auto;
  right: auto;
  bottom: calc(100% + 10px);
  left: 50%;
  text-align: center;
  align-items: center;
  transform: translate(-50%, 6px);
}

.chars.tip-above .chars-tip::before {
  top: auto;
  right: auto;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.chars.tip-above:hover .chars-tip,
.chars.tip-above:focus .chars-tip,
.chars.tip-above:focus-visible .chars-tip { transform: translate(-50%, 0); }

/* home: intro text sits above the cards */
.view[data-view="/"] .intro {
  padding-top: clamp(24px, 5vw, 56px);
  padding-bottom: 0;
}

.view[data-view="/"] .carousel {
  padding-bottom: clamp(16px, 3vw, 28px);
}

.see-all {
  text-align: center;
  padding: 0 16px clamp(48px, 7vw, 80px);
}

/* cards are links to their item page */
a.card {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* ---------- shop dropdown ---------- */
.nav-item { position: relative; }

.dropdown {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 50%;
  padding-top: 10px; /* invisible bridge so the menu stays open on the way down */
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 6px);
  transition: opacity 0.15s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.15s ease, transform 0.2s ease, visibility 0s;
}

/* keep the flower peeking while the menu is open */
.nav-item:hover .critter,
.nav-item:focus-within .critter {
  transform: translateY(var(--rise)) rotate(var(--tilt));
}

.dropdown-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  min-width: 200px;
  background: var(--white);
  border: var(--border);
  border-radius: 18px;
}

.dropdown-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 12px 9px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  outline: none;
}

.dropdown-list a:hover,
.dropdown-list a:focus-visible {
  background: var(--blue);
  color: var(--white);
}

.dropdown-list .count { font-size: 0.85em; font-weight: 500; opacity: 0.6; }

@media (hover: none) {
  .dropdown { display: none; } /* phones: "shop" goes to the shop page, which has the category filters */
}

/* ---------- shop page ---------- */
.shop {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 3vw, 40px) clamp(48px, 7vw, 88px);
}

.shop-head {
  text-align: center;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.shop-title {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.shop-blurb { margin: 0 0 20px; font-size: 1.05rem; line-height: 1.5; }

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.filter {
  padding: 7px 16px 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: var(--border);
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s, color 0.15s;
}

.filter:hover { transform: translateY(-1px); }
.filter[aria-current="page"] { background: var(--blue); color: var(--white); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
}

/* ---------- item page ---------- */
.item {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 3vw, 40px) clamp(48px, 7vw, 88px);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: clamp(16px, 3vw, 28px);
  font-size: 0.9rem;
}

.crumbs a { font-weight: 600; text-underline-offset: 3px; }
.crumbs [aria-current] { opacity: 0.7; }

.item-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}

.photo.item-photo {
  position: sticky;
  top: 24px;
  border: var(--border);
  border-radius: var(--radius);
}

.photo.item-photo.placeholder::after { font-size: clamp(0.8rem, 1.4vw, 1.05rem); padding: 8px 0 9px; }

.item-info h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.item-price { margin: 6px 0 16px; font-size: 1.35rem; font-weight: 600; }
.item-desc { margin: 0 0 22px; font-size: 1.05rem; line-height: 1.6; }

.option { margin: 0 0 16px; padding: 0; border: 0; }

.option legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.choices { display: flex; flex-wrap: wrap; gap: 8px; }

.choice input { position: absolute; opacity: 0; pointer-events: none; }

.choice span {
  display: inline-block;
  padding: 7px 14px 8px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 2px solid var(--blue);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.choice span small { font-size: 0.8em; opacity: 0.75; }
.choice span:hover { background: rgba(0, 77, 255, 0.08); }
.choice input:checked + span { background: var(--blue); color: var(--white); }
.choice input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

button.pill-btn { font: inherit; font-weight: 600; cursor: pointer; }
.pill-btn.solid { background: var(--blue); color: var(--white); }
.pill-btn.solid:hover { background: var(--white); color: var(--blue); }
.add-btn { margin-top: 6px; padding: 12px 30px 13px; font-size: 1.05rem; }

.item-details { margin: 32px 0 0; }

.item-details > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1.5px solid rgba(0, 77, 255, 0.18);
}

.item-details dt { font-weight: 600; }
.item-details dd { margin: 0; line-height: 1.5; }
.item-details ul { margin: 0; padding-left: 18px; }

.related { margin-top: clamp(48px, 7vw, 88px); }

.related h3 {
  margin: 0 0 18px;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 700;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  padding: 12px 22px 13px;
  font-weight: 600;
  text-align: center;
  color: var(--white);
  background: var(--blue);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.notfound { padding-top: clamp(56px, 10vw, 120px); padding-bottom: clamp(64px, 12vw, 140px); }

@media (max-width: 720px) {
  .item-layout { grid-template-columns: 1fr; }
  .photo.item-photo { position: relative; top: auto; } /* relative (not static) keeps the banner inside the photo */
}

/* ---------- phones: two full cards, swipe instead of arrows, smaller footer logo ---------- */
@media (max-width: 560px) {
  .carousel { padding-inline: 0; }
  .arrow { display: none; }
  .track {
    gap: 12px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }
  .card { flex-basis: calc((100% - 12px) / 2); }
  .card-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px 12px;
  }
  .card-info h3 { font-size: 0.95rem; }
  .card-info p { font-size: 0.9rem; }
  .photo.placeholder::after { font-size: 0.6rem; padding: 4px 0 5px; }
  .photo.item-photo.placeholder::after { font-size: 0.85rem; padding: 7px 0 8px; }
  .footer-logo { width: 92px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .item-details > div { grid-template-columns: 90px 1fr; }
}

/* SAMPLE: ?font=bricolage (see the script in index.html); the site uses DM Sans */
html[data-font] :is(h2, h3, .label, .pill-btn, .card-info p, .bag-count, .site-footer p),
html[data-font] .photo.placeholder::after {
  font-family: var(--display-font), "DM Sans", system-ui, sans-serif;
}
