/* ================================================================
   ÂN POTTERY
   No build step — this file is the whole design system.

   TYPOGRAPHY RULES (set once here, obeyed everywhere):
     - One body font, one body size, one colour. No exceptions in
       running text, nav, buttons, captions or footer.
     - Headings use the display font at ONE size site-wide.
     - Carousel card titles are the single exception: display font,
       smaller, but the same size in both carousels and on both
       faces of the card, in the same position.
     - Subheadings use the BODY font, one step larger than body.
   ================================================================ */

:root {
  --sage:        #c9d6b8;
  --sage-light:  #dbe3cf;
  --sage-deep:   #7f9469;
  --sage-shadow: #5d7049;
  --cream:       #f4f1ea;
  --white:       #ffffff;

  /* One ink colour for all text. The hero is the only place text sits
     on a photograph, so it stays white for legibility. */
  --ink: #000000;

  /* TODO: both faces are placeholders until An's menu card is matched.
     Swapping them is a one-line change each — nothing else references
     a font name directly. */
  --font-display: 'Caveat Brush', 'Bradley Hand', cursive;
  --font-body:    'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* The entire type scale. Four values, nothing else. */
  --fs-body: 15px;
  --fs-sub:  17px;
  --fs-head: clamp(42px, 6.5vw, 72px);
  --fs-card: clamp(21px, 2.1vw, 27px);
  /* Mobile bottom nav only: four items cannot fit across a 375px
     phone at body size. Deliberate fifth value, not an ad-hoc size. */
  --fs-nav:  11px;

  --track:   .14em;      /* one letter-spacing for all uppercase text */
  --nav-h:   64px;
  --navbar-h: 44px;      /* mobile: the nav becomes a bottom bar */
  --bar-h:   58px;       /* fixed social bar */
  --pad:     clamp(20px, 5vw, 64px);
  --ease:    cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html {
  /* Back to `mandatory` at the user's request — proximity felt worse.
     The white-screen-on-overscroll fix below is independent of this and
     stays either way. */
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  /* Stops an over-scroll at either end rubber-banding past the document
     and exposing unpainted canvas. */
  overscroll-behavior-y: none;
  background: var(--cream);   /* explicit, so overscroll never paints white */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

img { max-width: 100%; display: block; }
a   { color: inherit; }

.u-noscrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.u-noscrollbar::-webkit-scrollbar { display: none; }

/* ---------------------------------------------------------------
   Headings — one size everywhere
   --------------------------------------------------------------- */

.h-display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-head);
  line-height: 1;
  letter-spacing: 0;
  margin: 0;
  color: var(--ink);
}

/* Subheadings: body font, one step up from body. */
.h-sub {
  font-family: var(--font-body);
  font-size: var(--fs-sub);
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  margin: 6px 0 0;
  color: var(--ink);
}

/* ---------------------------------------------------------------
   Fixed nav
   --------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
  height: var(--nav-h);
  padding: 0 var(--pad);
  font-size: var(--fs-body);
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.nav__link {
  position: relative;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 0;
  background: none;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.nav__link::after {
  content: '';
  position: absolute;
  left: 0; bottom: 2px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}

.nav__link:hover::after,
.nav__link:focus-visible::after { transform: scaleX(1); }

/* White only where it sits over the hero photograph */
.nav.is-over-hero .nav__link { color: var(--white); }
.nav.is-over-hero { text-shadow: 0 1px 12px rgba(0,0,0,.45); }

/* ---------------------------------------------------------------
   Snap sections
   --------------------------------------------------------------- */

.section {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.section--cream { background: var(--cream); }
.section--sage  { background: var(--sage-light); }

.section__head { padding: 0 var(--pad); flex: 0 0 auto; }
.section__head .h-sub { margin-bottom: clamp(18px, 3vh, 34px); }

.section__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------------------------------------------------------------
   Hero — the one place text is not black, because it sits on a photo
   --------------------------------------------------------------- */

.hero { justify-content: space-between; background: var(--sage-shadow); }

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero__mark, .hero__actions { position: relative; z-index: 2; color: var(--white); }

.hero__mark {
  margin: auto auto 0;
  text-align: center;
  padding: var(--nav-h) var(--pad) 0;
}

.hero__name {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-head);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--white);
  text-shadow: 0 2px 24px rgba(0,0,0,.45);
}

.hero__dragonfly {
  width: clamp(72px, 12vw, 124px);
  margin: clamp(18px, 4vh, 40px) auto 0;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,.4));
}

.hero__tagline {
  margin: clamp(14px, 3vh, 28px) 0 0;
  font-size: var(--fs-sub);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--white);
}

.hero__actions {
  margin: auto auto 0;
  padding: 0 var(--pad) calc(var(--bar-h) + clamp(26px, 5vh, 64px));
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(10px, 2vw, 18px);
}

/* ---------------------------------------------------------------
   Buttons — body font and body size, like everything else
   --------------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  letter-spacing: var(--track);
  text-indent: var(--track);   /* re-centres against the trailing letter-space */
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .28s var(--ease), color .28s var(--ease);
}

.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--cream); }

/* On the hero the buttons sit on a photograph, so they invert */
.btn--onphoto {
  border-color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--white);
}

.btn--onphoto:hover, .btn--onphoto:focus-visible {
  background: var(--white);
  border-color: var(--white);
  color: var(--ink);
}

.btn--dark { background: var(--ink); color: var(--cream); }
.btn--dark:hover, .btn--dark:focus-visible { background: transparent; color: var(--ink); }

.btn--sm { padding: 9px 16px; }

/* ---------------------------------------------------------------
   Horizontal carousel
   --------------------------------------------------------------- */

.carousel { position: relative; }

.carousel__track {
  display: flex;
  gap: clamp(14px, 2.4vw, 28px);
  padding: 8px var(--pad) 24px;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x pinch-zoom;   /* let vertical swipes reach the page */
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  cursor: grab;
}

.carousel__track.is-dragging { cursor: grabbing; scroll-snap-type: none; }

.carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease), opacity .25s var(--ease);
}

.carousel__arrow:hover:not(:disabled) { background: var(--ink); color: var(--cream); }
.carousel__arrow:disabled { opacity: .22; cursor: default; }
.carousel__arrow--prev { left: calc(var(--pad) - 23px); }
.carousel__arrow--next { right: calc(var(--pad) - 23px); }
.carousel__arrow svg { width: 16px; height: 16px; }

@media (hover: none) { .carousel__arrow { display: none; } }

/* ---------------------------------------------------------------
   Flip cards
   The title uses the display font at --fs-card and sits at the SAME
   top offset on both faces, so flipping does not move it.
   --------------------------------------------------------------- */

.card {
  --card-pad: clamp(16px, 2vw, 22px);
  flex: 0 0 auto;
  width: clamp(210px, 58vw, 290px);
  aspect-ratio: 3 / 4;
  scroll-snap-align: center;
  perspective: 1200px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.card__inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .62s var(--ease);
}

.card.is-flipped .card__inner,
.card:focus-within .card__inner { transform: rotateY(180deg); }

@media (hover: hover) and (pointer: fine) {
  .carousel__track:not(.is-dragging) .card:hover .card__inner { transform: rotateY(180deg); }
  .card__hint { display: none; }
}

.card:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 3px;
  overflow: hidden;
  background: var(--sage-light);
}

.card__face--back {
  transform: rotateY(180deg);
  background: var(--cream);
  border: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  padding: var(--card-pad);
  text-align: left;
}

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

/* Same font, size and top offset on both faces */
.card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-card);
  line-height: 1.05;
  letter-spacing: 0;
  margin: 0;
}

.card__face--front .card__title {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: var(--card-pad) var(--card-pad) calc(var(--card-pad) + 16px);
  background: linear-gradient(rgba(255,255,255,.92), rgba(255,255,255,0));
  color: var(--ink);
}

.card__face--back .card__title { color: var(--ink); }

.card__price {
  margin: 6px 0 0;
  font-size: var(--fs-body);
  letter-spacing: var(--track);
}

.card__summary {
  margin: 10px 0 0;
  font-size: var(--fs-body);
  line-height: 1.55;
  flex: 1 1 auto;
  overflow: hidden;
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.card__hint {
  position: absolute;
  right: 12px; bottom: 12px;
  font-size: var(--fs-body);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
  opacity: .5;
  pointer-events: none;
}

/* ---------------------------------------------------------------
   My Story
   --------------------------------------------------------------- */

.story__wrap {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 var(--pad);
  text-align: center;
}

.story__mark { width: 84px; margin: 0 auto clamp(16px, 3vh, 28px); }
.story__wrap .h-sub { margin-bottom: clamp(18px, 3vh, 30px); }

/* ---------------------------------------------------------------
   Contact panel (the section "Contact us" points at)
   --------------------------------------------------------------- */

.contact { background: var(--sage-light); text-align: center; justify-content: center; }
.contact__wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--pad); }

.contact__meta {
  margin: clamp(18px, 3vh, 30px) 0 0;
  font-size: var(--fs-body);
  letter-spacing: var(--track);
  line-height: 2.1;
}

.contact__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(20px, 3.5vh, 34px);
}

.contact__legal {
  margin: clamp(24px, 5vh, 44px) 0 0;
  font-size: var(--fs-body);
  letter-spacing: var(--track);
  text-transform: uppercase;
  opacity: .55;
}

/* ---------------------------------------------------------------
   Social icons
   --------------------------------------------------------------- */

.social {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 2vw, 20px);
  margin: clamp(20px, 3.5vh, 34px) 0 0;
  padding: 0;
  list-style: none;
}

.social__link {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}

.social__link:hover, .social__link:focus-visible {
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-3px);
}

.social__link svg { width: 19px; height: 19px; fill: currentColor; }
.social__link.is-placeholder { opacity: .28; pointer-events: none; }

/* ---------------------------------------------------------------
   Brand-coloured variant — used on the contact panel only. The fixed
   bar stays monochrome so it does not compete with the page.
   --------------------------------------------------------------- */

.social--brand .social__link--whatsapp  { color: #25D366; }
.social--brand .social__link--zalo      { color: #0068FF; }
.social--brand .social__link--instagram { color: #C13584; }
.social--brand .social__link--tiktok    { color: #010101; }
.social--brand .social__link--youtube   { color: #FF0000; }
.social--brand .social__link--facebook  { color: #1877F2; }

/* Instagram is a gradient, not a flat colour, so the glyph references the
   gradient defined in the sprite while the ring keeps a solid stop. */
.social--brand .social__link--instagram svg { fill: url(#ig-gradient) #C13584; }

.social--brand .social__link:hover,
.social--brand .social__link:focus-visible { background: currentColor; }
.social--brand .social__link:hover svg,
.social--brand .social__link:focus-visible svg { fill: var(--cream); }

/* ---------------------------------------------------------------
   Fixed social bar — always visible, except over the contact panel
   --------------------------------------------------------------- */

.socialbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 241, 234, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,.08);
  transition: transform .35s var(--ease), opacity .35s var(--ease);
}

/* Hidden once the contact panel, which carries its own icons, is reached */
.socialbar.is-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.socialbar .social { margin: 0; gap: clamp(10px, 1.8vw, 18px); }
.socialbar .social__link { width: 34px; height: 34px; border-color: rgba(0,0,0,.35); }
.socialbar .social__link svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------
   Detail pages
   --------------------------------------------------------------- */

html.no-snap { scroll-snap-type: none; }
body.detail { background: var(--cream); }

.detail__wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + clamp(30px, 8vh, 80px)) var(--pad)
           calc(var(--bar-h) + clamp(50px, 10vh, 110px));
}

.detail__back {
  display: inline-block;
  margin-bottom: clamp(22px, 4vh, 40px);
  font-size: var(--fs-body);
  letter-spacing: var(--track);
  text-transform: uppercase;
  text-decoration: none;
}

.detail__price {
  margin: 10px 0 0;
  font-size: var(--fs-sub);
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.detail__img {
  width: 100%;
  border-radius: 3px;
  margin-top: clamp(20px, 3.5vh, 34px);
  margin-bottom: clamp(24px, 4vh, 44px);
  background: var(--sage-light);
}

.detail__body p {
  font-size: var(--fs-body);
  line-height: 1.85;
  margin: 0 0 1.3em;
  max-width: 62ch;
}

.detail__cta {
  margin-top: clamp(30px, 6vh, 56px);
  padding-top: clamp(24px, 4vh, 40px);
  border-top: 1px solid rgba(0,0,0,.15);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail__missing { text-align: center; padding: clamp(60px, 16vh, 160px) 0; }
.detail__missing .detail__cta { justify-content: center; border-top: 0; }

/* ---------------------------------------------------------------
   Accessibility and motion
   --------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .card__inner { transition: none; }
}

/* Short landscape screens: let the page scroll normally */
@media (max-height: 460px) {
  html { scroll-snap-type: none; }
  .section { height: auto; min-height: 0; padding: 80px 0 40px; }
  .socialbar { position: static; }
}

/* ===============================================================
   MOBILE
   Everything below is scoped to narrow screens; desktop behaviour
   is deliberately untouched.
   =============================================================== */

@media (max-width: 700px) {

  /* The top-right nav overflowed the viewport — "Home" fell off the left
     edge — and overlapped section headings. On mobile it becomes a second
     bottom bar, sitting directly above the icons footer. */
  .nav {
    top: auto;
    bottom: var(--bar-h);
    left: 0;
    right: 0;
    justify-content: center;
    gap: 0;
    height: var(--navbar-h);
    padding: 0 8px;
    background: rgba(244, 241, 234, .9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,.08);
    transition: transform .35s var(--ease), opacity .35s var(--ease);
  }

  /* Wide tracking made the items run together, so "BOOK A CLASS MY STORY"
     read as one string. Tighter letters, clearer gaps between items. */
  .nav__link {
    font-size: var(--fs-nav);
    letter-spacing: .02em;
    padding: 6px 9px;
    color: var(--ink);
  }

  .nav__link + .nav__link { border-left: 1px solid rgba(0,0,0,.18); }

  /* The hero carries its own wordmark and buttons, so the nav slides away
     while it is on screen. The icons footer stays put. */
  .nav.is-over-hero {
    transform: translateY(130%);
    opacity: 0;
    pointer-events: none;
  }

  .nav.is-over-hero { text-shadow: none; }
  .nav.is-over-hero .nav__link { color: var(--ink); }

  /* When the icons bar hides itself over the contact panel, the nav drops
     into the space rather than floating above an empty strip. */
  .nav.is-low { bottom: 0; }

  /* Keep section content clear of the two stacked bars. */
  .section:not(.hero) { padding-bottom: calc(var(--bar-h) + var(--navbar-h)); }
  .hero__actions { padding-bottom: calc(var(--bar-h) + clamp(18px, 3vh, 36px)); }

  /* Taller cards: at 3/4 the description was being clipped mid-sentence
     once the two action buttons stacked. */
  .card {
    width: min(74vw, 300px);
    aspect-ratio: 3 / 4.6;
    scroll-snap-align: start;   /* so a tapped card can sit flush left */
  }

  /* Last resort if a description is still too long for the card */
  .card__summary { overflow-y: auto; }

  .card__actions { gap: 6px; }
  .card__actions .btn { width: 100%; text-align: center; }

  .socialbar .social__link { width: 32px; height: 32px; }

  /* Swipe is the gesture here; arrows only get in the way and
     pointer-type detection is not reliable everywhere. */
  .carousel__arrow { display: none; }
}

/* Very narrow phones: give the carousel every pixel it can get */
@media (max-width: 380px) {
  .card { width: 80vw; }
  .nav__link { padding: 6px 6px; letter-spacing: 0; }
}
