/* FlavorFortune — shared site styles */

:root {
  --mystic-gold: #D4AF37;
  --mystic-purple: #2D1B4E;
  --mystic-cream: #F5F5DC;
  --mystic-red: #8B0000;
  --mystic-deep: #1A0F2E;
}

/* ——— Base ——— */
body {
  background: radial-gradient(circle at center, #2D1B4E 0%, #1A0F2E 100%);
  color: #F5F5DC;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Quicksand, sans-serif;
}

.font-mystic,
.mystic {
  font-family: Cinzel, serif;
}

iframe {
  margin: 0 auto;
}

.gold {
  color: var(--mystic-gold);
}

/* Tailwind token fallbacks (when config not loaded yet) */
.text-mystic-gold { color: var(--mystic-gold); }
.border-mystic-gold { border-color: var(--mystic-gold); }
.bg-mystic-gold { background-color: var(--mystic-gold); }
.bg-mystic-purple { background-color: var(--mystic-purple); }
.text-mystic-cream { color: var(--mystic-cream); }
.hover\:text-mystic-gold:hover { color: var(--mystic-gold); }
.hover\:bg-mystic-gold:hover { background-color: var(--mystic-gold); }
.hover\:text-mystic-purple:hover { color: var(--mystic-purple); }

/* Tool / legal page backgrounds */
body.page-coffee { background: #0c0814; }
body.page-tea { background: radial-gradient(circle at center, #1A0F2E 0%, #0F091A 100%); }
body.page-spice { background: #1a0505; }
body.page-fruit { background: #0a1f0a; }
body.page-noodle { background: #1a0f00; }
body.page-dessert { background: #2d1b2d; }
body.page-wine { background: #1a051a; }
body.page-egg {
  background: radial-gradient(ellipse at 50% 30%, #3d2a1a 0%, #1A0F2E 55%, #120a1c 100%);
}
body.page-legal { background: #1A0F2E; }

/* ——— Homepage ——— */
.fortune-card {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  perspective: 1000px;
}
.fortune-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

.topic-chip {
  font-family: Cinzel, serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #F5F5DC;
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  opacity: 0.85;
  transition: all 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
}
.topic-chip:hover {
  color: #2D1B4E;
  background: #D4AF37;
  border-color: #D4AF37;
  opacity: 1;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 300px);
  gap: 1.5rem;
}
@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }
}
@media (max-width: 640px) {
  .bento-grid { grid-template-columns: 1fr; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ——— Knowledge / more ——— */
.filter-btn.active {
  background: #D4AF37;
  color: #2D1B4E;
  border-color: #D4AF37;
}

/* ——— Articles ——— */
.article-body h2 {
  font-family: Cinzel, serif;
  color: #D4AF37;
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  letter-spacing: 0.04em;
}
.article-body p {
  opacity: 0.8;
  line-height: 1.9;
  margin-bottom: 1.35rem;
  font-size: 1.08rem;
  max-width: 48rem;
}
.article-body .article-grid {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0 2.5rem;
}
@media (min-width: 768px) {
  .article-body .article-grid { grid-template-columns: 1fr 1fr; }
  .article-body p { max-width: none; }
}
.article-body .callout {
  border: 1px solid rgba(212, 175, 55, 0.28);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
}
.article-body .callout h3 {
  font-family: Cinzel, serif;
  color: #D4AF37;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
}
.article-body ul,
.article-body ol {
  opacity: 0.8;
  line-height: 1.85;
  margin: 0 0 1.5rem 1.25rem;
}
.article-body li { margin-bottom: 0.5rem; }
.article-body strong { color: #F5F5DC; opacity: 1; }

/* ——— Contact ——— */
input,
textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: white;
}
input:focus,
textarea:focus {
  border-color: #D4AF37;
  outline: none;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

/* ——— Legal ——— */
body.page-legal section { margin-bottom: 3rem; }

/* ——— Cookie ——— */
.cookie-half { transition: all 0.8s ease-out; }
.cracked .cookie-left { transform: translateX(-150px) rotate(-45deg); opacity: 0; }
.cracked .cookie-right { transform: translateX(150px) rotate(45deg); opacity: 0; }
#fortune-paper {
  transform: translateY(100px) scale(0);
  transition: all 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.cracked #fortune-paper { transform: translateY(0) scale(1); opacity: 1; }

/* ——— Tea ——— */
#tea-cup { transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; }
.swirling #tea-cup { transform: rotate(720deg) scale(0.8); }
#leaves {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 40px;
  opacity: 0;
  transition: opacity 1s;
}
.revealed #leaves { opacity: 1; }
.leaf-dot { background: #3d2b1f; border-radius: 50%; }

/* ——— Coffee ——— */
.saucer {
  width: 300px;
  height: 300px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.1);
}
.ground-mark {
  background: #3e2723;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  opacity: 0.9;
  position: absolute;
  filter: blur(2px);
}
#grounds-canvas {
  transition: all 1.5s ease-in-out;
  opacity: 0;
  transform: scale(0.5);
}
.active #grounds-canvas { opacity: 1; transform: scale(1); }

/* ——— Spice ——— */
.spice-bottle { transition: all 0.3s ease; cursor: pointer; }
.spice-bottle:hover { transform: translateY(-10px) rotate(5deg); }
.selected-spice { animation: glow 2s infinite alternate; }
@keyframes glow {
  from { box-shadow: 0 0 10px #D4AF37; }
  to { box-shadow: 0 0 30px #D4AF37; }
}

/* ——— Fruit ——— */
.mandala-container { position: relative; width: 400px; height: 400px; }
.fruit-icon { position: absolute; transition: all 0.5s ease; cursor: pointer; }
.fruit-icon:hover {
  transform: scale(1.2) rotate(15deg);
  filter: drop-shadow(0 0 10px #D4AF37);
}

/* ——— Noodle ——— */
.bowl {
  position: relative;
  width: 300px;
  height: 300px;
  background: #8B4513;
  border-radius: 0 0 150px 150px;
  border: 10px solid #5D2E0B;
}
.noodle-strand {
  position: absolute;
  background: #F5DEB3;
  height: 4px;
  border-radius: 2px;
}
#noodle-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.path-anim {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 3s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ——— Dessert ——— */
.dessert-card {
  transition: all 0.4s ease;
  cursor: pointer;
  border: 1px solid rgba(212, 175, 55, 0.2);
}
.dessert-card:hover {
  transform: translateY(-10px);
  background: rgba(212, 175, 55, 0.1);
  border-color: #D4AF37;
}

/* ——— Wine ——— */
.glass-container { position: relative; cursor: pointer; }
.liquid {
  position: absolute;
  bottom: 20px;
  left: 10px;
  right: 10px;
  height: 0;
  background: #722f37;
  border-radius: 0 0 50px 50px;
  transition: height 2s ease;
}
.filling .liquid { height: 100px; }
.bubble {
  position: absolute;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: rise 3s infinite;
}
@keyframes rise {
  from { bottom: 0; opacity: 1; }
  to { bottom: 100px; opacity: 0; }
}

/* ——— Salt ——— */
#salt-plate {
  width: min(360px, 85vw);
  height: min(360px, 85vw);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a2a1a 0%, #1a120c 70%);
  border: 2px solid rgba(212, 175, 55, 0.35);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 175, 55, 0.1);
}
.salt-grain {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #F5F5DC;
  border-radius: 50%;
  opacity: 0.85;
  pointer-events: none;
}
#salt-plate.casting { animation: shake 0.45s ease; }
@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

/* ——— Egg ——— */
#egg-stage {
  position: relative;
  width: 220px;
  height: 280px;
  cursor: pointer;
}
.egg-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 160px;
  color: #f3e9d2;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  transition: transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.6s ease;
}
#egg-stage.cracked .egg-shell {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.3) rotate(12deg);
}
#yolk-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.4);
  transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}
#egg-stage.cracked #yolk-reveal {
  opacity: 1;
  transform: scale(1);
}
.yolk-orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #e8a317 55%, #c47a0a);
  box-shadow: 0 0 40px rgba(232, 163, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.yolk-orb i {
  font-size: 2.5rem;
  color: #2D1B4E;
  opacity: 0.75;
}
@keyframes pulse-egg {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.04); }
}
#egg-stage:not(.cracked) .egg-shell {
  animation: pulse-egg 2.4s ease-in-out infinite;
}

/* ——— Site chrome (nav / mobile / ad stage) ——— */
.ff-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
}
.ff-nav-link { position: relative; padding: 0.35rem 0; }
.ff-nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #D4AF37;
  transition: width 0.25s ease;
  transform: translateX(-50%);
}
.ff-nav-link:hover::after,
.ff-dropdown:hover > .ff-nav-link::after { width: 100%; }
.ff-dropdown-caret {
  font-size: 0.55rem;
  margin-left: 0.35rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}
.ff-dropdown:hover .ff-dropdown-caret { transform: rotate(180deg); }
.ff-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 11rem;
  padding-top: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 70;
}
.ff-dropdown:hover .ff-dropdown-menu,
.ff-dropdown:focus-within .ff-dropdown-menu,
.ff-dropdown.is-open .ff-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.ff-dropdown-panel {
  background: rgba(26, 15, 46, 0.98);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 0.75rem;
  padding: 0.4rem 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
.ff-dd-item {
  display: block;
  padding: 0.65rem 1.1rem;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #F5F5DC;
  opacity: 0.8;
  transition: color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.ff-dd-item:hover {
  color: #D4AF37;
  opacity: 1;
  background: rgba(212, 175, 55, 0.08);
}

#mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  background: radial-gradient(circle at top, #3a2460 0%, #1A0F2E 55%, #120a1c 100%);
  color: #F5F5DC;
}
#mobile-menu.is-open { display: flex; }
.ff-m-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  flex-shrink: 0;
}
.ff-m-brand {
  font-family: Cinzel, serif;
  color: #D4AF37;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.ff-m-close {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 9999px;
  color: #D4AF37;
  background: transparent;
  cursor: pointer;
}
.ff-m-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
}
.ff-m-link {
  display: block;
  padding: 0.95rem 0.25rem;
  font-family: Cinzel, serif;
  font-size: 1.15rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  color: #F5F5DC;
  opacity: 0.9;
}
.ff-m-link:active,
.ff-m-link:hover { color: #D4AF37; }
.ff-m-link.ff-m-muted {
  font-size: 0.95rem;
  opacity: 0.55;
  letter-spacing: 0.16em;
}
.ff-m-accordion { border-bottom: 1px solid rgba(212, 175, 55, 0.12); }
.ff-m-acc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 0.25rem;
  background: transparent;
  border: 0;
  color: #F5F5DC;
  cursor: pointer;
  font-family: Cinzel, serif;
  font-size: 1.15rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.ff-m-acc-title { opacity: 0.9; }
.ff-m-acc-icon {
  font-size: 0.7rem;
  color: #D4AF37;
  transition: transform 0.25s ease;
  opacity: 0.85;
}
.ff-m-accordion.is-open .ff-m-acc-icon { transform: rotate(180deg); }
.ff-m-acc-panel { display: none; padding: 0 0 0.85rem 0.75rem; }
.ff-m-accordion.is-open .ff-m-acc-panel { display: block; }
.ff-m-sublink {
  display: block;
  padding: 0.55rem 0.25rem;
  font-family: Quicksand, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: rgba(245, 245, 220, 0.7);
}
.ff-m-sublink:active,
.ff-m-sublink:hover { color: #D4AF37; }
.ff-m-view-all {
  color: #D4AF37 !important;
  opacity: 0.9;
  font-family: Cinzel, serif !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.18em !important;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.ff-m-footer-note {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  opacity: 0.35;
  font-family: Cinzel, serif;
  text-transform: uppercase;
}

/* Place <div id="flavor-oracle-stage" class="ff-oracle-slot"> manually per page.
   Adjust spacing with mt- / mb- / my- utility classes on that node. */
#flavor-oracle-stage,
.ff-oracle-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  min-height: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
#flavor-oracle-stage:empty { display: none; }

footer.w-full { width: 100%; flex-shrink: 0; }
#tool-stage { box-sizing: border-box; }

/* ——— H5: kill horizontal scroll (mobile only) ——— */
@media (max-width: 767px) {
  html {
    overflow-x: hidden;
    max-width: 100%;
  }
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  main,
  header,
  footer,
  #tool-stage,
  .container {
    max-width: 100%;
    box-sizing: border-box;
  }

  img,
  svg,
  video,
  iframe,
  canvas {
    max-width: 100%;
  }

  /* Ad mount — GPT sets min-width: 336px which overflows narrow phones */
  #flavor-oracle-stage,
  .ff-oracle-slot {
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }
  #flavor-oracle-stage > *,
  .ff-oracle-slot > * {
    min-width: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Contact: two-col name/type row + padded FAQ + long email */
  form .grid.grid-cols-2 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  main .gap-16 { gap: 2rem; }
  main .p-12 { padding: 1.5rem; }
  main .space-y-12 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 2rem;
  }
  main a[href^="mailto:"] {
    font-size: 1.15rem !important;
    line-height: 1.35;
    word-break: break-all;
    overflow-wrap: anywhere;
  }
  main h1.text-5xl,
  main h1.text-6xl {
    font-size: 2rem;
    line-height: 1.2;
    word-break: break-word;
  }

  /* Tool pages: fixed-size ritual widgets */
  .saucer {
    width: min(300px, 72vw);
    height: min(300px, 72vw);
  }
  .mandala-container {
    width: min(400px, 88vw);
    height: min(400px, 88vw);
  }
  .bowl {
    width: min(300px, 72vw);
    height: min(300px, 72vw);
    border-radius: 0 0 50% 50%;
  }
  #cup-area.w-80,
  #cup-area {
    width: min(20rem, 88vw) !important;
    height: min(20rem, 88vw) !important;
  }
  #cookie-container {
    max-width: 100%;
    overflow: hidden;
  }
  #cookie-container .text-\[150px\],
  #cookie-container i.fa-cookie {
    font-size: min(150px, 38vw) !important;
  }
  #cup-container .text-\[150px\],
  #cup-container i.fa-coffee,
  #tea-cup .text-\[200px\],
  #tea-cup i.fa-mug-hot {
    font-size: min(150px, 42vw) !important;
  }
  .cracked .cookie-left { transform: translateX(-40vw) rotate(-45deg); opacity: 0; }
  .cracked .cookie-right { transform: translateX(40vw) rotate(45deg); opacity: 0; }

  /* Dessert 2-col cards: tighten gap so they fit */
  .dessert-card { min-width: 0; }

  /* Nav brand can crowd the menu button on very small screens */
  nav.fixed > a.font-mystic {
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    max-width: calc(100% - 3rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Long unbroken strings in lore / articles */
  .article-body,
  .article-body p {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Legacy nav underline (kept for any remaining .nav-link usage) */
.nav-link { position: relative; overflow: hidden; }
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #D4AF37;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}
.nav-link:hover::after { width: 100%; }
