/* =====================================================================
   SOFT UI (2026-10-17) — loaded LAST on every page (just before </head>).
   Two parts:
     1. PHONE SKIN (≤700px): the look of Chamiz/new-mobile-ui (the
        reference shots): borderless cards on the cream paper, soft
        shadows, big radii, filled inputs, pill buttons, a greeting pill
        and round buttons up top, and a dark floating pill tab bar whose
        current tab opens into a cream pill with its name. The cream
        palette stays (the user's choice). Desktop is untouched.
        It works mostly through the Merpy tokens: on phones --edge (the
        2px ink outline) becomes a faint hairline, --hard / --hard-sm (the
        "0 4px 0 ink" shadows) become soft blurs, and --ink-sh (every
        hand-written "0 Npx 0 ink" shadow) turns off.
     2. SITE FOOTER (every width): laid out like apple.com's. Markup comes
        from gnav.js (footerHtml); on phones (≤833px, Apple's own break)
        each column heading opens and closes its list.
   ===================================================================== */

/* ---------- 1. PHONE SKIN ---------- */
@media (max-width: 700px) {
  /* :root:root beats ui-kit's `html[lang="th"]`; the dark one beats its
     `html[data-theme="dark"][lang="th"]`. */
  :root:root {
    --surface: #fffcf8;
    --surface-soft: #fbeee0;
    --fill: #f8eadb;
    --edge: rgba(43, 26, 18, 0.09);
    --ink-sh: transparent;
    --hard: 0 1px 2px rgba(43, 26, 18, 0.04), 0 12px 28px -16px rgba(43, 26, 18, 0.3);
    --hard-sm: 0 1px 2px rgba(43, 26, 18, 0.04), 0 6px 16px -10px rgba(43, 26, 18, 0.26);
    --dock: #2b1a12;
    --dock-on: #fff3e4;
    --radius-md: 18px;
    --radius-lg: 22px;
    --radius-xl: 26px;
    --ab-edge: rgba(43, 26, 18, 0.09);          /* about-mali.html's own copies */
    --ab-hard: 0 1px 2px rgba(43, 26, 18, 0.04), 0 12px 28px -16px rgba(43, 26, 18, 0.3);
  }
  :root:root[data-theme="dark"] {
    --surface: #241a14;
    --surface-soft: #2e2219;
    --fill: #2e231b;
    --edge: rgba(255, 228, 200, 0.08);
    --hard: 0 1px 0 rgba(255, 228, 200, 0.04) inset, 0 14px 30px -16px rgba(0, 0, 0, 0.85);
    --hard-sm: 0 1px 0 rgba(255, 228, 200, 0.04) inset, 0 8px 18px -10px rgba(0, 0, 0, 0.8);
    --dock: #0c0806;
    --dock-on: #fbeee0;
    --ab-edge: rgba(255, 228, 200, 0.08);
    --ab-hard: 0 14px 30px -16px rgba(0, 0, 0, 0.85);
  }

  /* ---- app bar: greeting pill + round buttons ---- */
  .bh-hello {
    padding: 4px 16px 4px 4px; border-radius: 999px; background: var(--surface);
    box-shadow: var(--hard-sm); max-width: 100%;
  }
  .bh-av { width: 40px; height: 40px; box-shadow: none; }
  .bh-av img { width: 36px; height: 36px; }
  .bh-title b { font-size: 16.5px; }
  .bh-left > .bh-title b { font-size: 18px; }
  .bh-back, html .bh button.bh-btn {
    width: 44px; height: 44px; border: 0 !important; background: var(--surface);
    box-shadow: var(--hard-sm) !important;
  }
  .bh.bh-scrolled { box-shadow: none; background: transparent; }
  /* the blur sits on its own layer: a backdrop-filter on .bh itself makes the
     header the containing block of its fixed ⋮ sheet, which then opened
     off-screen once the page was scrolled (2026-10-18) */
  .bh.bh-scrolled::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }

  /* ---- tab bar: dark floating pill (bottom-nav.js) ---- */
  html body .ms-bottomnav.ms-island {
    left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    height: 64px; padding: 0 8px; gap: 0; justify-content: space-between;
    background: var(--dock); border: 0; border-radius: 999px;
    box-shadow: 0 18px 40px -18px rgba(43, 26, 18, 0.7);
  }
  html[data-theme="dark"] body .ms-bottomnav.ms-island { box-shadow: 0 0 0 1px rgba(255, 228, 200, 0.08), 0 18px 40px -16px rgba(0, 0, 0, 0.9); }
  /* the four links and the ⋮ share one evenly spaced row */
  .ms-island .ms-bi-links { display: contents; }
  html body .ms-island .ms-bi-link {
    flex: none; display: flex; align-items: center; gap: 8px; height: 48px; min-width: 48px; padding: 0 12px;
    border-radius: 999px; color: var(--dock-on); font-size: 14px; font-weight: 800; letter-spacing: -0.01em;
    background: rgba(255, 255, 255, 0.07);
    transition: background 260ms cubic-bezier(.2, .8, .2, 1), padding 260ms cubic-bezier(.2, .8, .2, 1);
  }
  html body .ms-island .ms-bi-link::after { display: none; }
  .ms-island .ms-bi-ic { width: 24px; height: 24px; flex: none; display: grid; place-items: center; }
  .ms-island .ms-bi-ic img { width: 24px; height: 24px; display: block; }
  /* the Chamiz tile: cream on the dark bar, dark inside the cream pill */
  .ms-island .ms-bi-link:not(.is-on) .ms-bi-ic img[src*="favicon"] { content: url("/images/favicon-dark.svg?v=132"); }
  html[data-theme="dark"] .ms-island .ms-bi-link.is-on .ms-bi-ic img[src*="favicon"] { content: url("/images/favicon.svg?v=132"); }
  .ms-island .ms-bi-t { white-space: nowrap; overflow: hidden; max-width: 0; opacity: 0; transition: max-width 260ms cubic-bezier(.2, .8, .2, 1), opacity 200ms ease; }
  html body .ms-island .ms-bi-link:not(.is-on) { padding: 0; width: 48px; justify-content: center; gap: 0; }
  html body .ms-island .ms-bi-link.is-on { background: var(--dock-on); color: var(--dock); padding: 0 16px 0 12px; }
  .ms-island .ms-bi-link.is-on .ms-bi-t { max-width: 120px; opacity: 1; }
  .ms-island .ms-bi-link:active { transform: scale(0.94); }
  html body .ms-bottomnav.ms-island button.ms-bi-more {
    width: 48px; height: 48px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--dock-on);
  }
  html.bh-open body .ms-bottomnav.ms-island button.ms-bi-more { width: 72px; background: var(--dock-on); color: var(--dock); }
  html.bh-open .ms-island .ms-bi-link.is-on { padding: 0 12px; }
  html.bh-open .ms-island .ms-bi-link.is-on .ms-bi-t { max-width: 0; opacity: 0; }
  html.has-bottomnav body { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* ---- menu sheet: borderless, rounder ---- */
  .bh-drop, html.bh-open .bh-drop { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); left: 14px; right: 14px; }
  .bh-drop-in { border: 0; border-radius: 28px; box-shadow: 0 -10px 50px -18px rgba(43, 26, 18, 0.45); }
  .bh-mi { border-radius: 18px; }
  .bh-mi-ic { border-radius: 16px; }

  /* ---- app home blocks (the .ap kit) ---- */
  .ap-hero, .hm-home .hm-side.l {
    border: 0 !important; border-radius: 28px !important;
    box-shadow: 0 20px 36px -22px color-mix(in srgb, var(--accent) 85%, transparent) !important;
  }
  [data-app="bills"] .ap-hero { box-shadow: 0 20px 36px -22px rgba(214, 150, 0, 0.75) !important; }
  [data-app="trip"] .ap-hero { box-shadow: 0 20px 36px -22px rgba(40, 110, 230, 0.7) !important; }
  .ap-hero-btn { box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.35); }
  .ap-card, .ap-join, .ap-list a, .ap-meet, .hm-today-card {
    border: 0 !important; border-radius: 24px; box-shadow: var(--hard) !important; background: var(--surface);
  }
  .ap-card:active, .ap-list a:active, .ap-meet:active, .ap a:active { transform: scale(0.98); box-shadow: var(--hard-sm) !important; }
  .ap-card-art, .ap-li-ic, .ap-join-ic, .ap-quick span { border: 0 !important; border-radius: 18px; box-shadow: none !important; }
  .ap-quick a:active span { transform: scale(0.94); }
  .ap-card::after {
    content: "→"; top: 14px; right: 14px; width: 30px; height: 30px; display: grid; place-items: center;
    border-radius: 50%; background: var(--text); color: var(--bg); font-size: 14px;
  }
  .ap-list i, .ap-meet i {
    width: 36px; height: 36px; border: 0 !important; border-radius: 50%;
    background: var(--text); color: var(--bg); font-size: 20px;
  }
  .ap-btn { border: 0 !important; border-radius: 999px; box-shadow: none !important; }
  .ap-btn.ghost { background: var(--fill); }
  .ap-head h2 { font-size: 19px; }
  .ap-head > a { color: var(--text) !important; text-decoration: underline; text-underline-offset: 3px; }

  /* ---- buttons: pills ---- */
  html body :is(.btn, .btn-primary, .btn-secondary, .hero-btn, .np-btn, .secondary-btn, .login-submit, .login-secondary,
    .dashboard-primary-btn, .dashboard-secondary-btn, .profile-logout, .cz-jump, .share-btn):not(.bh *):not(.ms-bottomnav *) {
    border-radius: 999px;
  }
  html body :is(.np-btn:not(.primary), .btn-secondary, .hero-btn.secondary, .secondary-btn, .login-secondary,
    .dashboard-secondary-btn, .profile-logout, .cz-jump):not(.bh *) {
    border: 0 !important; background: var(--fill); color: var(--text);
  }

  /* ---- inputs: filled, no outline until focus ---- */
  html body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]), select, textarea):not(.bh *) {
    background-color: var(--fill) !important; border-color: transparent !important; box-shadow: none !important;
    border-radius: 16px;
  }
  html body :is(input, select, textarea):not(.bh *):focus {
    border-color: var(--accent) !important; background-color: var(--surface) !important;
    box-shadow: 0 0 0 4px var(--accent-soft) !important; outline: none;
  }
  html body input:is([type="checkbox"], [type="radio"]) { accent-color: var(--accent); }

  /* ---- page boxes that draw their own outline with the edge token:
          let the soft shadow carry them ---- */
  html body :is(.np-card, .acc-card, .np-stat, .card, .panel, .cc-card, .seo-faq details, .seo-howto, .seo-links a) {
    border-color: transparent !important;
  }
  .seo-faq details, .seo-howto { box-shadow: var(--hard) !important; border-radius: 22px; }
  .seo-links a { background: var(--surface); box-shadow: var(--hard-sm); }

  /* ---- the footer shows on phones again (ui-kit hid every footer) ---- */
  html body footer.cz-foot { display: block !important; }
}

/* ---------- 2. SITE FOOTER (apple.com layout, every width) ---------- */
footer.cz-foot {
  --foot-bg: #f8e9d6;
  --foot-text: var(--muted);
  --foot-link: color-mix(in srgb, var(--text) 80%, var(--muted));
  --foot-line: rgba(43, 26, 18, 0.14);
  display: block; position: relative; margin: 0 !important; padding: 0 !important; width: auto; max-width: none;
  background: var(--foot-bg) !important; color: var(--foot-text); border: 0 !important; box-shadow: none !important;
  font-family: var(--font-body); font-size: 12px; line-height: 1.34; letter-spacing: -0.01em; text-align: left;
}
html[data-theme="dark"] footer.cz-foot { --foot-bg: #110c09; --foot-line: rgba(255, 228, 200, 0.12); }
footer.cz-foot * { box-sizing: border-box; }
footer.cz-foot a { color: var(--foot-link) !important; text-decoration: none; font-weight: 400; }
footer.cz-foot a:hover { color: var(--text) !important; text-decoration: underline; }
.cz-foot-in { width: min(980px, 100% - 44px); margin: 0 auto; padding: 17px 0 21px; }
.cz-foot-note { padding-bottom: 17px; border-bottom: 1px solid var(--foot-line); }
html body .cz-foot-note p { margin: 0 0 8px; font-size: 12px; line-height: 1.34; color: var(--foot-text); max-width: none; }
.cz-foot-note p:last-child { margin-bottom: 0; }

.cz-foot-dir { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 30px; padding: 20px 0 6px; }
.cz-foot-sec + .cz-foot-sec { margin-top: 24px; }
html body h3.cz-foot-h { margin: 0 0 10px; padding: 0; font-size: 12px; font-weight: 600; line-height: 1.34; letter-spacing: -0.01em; color: var(--text); text-transform: none; }
html body .cz-foot-h button {
  all: unset; display: block; width: 100%; cursor: default; font: inherit; color: inherit;
  box-shadow: none !important; border: 0 !important; background: none !important;
}
.cz-foot-chev { display: none; }
.cz-foot-list { list-style: none; margin: 0; padding: 0; }
.cz-foot-list li { margin: 0 0 10px; line-height: 1.34; }

.cz-foot-more { margin: 0 !important; padding: 18px 0 11px; border-bottom: 1px solid var(--foot-line); font-size: 12px; color: var(--foot-text); }
html body .cz-foot-more a { color: var(--accent) !important; text-decoration: underline; text-underline-offset: 2px; }

.cz-foot-legal { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 30px; padding-top: 10px; }
.cz-foot-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 30px; }
.cz-foot-copy > span { color: var(--foot-text); }
.cz-foot-links { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.cz-foot-links li { margin: 0; padding: 0 9px; border-left: 1px solid var(--foot-line); line-height: 1; }
.cz-foot-links li:first-child { padding-left: 0; border-left: 0; }
.cz-foot-lang { display: flex; flex: none; }
html body .cz-foot-lang button {
  all: unset; cursor: pointer; padding: 0 9px; font: inherit; line-height: 1; color: var(--foot-link);
  border-left: 1px solid var(--foot-line); box-shadow: none !important;
}
html body .cz-foot-lang button:first-child { border-left: 0; }
html body .cz-foot-lang button:last-child { padding-right: 0; }
.cz-foot-lang button:hover { color: var(--text); text-decoration: underline; }
.cz-foot-lang button[aria-current="true"] { color: var(--text); font-weight: 600; }
.cz-foot-lang button:focus-visible, .cz-foot-h button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* the big CHAMIZ wordmark, kept from the old footer: the last line, edge to edge */
html body p.cz-foot-word {
  margin: 34px 0 -0.06em !important; padding: 0; max-width: none;
  font-family: "Inter", "SukhumvitSet", sans-serif !important; font-weight: 900 !important;
  font-size: clamp(60px, 21.5vw, 250px); line-height: 0.8; letter-spacing: -0.055em !important;
  color: var(--text); white-space: nowrap; text-align: left; user-select: none; overflow: hidden;
}
html body p.cz-foot-word span { color: var(--accent); font-weight: inherit; }

@media (max-width: 1068px) {
  .cz-foot-dir { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 24px; }
}
/* phones: the columns become tap-to-open sections, as on apple.com */
@media (max-width: 833px) {
  .cz-foot-in { width: auto; padding: 17px 16px 21px; }
  .cz-foot-dir { display: block; padding: 4px 0 0; }
  .cz-foot-sec + .cz-foot-sec { margin-top: 0; }
  .cz-foot-sec { border-bottom: 1px solid var(--foot-line); }
  html body h3.cz-foot-h { margin: 0; font-size: 13px; font-weight: 400; color: var(--foot-link); }
  html body .cz-foot-h button { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .cz-foot-chev { display: block; width: 16px; height: 16px; flex: none; color: var(--foot-text); transition: transform 240ms cubic-bezier(.2, .8, .2, 1); }
  .cz-foot-h button[aria-expanded="true"] { color: var(--text); }
  .cz-foot-h button[aria-expanded="true"] .cz-foot-chev { transform: rotate(180deg); }
  .cz-foot-list { display: none; padding: 2px 0 14px 14px; }
  .cz-foot-sec:has(.cz-foot-h button[aria-expanded="true"]) .cz-foot-list { display: block; }
  .cz-foot-list li { margin-bottom: 0; }
  .cz-foot-list a { display: block; padding: 7px 0; font-size: 13px; }
  .cz-foot-more { padding-top: 16px; border-bottom: 0; }
  .cz-foot-legal { flex-direction: column; gap: 10px; padding-top: 0; }
  .cz-foot-copy { flex-direction: column; gap: 8px; }
  .cz-foot-copy > span { order: 2; }
  .cz-foot-links { order: 1; row-gap: 8px; }
}

/* page stylesheets style h3 / span / li / svg in their own ways; the footer
   keeps Apple's type whatever page it lands on */
html body footer.cz-foot :is(p, span, li, a, button, ul) { font-family: var(--font-body); letter-spacing: -0.01em; text-transform: none; }
html body footer.cz-foot .cz-foot-copy > span { font-weight: 400 !important; font-size: 12px; }
html body footer.cz-foot li { list-style: none; background: none; }
html body footer.cz-foot li::before, html body footer.cz-foot li::after { content: none; }
html body footer.cz-foot .cz-foot-chev { transform: none; }
@media (max-width: 833px) {
  html body footer.cz-foot h3.cz-foot-h, html body footer.cz-foot .cz-foot-h button { font-weight: 400 !important; }
  html body footer.cz-foot .cz-foot-h button[aria-expanded="true"] { font-weight: 600 !important; }
  html body footer.cz-foot .cz-foot-h button[aria-expanded="true"] .cz-foot-chev { transform: rotate(180deg) !important; }
}
/* Merpy makes every <ul> a 14px-gap grid */
html body footer.cz-foot ul.cz-foot-list { display: block; gap: 0; }
html body footer.cz-foot ul.cz-foot-links { display: flex; gap: 0; }
html body footer.cz-foot .cz-foot-list li { line-height: 1.34; }
@media (max-width: 833px) {
  html body footer.cz-foot ul.cz-foot-list { display: none; }
  html body footer.cz-foot .cz-foot-sec:has(.cz-foot-h button[aria-expanded="true"]) ul.cz-foot-list { display: block; }
}
