/*
 * Shared, design-neutral CSS for every Lakon template. Loaded by _LakonLayout *before* each
 * design's own style.css, so a design always wins on anything it also declares.
 *
 * Deliberately tiny. These 98 bundles each ship a complete stylesheet with its own tokens, and the
 * one thing they cannot bring is a convention invented for this platform. Anything design-specific
 * belongs in that design's style.css, not here.
 */

/*
 * The canonical section anchors (#lakon-cover, #lakon-events, …) that each Index.cshtml inserts.
 *
 * template_customizations.preview_anchor scrolls the editor's live preview to these, and
 * tools/content/lakon.py asserts they are present in the rendered page. They are extra elements
 * rather than renames of the bundles' own ids, because those ids are bound by each design's
 * script.js — so they have to be layout-neutral.
 *
 * position:absolute is what makes that true: several of these sections are flex containers, and an
 * in-flow child would become a flex item and take a share of the space. Absolute takes it out of
 * flow entirely. Zero-sized and non-interactive so it can never intercept a tap.
 *
 * The negative offset is the sticky top bar: without it, scrolling to a section leaves its first
 * line underneath the bar.
 */
.lakon-anchor {
    position: absolute;
    top: -56px;
    left: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Applied after a design has initialised. Important makes a host's explicit off switch win over
 * template display rules, including full-screen and canvas themes. */
.lakon-section-disabled {
    display: none !important;
}

/*
 * The draft-preview badge _LakonLayout renders when Model.IsPreview.
 *
 * Fixed rather than absolute, and above everything: a preview renders exactly what the public page
 * would, so this badge is the only thing distinguishing an unpublished draft from the live
 * invitation — and it has to stay visible over the cover, the bottom sheets and the lightbox, all of
 * which stack above the feed. Non-interactive so it can never swallow a tap on the design beneath.
 *
 * A pill in the bottom-left corner, above the bottom navs, rather than a full-width top strip:
 * the strip covered the sticky top bar of almost every design (brand names, tabs, the couple's
 * name) while scrolling.
 */
.lakon-draft-badge {
    position: fixed;
    left: 8px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    z-index: 2147483647;
    padding: 4px 10px;
    border-radius: 999px;
    font: 600 11px/1.4 ui-sans-serif, system-ui, sans-serif;
    letter-spacing: .02em;
    color: #1b1300;
    background: #ffc94d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    opacity: .92;
    pointer-events: none;
}

/* Dress-code palettes. The designs below lay their swatches out as a wrapping row of fixed
   52-64px cells, which put five colours on two rows (4 + 1, the last one stranded). Equal
   flexible cells keep a five-colour palette on one line at 390px; longer palettes still wrap. */
:is(
  .lakon--balletcore, .lakon--bingkai, .lakon--bioskop, .lakon--cergam, .lakon--ceria, .lakon--cie,
  .lakon--clay, .lakon--coquette, .lakon--dango, .lakon--doodle, .lakon--gemerlap, .lakon--gemoy,
  .lakon--handdraw, .lakon--hangat, .lakon--hikayat, .lakon--idola, .lakon--instan, .lakon--jamuan,
  .lakon--jurnal, .lakon--kartupos, .lakon--kaset, .lakon--kawung, .lakon--kecup, .lakon--kelinci,
  .lakon--kelopak, .lakon--koran, .lakon--krayon, .lakon--layar, .lakon--lesehan, .lakon--limun,
  .lakon--magenta, .lakon--midcentury, .lakon--mochi, .lakon--neon, .lakon--ondel, .lakon--pelesir,
  .lakon--pentas, .lakon--peron, .lakon--pesisir, .lakon--pita, .lakon--pondok, .lakon--priangan,
  .lakon--sabana, .lakon--sayang, .lakon--seduh, .lakon--simetri, .lakon--slide, .lakon--taman,
  .lakon--tarot, .lakon--tenun, .lakon--usap, .lakon--wabi, .lakon--warkop, .lakon--wisteria,
  .lakon--y2k, .lakon--zamrud, .lakon--zodiac
) .palette > .swatch {
  flex: 1 1 0;
  min-width: 48px;
  max-width: 64px;
}

/*
 * The mobile tap highlight drew a light-blue box over every game button (Petualang review). Half
 * the bundles already turn it off on body; it is inherited, so this covers the other half. A design
 * that wants it back can still set it on its own elements.
 */
html { -webkit-tap-highlight-color: transparent; }

/* Round 2 (G-SMALLTEXT): readable.js lifts short labels to 12px. A bottom nav that then overflows the
   screen is marked .lakon-nav-fit: its buttons share the width and drop most of their letter-spacing. */
html body .nav.lakon-nav-fit {
  box-sizing: border-box;
  max-width: 100vw;
  padding-left: 4px !important;
  padding-right: 4px !important;
}
html body .nav.lakon-nav-fit > * {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 2px !important;
  padding-right: 2px !important;
  letter-spacing: .02em !important;
}
html body .nav.lakon-nav-fit > * * { letter-spacing: .02em !important; }
/* Uniform nav (Phase 3): a fitted bar whose labels still overlap (readable.js) scrolls sideways instead,
   each button at its natural width. Edge fade hints that more buttons are off-screen. */
html body .nav.lakon-nav-fit.lakon-nav-scroll,
html body #tabbar.lakon-nav-fit.lakon-nav-scroll {
  display: flex !important;
  justify-content: flex-start !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 4px;
}
html body .nav.lakon-nav-scroll::-webkit-scrollbar,
html body #tabbar.lakon-nav-scroll::-webkit-scrollbar { display: none; }
html body .nav.lakon-nav-fit.lakon-nav-scroll > :not(.lakon-nav-cue),
html body #tabbar.lakon-nav-fit.lakon-nav-scroll > :not(.lakon-nav-cue) {
  flex: 0 0 auto !important;
  width: auto !important; /* Piknik's fixed 62px button cut "Mempelai" */
  min-width: 56px;
  padding-left: 8px !important;
  padding-right: 8px !important;
  scroll-snap-align: start;
}
/* "Bapak/Ibu/Saudara/i" has no break point; at 32px in the fallback face, before the web font arrives (or when
   it never does), it was wider than a 360px screen and widened the whole page to 361-366px (Kelopak, Pita, HandDraw; S17). */
html body .hero__guest, html body .kartu__nama, html body [id*="guest"] { overflow-wrap: anywhere; }
/* Gallery captions were one line with an ellipsis; at 12px most were cut. They wrap instead. */
html body .gallery__cap { white-space: normal !important; text-overflow: clip !important; }

/* Round 2 (R2-S46): the badge's fixed bottom-left spot clears an invitation's bottom nav but landed on
   game controls (Comot's arrow pads), and a corner fallback then covered Comot's KOIN readout.
   readable.js now places it by inline top/left at the spot that covers no control or visible text,
   and shortens it to "Draf" when nothing is fully clear. */
.lakon-draft-badge[data-placed] { bottom: auto; right: auto; }

/* NM-001: the "more buttons this way" cue on a swipe strip (readable.js paints it in the bar's own colours).
   Sticky at the right edge and taking no width (negative margin), so it never moves a button; it fades
   out once the strip reaches its end, leaving the last button fully clear. */
html body .lakon-nav-scroll > .lakon-nav-cue {
  position: sticky;
  right: -4px; /* sticky stops at the padding edge; .lakon-nav-fit pads the bar 4px */
  flex: 0 0 28px;
  width: 28px;
  min-width: 0;
  margin-left: -28px;
  padding: 0 2px 0 0 !important;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 55%);
  mask-image: linear-gradient(90deg, transparent, #000 55%);
}
html body .lakon-nav-scroll.lakon-nav-more > .lakon-nav-cue { opacity: 1; }
.lakon-nav-cue svg { opacity: .7; }

/* Uniform nav (Phase 5, NAV-L2): bottom text pill for the Lakon page designs that had no nav.
   Built by _shared/page-nav.js in views that carry <nav data-lakon-pagenav>; --lakon-pagenav-ink is
   the design's own heading ink. Below the cover (z-index 100); the music button moves up above it. */
.lakon-pagenav {
  --lakon-pagenav-ink: #4a3a30;
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  gap: 2px;
  max-width: calc(100vw - 24px);
  padding: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid color-mix(in srgb, var(--lakon-pagenav-ink) 22%, transparent);
  border-radius: 999px;
  background: rgba(255, 253, 249, .94);
  box-shadow: 0 10px 30px rgba(30, 24, 20, .16);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  transition: transform .25s ease, opacity .25s ease;
}
.lakon-pagenav::-webkit-scrollbar { display: none; }
.lakon-pagenav[hidden] { display: none; }
/* Every page design locks the body while its cover is up (Arcana's cover is a scene in the page, not an overlay). */
body.is-locked .lakon-pagenav,
.lakon-pagenav.is-waiting { display: none; }
.lakon-pagenav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--lakon-pagenav-ink);
  font: 500 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  text-decoration: none;
}
.lakon-pagenav a.is-active { background: var(--lakon-pagenav-ink); color: #fff; }
.lakon-pagenav a:focus-visible { outline: 2px solid var(--lakon-pagenav-ink); outline-offset: 2px; }
.lakon-pagenav.is-tucked { transform: translate(-50%, calc(100% + 30px)); opacity: 0; pointer-events: none; }
html.has-lakon-pagenav .music { bottom: 78px !important; }
@media (prefers-reduced-motion: reduce) { .lakon-pagenav { transition: none; } }
