/* ==========================================================================
   warungserver — theme additions: floating island navigation, hero video
   slider, and admin editor. Loaded after style.css.
   ========================================================================== */

:root {
  --island-top: 16px;
  --island-h: 68px;
  --island-space: calc(var(--island-top) + var(--island-h) + 16px);
}

/* ---------- Floating glass island navigation ---------- */
.island-wrap {
  position: sticky; top: var(--island-top); z-index: 100;
  padding: 0 16px; margin: var(--island-top) auto 0; max-width: 1320px;
}
.island {
  position: relative; display: flex; flex-direction: column;
  min-height: var(--island-h); padding: 0 20px; border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .32)); /* frosted glass over whatever is behind */
  backdrop-filter: blur(28px) saturate(170%); -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 8px 32px rgba(0, 44, 51, .12), inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -1px 0 rgba(212, 175, 55, .18);
  transition: min-height .3s cubic-bezier(.4, 0, .2, 1), padding .3s, box-shadow .3s, transform .3s;
  animation: islandIn .5s cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes islandIn { from { transform: translateY(-12px); } to { transform: none; } }
.island:hover { box-shadow: 0 12px 40px rgba(0, 44, 51, .16), inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(212, 175, 55, .25); transform: translateY(-1px); }
body.scrolled .island { min-height: 56px; padding: 0 16px; background: linear-gradient(135deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .55)); box-shadow: 0 6px 24px rgba(0, 44, 51, .16), inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(212, 175, 55, .2); }
body.scrolled .island-wrap { margin-top: 8px; }
.island-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: inherit; }
.island-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.island-right { display: flex; align-items: center; gap: 8px; }
.island-logo { height: 40px; width: auto; display: block; transition: height .3s; }
body.scrolled .island-logo { height: 34px; }
.island-nav { display: flex; align-items: center; gap: 2px; }
.island-link {
  display: inline-block; padding: .45rem .9rem; border-radius: 10px; white-space: nowrap;
  font-weight: 700; font-size: .9rem; color: var(--brand); text-shadow: 0 1px 0 rgba(255, 255, 255, .35); transition: background .2s, color .2s;
}
.island-link:hover { background: rgba(255, 255, 255, .55); color: var(--brand); }
.island-link.is-active { background: var(--accent); color: #fff; font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .15); box-shadow: 0 4px 12px rgba(212, 175, 55, .35); }
.island-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border-radius: 10px; white-space: nowrap;
  font-weight: 700; font-size: .82rem; background: var(--brand); color: #fff; transition: background .2s, transform .2s, box-shadow .2s;
}
.island-btn:hover { background: var(--brand-900); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 44, 51, .25); }
.island-toggle { display: none; background: none; border: 0; padding: 8px; color: #4b5563; cursor: pointer; border-radius: 10px; line-height: 1; }
.island-toggle:hover { background: #f3f4f6; color: var(--brand); }
.island-nav-mobile { display: none; flex-direction: column; gap: 4px; padding: 6px 0 14px; border-top: 1px solid rgba(0, 44, 51, .08); margin-top: 4px; }
.island-nav-mobile .island-link { padding: .7rem .9rem; }
.island-nav-mobile .island-btn { justify-content: center; margin-top: 6px; }
@media (max-width: 900px) {
  .island-nav { display: none; }
  .island-right .island-btn { display: none; }
  .island-toggle { display: inline-flex; }
  .island.is-open .island-nav-mobile { display: flex; }
}
main { padding-top: var(--island-space); }
main.has-hero { padding-top: 0; }
.solution-group, .product { scroll-margin-top: calc(var(--island-space) + 8px); }

/* ---------- Hero video slider ---------- */
.hero-slider {
  position: relative; overflow: hidden; color: #fff; background: var(--brand-900);
  margin-top: calc(-1 * var(--island-space)); height: 100vh; height: 100svh; min-height: 560px;
}
.hero-slides { position: absolute; inset: 0; }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.hero-slide.is-active { opacity: 1; pointer-events: auto; z-index: 1; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 26, 31, .55) 0%, rgba(0, 44, 51, .45) 50%, rgba(0, 26, 31, .8) 100%);
}
.hero-caption {
  position: relative; display: flex; align-items: center; height: 100%; min-height: inherit;
  padding: calc(var(--island-space) + 2rem) 0 5rem;
}
.hero-caption-inner { max-width: 680px; }
.hero-slide[data-align="center"] .hero-caption { justify-content: center; text-align: center; }
.hero-slide[data-align="right"] .hero-caption { justify-content: flex-end; text-align: right; }
.hero-caption h1 { color: #fff; font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 900; margin-bottom: 1rem; text-shadow: 0 2px 24px rgba(0, 0, 0, .35); }
.hero-caption p { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: rgba(255, 255, 255, .88); margin-bottom: 1.75rem; }
.hero-caption .btn { font-size: 1rem; }
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(0, 44, 51, .35); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
  backdrop-filter: blur(6px); transition: background .2s, transform .2s;
}
.hero-arrow:hover { background: var(--accent); color: var(--brand-900); }
.hero-arrow.prev { left: 20px; }
.hero-arrow.next { right: 20px; }
.hero-dots { position: absolute; bottom: 28px; left: 0; right: 0; z-index: 2; display: flex; justify-content: center; gap: 10px; }
.hero-dots button {
  width: 10px; height: 10px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(255, 255, 255, .45); transition: transform .2s, background .2s;
}
.hero-dots button.is-active { background: var(--accent); transform: scale(1.3); }
@media (max-width: 700px) {
  .hero-arrow { display: none; }
  .hero-slide[data-align] .hero-caption { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { .hero-slide { transition: none; } .island { animation: none; } }
.hero-static { color: #fff; }
.hero-static h1 { color: #fff; }

.card-dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.card-dark .icon-wrap { background: rgba(255, 255, 255, .12); color: #fff; }
.card-dark h3 { color: #fff; }
.card-dark p { color: rgba(255, 255, 255, .75); }
.card .icon-wrap.product-logo { width: fit-content; height: auto; max-width: 100%; padding: .6rem 1rem; background: var(--bg); }
.product-logo img { display: block; height: auto; width: auto; max-height: 44px; max-width: 220px; object-fit: contain; }
.footer-logo, .sidebar-logo, .auth-logo { height: 44px; width: auto; max-width: 220px; object-fit: contain; object-position: left center; }
.sidebar-logo { height: 38px; }

/* ---------- Admin ---------- */
.sidebar-tag { display: inline-block; margin: -1.25rem 0 0 .5rem; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.portal-sidebar nav a .count { margin-left: auto; font-style: normal; background: var(--amber); color: var(--brand-900); font-size: .72rem; font-weight: 900; padding: .1rem .5rem; border-radius: 999px; }
.panel-brand { background: linear-gradient(135deg, var(--brand), var(--brand-700)); color: #fff; border: 0; }
.panel-brand h2 { color: #fff; margin-bottom: .25rem; }
.panel-brand p { margin: 0; color: rgba(255, 255, 255, .78); }
a.summary-card { color: inherit; transition: transform .15s, box-shadow .15s; }
a.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stack { display: grid; gap: 1.1rem; }
.quick-links { display: flex; flex-wrap: wrap; gap: .6rem; }
.table tr.is-unread td { background: #f7fbfb; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--brand); cursor: pointer; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--brand-50); border-color: #c9d8da; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-50); border-color: #efc5c0; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.field input[type="file"] { padding: .55rem .75rem; background: var(--bg); }

.branding-slot { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .branding-slot { grid-template-columns: 1fr; } }
.branding-preview { border-radius: var(--radius-sm); display: grid; place-items: center; min-height: 140px; padding: 1.5rem; border: 1px solid var(--line); }
.branding-preview.preview-light { background: repeating-conic-gradient(#f3f6f6 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.branding-preview.preview-dark { background: var(--brand); }
.branding-preview.preview-icon { background: var(--bg); }
.branding-preview img { max-height: 90px; max-width: 100%; object-fit: contain; }
.branding-preview.preview-icon img { width: 64px; height: 64px; }

.slide-list { display: grid; gap: 1rem; }
.slide-item { display: grid; grid-template-columns: 180px 1fr auto; gap: 1.25rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.slide-item.is-disabled { opacity: .6; }
@media (max-width: 800px) { .slide-item { grid-template-columns: 1fr; } }
.slide-thumb { aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: var(--brand-900); display: grid; place-items: center; color: rgba(255, 255, 255, .5); }
.slide-thumb video, .slide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-body p { margin: .25rem 0; color: var(--muted); }
.slide-body small { color: var(--muted); }
.slide-actions { display: flex; gap: .4rem; align-items: center; }
.slide-actions form { margin: 0; }
.slide-preview-video, .slide-preview-img { width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--radius-sm); background: var(--brand-900); }

.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.section-tile { display: grid; gap: .35rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.section-tile:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.section-tile-title { font-weight: 800; color: var(--brand); }
.section-tile-meta { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }

.editor .field label { font-size: .95rem; }
.repeater { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem 1.25rem; margin: 0; min-width: 0; }
.repeater legend { font-weight: 800; color: var(--brand); padding: 0 .4rem; }
.repeater > .hint { display: block; margin-bottom: .75rem; font-size: .85rem; color: var(--muted); }
.repeater-rows { display: grid; gap: .75rem; margin-bottom: .75rem; }
.repeater-row { display: grid; grid-template-columns: auto 1fr; gap: 1rem; padding: .9rem; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }
.repeater-row-tools { display: grid; gap: .35rem; align-content: start; }
.repeater-handle { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 900; font-size: .85rem; }
.repeater-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; min-width: 0; }
.repeater-fields .field-textarea { grid-column: 1 / -1; }
.repeater-fields .field textarea { min-height: 90px; }
.image-field { display: grid; grid-template-columns: 96px 1fr; gap: 1rem; align-items: center; }
.image-preview { width: 96px; height: 72px; border-radius: 8px; border: 1px solid var(--line); background: repeating-conic-gradient(#f3f6f6 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.image-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-controls { display: grid; gap: .4rem; min-width: 0; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; padding: 1rem 0 0; margin-top: .25rem; border-top: 1px solid var(--line); }

/* ---------- Opening animation (home page) ---------- */
.intro {
  position: fixed; inset: 0; z-index: 2000; background: var(--brand);
  display: grid; place-items: center; overflow: hidden; cursor: pointer;
  animation: introExit .95s cubic-bezier(.76, 0, .24, 1) calc(2s + var(--intro-hold, 3s)) forwards;
}
.intro::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 50% at 50% 50%, rgba(212, 175, 55, .18), transparent 70%);
  opacity: 0; animation: introGlow 2s ease-out .3s forwards;
}
.intro-inner { position: relative; display: grid; justify-items: center; gap: 1.4rem; animation: introLogoOut .6s ease-in calc(1.6s + var(--intro-hold, 3s)) forwards; }
.intro-logo {
  width: min(72vw, 360px); height: auto; opacity: 0;
  animation: introLogoIn 1.3s cubic-bezier(.2, .8, .2, 1) .3s forwards, introDrift calc(var(--intro-hold, 3s) + .8s) ease-in-out 1.6s forwards;
}
.intro-line {
  display: block; width: 0; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, #F0D877 50%, var(--accent) 70%, transparent);
  animation: introLine 1.2s cubic-bezier(.2, .8, .2, 1) 1.2s forwards;
}
.intro-skip {
  position: absolute; bottom: 28px; left: 0; right: 0; text-align: center;
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: rgba(255, 255, 255, .35);
  opacity: 0; animation: introFadeIn .6s ease 2s forwards;
}
@keyframes introLogoIn { from { opacity: 0; transform: translateY(22px) scale(.9); filter: blur(8px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes introDrift { from { transform: scale(1); } to { transform: scale(1.045); } }
@keyframes introLine { to { width: min(60vw, 220px); } }
@keyframes introGlow { to { opacity: 1; } }
@keyframes introFadeIn { to { opacity: 1; } }
@keyframes introLogoOut { to { opacity: 0; transform: scale(1.08); filter: blur(4px); } }
@keyframes introExit { to { clip-path: inset(0 0 100% 0); visibility: hidden; } }
html.no-intro .intro { display: none; }
html.no-intro body.intro-lock { overflow: auto; }
body.intro-lock { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .intro { animation: introFadeOut .4s ease calc(.6s + var(--intro-hold, 3s)) forwards; }
  .intro-logo { animation: introFadeIn .4s ease .1s forwards; }
  .intro-inner, .intro::before { animation: none; }
  .intro-line { animation: none; width: min(60vw, 220px); }
  @keyframes introFadeOut { to { opacity: 0; visibility: hidden; } }
}

/* Browsers without backdrop-filter get a more opaque bar so links stay readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .island, body.scrolled .island { background: rgba(255, 255, 255, .92); }
}

/* ---------- Floating back-to-top button ---------- */
.to-top-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); background: linear-gradient(160deg, #0A4652 0%, var(--brand) 55%, #001A1F 100%);
  border: 2px solid var(--accent);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .22),      /* top highlight: embossed face */
    inset 0 -3px 0 rgba(0, 0, 0, .35),           /* bottom shade */
    0 0 0 3px rgba(212, 175, 55, .22),           /* soft gold halo */
    0 10px 24px rgba(0, 26, 31, .35);            /* drop shadow lifts it off the page */
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.9);
  transition: opacity .3s, visibility .3s, transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .2s;
}
.to-top-fab .icon { filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .4)); }
body.scrolled-far .to-top-fab, html:not(.js) .to-top-fab { opacity: 1; visibility: visible; transform: none; }
.to-top-fab:hover {
  color: #F0D877; transform: translateY(-4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 -3px 0 rgba(0, 0, 0, .35), 0 0 0 4px rgba(212, 175, 55, .3), 0 16px 32px rgba(0, 26, 31, .4);
}
.to-top-fab:active {
  transform: translateY(0) scale(.96);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .45), 0 0 0 3px rgba(212, 175, 55, .25), 0 4px 10px rgba(0, 26, 31, .3);
}
@media (max-width: 700px) { .to-top-fab { right: 14px; bottom: 14px; width: 48px; height: 48px; } }
@media (prefers-reduced-motion: reduce) { .to-top-fab { transition: none; } }
