/*
 * The sky-islands scene that every public page lives in (see layouts/public.blade.php):
 * a full-screen 3D canvas, a small HUD on top, the window of the island the camera is at,
 * and the window that holds a page of the site.
 * Every rule starts with body.mode-islands, so nothing here touches the admin or the classic pages.
 */
body.mode-islands {
    --night: #0c1411;
    --panel: rgba(14, 23, 19, .92);
    --line: #2b3d33;
    --green: #b1cb54;
    --gold: #e3c77a;
    --text: #e9efe2;
    --mute: #9aa894;
    --display: 'Chakra Petch', 'Sarabun', sans-serif;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #6db6e8 !important;
}
html:has(body.mode-islands) { height: 100%; overflow: hidden; }
body.mode-islands::after { display: none; } /* the corner island of the classic pages is not needed here */
body.mode-islands [hidden] { display: none !important; }

body.mode-islands #game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
body.mode-islands #game.is-over { cursor: pointer; }

/* name tags over the islands */
body.mode-islands #labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
body.mode-islands .label {
    position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: auto; cursor: pointer;
    font-family: var(--display); font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text);
    padding: 6px 14px; background: rgba(12, 20, 17, .88);
    border: 1px solid var(--line); border-bottom: 3px solid var(--gold);
    transition: background .15s, color .15s, opacity .2s; will-change: transform;
}
body.mode-islands .label i { color: var(--gold); margin-right: 6px; }
body.mode-islands .label:hover, body.mode-islands .label:focus-visible, body.mode-islands .label.is-over { background: var(--gold); color: #1a1608; outline: 0; }
body.mode-islands .label:hover i, body.mode-islands .label:focus-visible i, body.mode-islands .label.is-over i { color: #1a1608; }
body.mode-islands .label.is-found { border-bottom-color: var(--green); }
body.mode-islands .label.is-found i { color: var(--green); }
body.mode-islands .label.is-dim { opacity: 0; pointer-events: none; }

/* HUD */
body.mode-islands .hud { position: fixed; z-index: 5; line-height: 1.4; -webkit-user-select: none; user-select: none; }
body.mode-islands .hud--tl { top: 14px; left: 14px; max-width: 290px; }
body.mode-islands .hud--tr { top: 14px; right: 14px; }
body.mode-islands .hud__row { display: flex; gap: 6px; }
body.mode-islands .hud__box { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 10px 14px; }
body.mode-islands .hud__kicker { font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
body.mode-islands .tracker__title { font-family: var(--display); font-weight: 700; font-size: 18px; margin: 2px 0 4px; color: var(--text); }
body.mode-islands .tracker__line { font-size: 14px; color: var(--mute); }
body.mode-islands .tracker__line b { color: var(--green); font-family: var(--display); font-size: 16px; }
body.mode-islands .tracker__next { margin-top: 6px; font-size: 14px; color: var(--text); }
body.mode-islands .tracker__next i { color: var(--gold); margin-right: 4px; }
body.mode-islands .hud__btn {
    display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 12px;
    font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-decoration: none;
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
}
body.mode-islands .hud__btn:hover, body.mode-islands .hud__btn:focus-visible { border-color: var(--green); color: var(--green); outline: 0; text-decoration: none; }
body.mode-islands .hud__btn.is-on { background: var(--green); border-color: var(--green); color: #10180a; }

/* logo plate */
body.mode-islands .brand {
    display: inline-flex; align-items: center; gap: 14px; margin-bottom: 8px; padding: 10px 20px 10px 14px; text-decoration: none;
    background: #0c1411; border: 1px solid var(--line); border-bottom: 3px solid var(--green);
    box-shadow: 0 6px 18px rgba(8, 30, 50, .35);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
}
body.mode-islands .brand img { width: 92px; display: block; }
body.mode-islands .brand__name { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: .02em; color: #fff; line-height: 1; }
body.mode-islands .brand__name b { color: var(--green); font-weight: 700; }

/* window of the island the camera is at */
body.mode-islands #ipanel {
    position: fixed; z-index: 6; right: 24px; top: 50%; transform: translateY(-50%);
    width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 120px); overflow: auto;
    background: rgba(14, 23, 19, .94); border: 1px solid var(--line); border-top: 3px solid var(--gold);
    padding: 22px 24px; color: var(--text); font-size: 16px; line-height: 1.5; animation: ipanel .35s ease-out;
}
@keyframes ipanel { from { opacity: 0; transform: translate(24px, -50%); } }
@keyframes ipanel-up { from { opacity: 0; transform: translateY(24px); } }
body.mode-islands #ipanel h2 { display: block; font-family: var(--display); font-size: 28px; font-weight: 700; margin: 4px 0 10px; }
body.mode-islands #ipanel h2::before { content: none; }
body.mode-islands #ipanel p { color: var(--mute); line-height: 1.7; margin: 0 0 16px; }
body.mode-islands #ipanel-items, body.mode-islands #ipanel-links { display: grid; gap: 8px; margin-bottom: 12px; }
body.mode-islands #ipanel-links { grid-template-columns: 1fr 1fr; }
body.mode-islands #ipanel-items button, body.mode-islands #ipanel-links a {
    display: flex; align-items: center; gap: 10px; text-align: left; text-decoration: none; cursor: pointer;
    padding: 11px 14px; background: #0c1411; border: 1px solid var(--line);
    font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--text);
}
body.mode-islands #ipanel-items button i, body.mode-islands #ipanel-links a i { width: 20px; text-align: center; color: var(--green); }
body.mode-islands #ipanel-items button::after { content: "\203A"; margin-left: auto; color: var(--mute); font-size: 20px; line-height: 1; }
body.mode-islands #ipanel-items button:hover, body.mode-islands #ipanel-items button:focus-visible,
body.mode-islands #ipanel-links a:hover, body.mode-islands #ipanel-links a:focus-visible { border-color: var(--green); color: var(--green); outline: 0; }
body.mode-islands #ipanel-items button.is-main { background: var(--green); border-color: var(--green); color: #10180a; }
body.mode-islands #ipanel-items button.is-main i, body.mode-islands #ipanel-items button.is-main::after { color: #10180a; }
body.mode-islands #ipanel-items button.is-main:hover, body.mode-islands #ipanel-items button.is-main:focus-visible { background: #c6e062; color: #10180a; }
body.mode-islands .ipanel__back { margin-top: 4px; padding: 8px 0; background: none; border: 0; cursor: pointer; font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--mute); }
body.mode-islands .ipanel__back:hover, body.mode-islands .ipanel__back:focus-visible { color: var(--gold); outline: 0; }

/* the window that holds a page of the site */
body.mode-islands .overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 3vh 3vw; background: rgba(6, 14, 22, .5); }
body.mode-islands .sheet {
    width: min(1220px, 100%); height: 100%; min-height: 0; display: flex; flex-direction: column;
    background: #0c1411; border: 1px solid var(--line); border-top: 3px solid var(--gold);
    box-shadow: 0 20px 60px rgba(4, 18, 30, .5); animation: sheet-in .25s ease-out;
}
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } }
body.mode-islands .sheet__bar { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; font-family: var(--display); font-weight: 700; color: var(--text); border-bottom: 1px solid var(--line); }
body.mode-islands .sheet__bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.mode-islands .sheet__bar a { padding: 8px; color: var(--mute); }
body.mode-islands .sheet__bar button { padding: 8px 14px; background: transparent; border: 1px solid var(--line); color: var(--text); cursor: pointer; font-family: var(--display); font-weight: 600; }
body.mode-islands .sheet__bar button:hover, body.mode-islands .sheet__bar button:focus-visible { border-color: var(--green); color: var(--green); outline: 0; }
body.mode-islands .sheet iframe { flex: 1; width: 100%; border: 0; background: #8fcaf0; }
body.mode-islands .sheet__scroll {
    flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #5fa9e2 0%, #8fcaf0 50%, #cfe9f8 100%);
}
body.mode-islands .sheet__scroll .footer { margin-bottom: 20px; }

/* when the browser cannot draw 3D and the classic pages cannot be switched on either: plain list of the islands */
body.mode-islands.no-webgl #game { display: none; }
body.mode-islands.no-webgl #labels { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
body.mode-islands.no-webgl .label { position: static; transform: none !important; display: block !important; }

@media (max-width: 900px) {
    body.mode-islands #ipanel { right: 0; left: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 52vh; padding: 16px 18px; border-left: 0; border-right: 0; border-bottom: 0; animation-name: ipanel-up; }
    body.mode-islands #ipanel h2 { font-size: 22px; }
    body.mode-islands.is-focus .tracker { display: none; } /* leave the small screen to the island */
}
@media (max-width: 640px) {
    body.mode-islands .hud--tl { top: 8px; left: 8px; max-width: 230px; }
    body.mode-islands .hud--tr { top: 8px; right: 8px; }
    body.mode-islands .hud__box { padding: 7px 10px; }
    body.mode-islands .tracker__line, body.mode-islands .tracker__next { font-size: 12.5px; }
    body.mode-islands .label { font-size: 13px; padding: 4px 9px; border-bottom-width: 2px; }
    body.mode-islands .brand { padding: 7px 14px 7px 10px; gap: 10px; margin-bottom: 6px; }
    body.mode-islands .brand img { width: 60px; }
    body.mode-islands .brand__name { font-size: 19px; }
    /* phones: the logo plate already names the place, so the box under it keeps only the count and the hint */
    body.mode-islands .tracker .hud__kicker, body.mode-islands .tracker__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
    body.mode-islands .overlay { padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
    body.mode-islands *, body.mode-islands *::before, body.mode-islands *::after { animation: none !important; }
}

/* ---------- the island window as a dark cloud (replaces the square box above) ---------- */
body.mode-islands #ipanel {
    --cloud: #0f1814;
    width: min(500px, calc(100vw - 48px));
    max-height: none;
    overflow: visible;
    right: 34px;
    padding: 30px 38px 34px;
    background: var(--cloud);
    border: 0;
    border-radius: 64px 70px 58px 66px;
    font-size: 17px;
    filter: drop-shadow(0 14px 26px rgba(4, 18, 30, .45));
}
/* the puffs along the top and bottom edges are circles painted behind the content */
body.mode-islands #ipanel::before,
body.mode-islands #ipanel::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: var(--cloud);
    pointer-events: none;
}
body.mode-islands #ipanel::before {
    width: 120px; height: 120px; left: 46px; top: -52px;
    box-shadow: 104px -22px 0 22px var(--cloud), 232px 4px 0 2px var(--cloud), 330px 22px 0 -14px var(--cloud), -34px 52px 0 -22px var(--cloud);
}
body.mode-islands #ipanel::after {
    width: 100px; height: 100px; right: 54px; bottom: -40px;
    box-shadow: -112px 8px 0 6px var(--cloud), -236px 2px 0 -6px var(--cloud), -330px -8px 0 -22px var(--cloud), 44px -40px 0 -18px var(--cloud);
}
body.mode-islands .ipanel__in { max-height: calc(100vh - 240px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #2b3d33 transparent; }
body.mode-islands #ipanel .hud__kicker { font-size: 12.5px; }
body.mode-islands #ipanel h2 { font-size: 38px; margin: 6px 0 12px; }
body.mode-islands #ipanel p { font-size: 18px; margin-bottom: 20px; }
body.mode-islands #ipanel-items, body.mode-islands #ipanel-links { gap: 10px; margin-bottom: 14px; }
body.mode-islands #ipanel-items button, body.mode-islands #ipanel-links a {
    font-size: 17px; padding: 14px 18px; border-radius: 999px; white-space: nowrap; background: #060b09;
}
body.mode-islands #ipanel-items button { white-space: normal; }
body.mode-islands .ipanel__back { font-size: 15px; padding: 8px 6px; }

@media (max-width: 900px) {
    /* phones and small tablets: the cloud rises from the bottom edge */
    body.mode-islands #ipanel {
        right: 0; left: 0; width: 100%; max-height: none;
        padding: 22px 22px 18px; border-radius: 46px 52px 0 0;
    }
    body.mode-islands #ipanel::before { width: 96px; height: 96px; left: 30px; top: -38px; box-shadow: 86px -16px 0 14px var(--cloud), 190px 6px 0 -2px var(--cloud), 270px 20px 0 -16px var(--cloud); }
    body.mode-islands #ipanel::after { display: none; }
    body.mode-islands .ipanel__in { max-height: 46vh; }
    body.mode-islands #ipanel h2 { font-size: 27px; }
    body.mode-islands #ipanel p { font-size: 16px; margin-bottom: 14px; }
    body.mode-islands #ipanel-items button, body.mode-islands #ipanel-links a { font-size: 15.5px; padding: 12px 15px; }
}
@media (max-width: 420px) {
    /* narrow phones: phone number and e-mail take a full row each, the two chat links share one */
    body.mode-islands #ipanel-links a:nth-child(-n+2) { grid-column: 1 / -1; }
}
/* shorter screens (laptops): tighten the cloud so the long services list fits without scrolling */
@media (min-width: 901px) and (max-height: 960px) {
    body.mode-islands #ipanel { padding: 22px 36px 26px; }
    body.mode-islands .ipanel__in { max-height: calc(100vh - 200px); }
    body.mode-islands #ipanel h2 { font-size: 32px; margin: 2px 0 8px; }
    body.mode-islands #ipanel p { font-size: 16.5px; margin-bottom: 14px; }
    body.mode-islands #ipanel-items, body.mode-islands #ipanel-links { gap: 7px; margin-bottom: 8px; }
    body.mode-islands #ipanel-items button, body.mode-islands #ipanel-links a { font-size: 16px; padding: 10px 18px; }
}

/* Clouds are puffy on top and flat underneath: no puffs along the bottom edge of the island window. */
body.mode-islands #ipanel::after { display: none; }
body.mode-islands #ipanel { border-radius: 64px 70px 54px 54px; padding-bottom: 28px; }
@media (max-width: 900px) {
    body.mode-islands #ipanel { border-radius: 46px 52px 0 0; padding-bottom: 18px; }
}
