/* ==========================================================================
   ATO public website — Mobile app shell (v1.2.0)
   Loads after the ato-corporate theme's style.css. Desktop (>980px) untouched.
   Pairs with site-mobile.js, which builds the menu sheet, the bottom tab bar
   and the footer accordions from the theme's existing markup.
   ========================================================================== */

:root {
	--s-head-h: 60px;
	--s-tab-h: 62px;
	--s-safe-t: env(safe-area-inset-top, 0px);
	--s-safe-b: env(safe-area-inset-bottom, 0px);
	--s-safe-l: env(safe-area-inset-left, 0px);
	--s-safe-r: env(safe-area-inset-right, 0px);
	--s-ease: cubic-bezier(.32, .72, 0, 1);
	--s-g-bg: #f2f4f3;
	--s-sep: rgba(11, 31, 23, .1);
}
.ato-tabbar, .ato-sheet, .ato-head-call { display: none; }

@media (max-width: 980px) {

	/* ---------- Global touch polish ---------- */
	/* overflow-x:hidden on html+body (theme) silently breaks position:sticky; clip doesn't */
	html, body { overflow-x: clip !important; }
	body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
	a, button, label, summary, select { touch-action: manipulation; }
	input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { font-size: 16px !important; }
	body.ato-lock { overflow: hidden; position: fixed; left: 0; right: 0; width: 100%; }

	/* ---------- Header (app bar) ---------- */
	.utility-bar { display: none; }               /* its contents move into the menu sheet */
	.site-header {
		-webkit-backdrop-filter: none !important; backdrop-filter: none !important; /* would trap fixed children */
		background: #fff;
		border-bottom: 1px solid transparent;
		padding-top: var(--s-safe-t);
		transition: top .3s var(--s-ease), box-shadow .2s, border-color .2s;
	}
	.site-header.is-scrolled { border-bottom-color: var(--ato-line); box-shadow: 0 1px 12px rgba(1, 38, 27, .07); }
	body.ato-hide-head .site-header { top: calc(-1 * (var(--s-head-h) + var(--s-safe-t) + 2px)) !important; }
	.site-header .wrap {
		min-height: var(--s-head-h); gap: 8px;
		padding-left: calc(16px + var(--s-safe-l)); padding-right: calc(10px + var(--s-safe-r));
	}
	.site-branding img, .site-branding .custom-logo { max-height: 36px; width: auto; }
	.site-branding .brand-mark { font-size: 1.15rem; }
	.site-header .main-nav { display: none !important; } /* replaced by the menu sheet */
	.header-social { display: none !important; }
	.header-cta { gap: 2px; }
	.ato-head-call, .nav-toggle {
		display: inline-grid !important; place-items: center;
		width: 44px; height: 44px; border: 0 !important; border-radius: 12px; background: transparent;
		color: var(--ato-800); padding: 0;
	}
	.ato-head-call svg { width: 21px; height: 21px; }
	.ato-head-call:active, .nav-toggle:active { background: rgba(2, 68, 48, .08); }

	/* ---------- Bottom tab bar (footer menu) ---------- */
	.ato-tabbar {
		display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
		height: calc(var(--s-tab-h) + var(--s-safe-b));
		padding: 0 var(--s-safe-r) var(--s-safe-b) var(--s-safe-l);
		background: rgba(255, 255, 255, .94);
		-webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
		border-top: .5px solid var(--s-sep);
		box-shadow: 0 -2px 16px rgba(1, 38, 27, .06);
		transition: transform .3s var(--s-ease);
	}
	.ato-tab {
		position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
		min-width: 0; padding: 6px 2px 5px; border: 0; background: none; cursor: pointer;
		color: var(--ato-muted) !important; font: 700 .66rem/1.1 var(--ato-font); letter-spacing: .01em;
		text-decoration: none !important;
	}
	.ato-tab span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.ato-tab svg { width: 24px; height: 24px; transition: transform .18s var(--s-ease); }
	.ato-tab::before {
		content: ""; position: absolute; top: 6px; left: 50%; width: 54px; height: 30px; border-radius: 16px; z-index: -1;
		background: rgba(6, 214, 160, .16); opacity: 0; transform: translateX(-50%) scale(.6);
		transition: opacity .2s, transform .25s var(--s-ease);
	}
	.ato-tab.is-active { color: var(--ato-800) !important; }
	.ato-tab.is-active::before { opacity: 1; transform: translateX(-50%) scale(1); }
	.ato-tab.is-active svg { fill: currentColor; fill-opacity: .14; }
	.ato-tab:active svg { transform: scale(.86); }
	/* Centre "Book" action */
	.ato-tab-cta { color: var(--ato-800) !important; }
	.ato-tab-cta::before { display: none; }
	.ato-tab-cta i {
		display: grid; place-items: center; width: 46px; height: 46px; margin-top: -20px; border-radius: 50%;
		background: var(--ato-yellow); color: var(--ato-950);
		box-shadow: 0 6px 16px rgba(1, 38, 27, .22), 0 0 0 4px #fff;
	}
	.ato-tab-cta i svg { width: 22px; height: 22px; }

	body.ato-has-tabbar { padding-bottom: calc(var(--s-tab-h) + var(--s-safe-b)); }
	.back-to-top { bottom: calc(var(--s-tab-h) + var(--s-safe-b) + 14px) !important; right: calc(14px + var(--s-safe-r)) !important; width: 42px !important; height: 42px !important; }
	body.ato-sheet-open .back-to-top { opacity: 0 !important; visibility: hidden !important; }

	/* ---------- Menu sheet (native grouped list) ---------- */
	.ato-sheet {
		display: block; position: fixed; left: 0; right: 0; top: 0;
		bottom: calc(var(--s-tab-h) + var(--s-safe-b));
		z-index: 99; background: var(--s-g-bg); color: var(--ato-ink);
		overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
		opacity: 0; visibility: hidden; transform: translateY(16px);
		transition: opacity .22s ease, transform .32s var(--s-ease), visibility 0s linear .32s;
	}
	.ato-sheet, .ato-sheet * { box-sizing: border-box; }
	body.ato-sheet-open .ato-sheet { opacity: 1; visibility: visible; transform: none; transition: opacity .22s ease, transform .32s var(--s-ease); }
	body.admin-bar .ato-sheet { top: 46px; }

	.ato-sheet-bar {
		position: sticky; top: 0; z-index: 2;
		height: calc(48px + var(--s-safe-t)); padding: var(--s-safe-t) 8px 0 16px;
		display: flex; align-items: center; justify-content: space-between;
		background: rgba(242, 244, 243, .85);
		-webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
		border-bottom: .5px solid transparent; transition: border-color .2s;
	}
	.ato-sheet-bar b { font: 800 1rem var(--ato-font-head); opacity: 0; transition: opacity .2s; }
	.ato-sheet.is-scrolled .ato-sheet-bar { border-bottom-color: var(--s-sep); }
	.ato-sheet.is-scrolled .ato-sheet-bar b { opacity: 1; }
	.ato-sheet-x {
		width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(11, 31, 23, .08);
		color: var(--ato-ink); display: grid; place-items: center; cursor: pointer; padding: 0;
	}
	.ato-sheet-x svg { width: 15px; height: 15px; }

	.ato-sheet-in { padding: 0 calc(16px + var(--s-safe-r)) 30px calc(16px + var(--s-safe-l)); max-width: 640px; margin: 0 auto; }
	.ato-sheet-title { margin: -2px 4px 18px; font: 800 2.05rem/1.1 var(--ato-font-head); letter-spacing: -.02em; color: var(--ato-ink); }

	.ato-g { margin-bottom: 26px; }
	.ato-g-title { padding: 0 16px 7px; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ato-muted); }
	.ato-card { background: #fff; border-radius: 14px; overflow: hidden; }

	.ato-row {
		position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
		min-height: 50px; padding: 0 14px 0 16px; border: 0; background: none; cursor: pointer;
		color: var(--ato-ink) !important; text-decoration: none !important; font: 400 1.02rem var(--ato-font); text-align: left;
	}
	.ato-card > * + *::before, .ato-sub > * + *::before {
		content: ""; position: absolute; top: 0; right: 0; left: 60px; height: .5px; background: var(--s-sep);
	}
	.ato-card > .ato-acc + *::before { left: 60px; }
	.ato-acc { position: relative; }
	.ato-row:active { background: #e6ebe9; }
	.ato-ic {
		flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
		background: var(--c, var(--ato-700)); color: #fff;
	}
	.ato-ic svg { width: 18px; height: 18px; }
	.ato-lbl { flex: 1; min-width: 0; padding: 14px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.ato-lbl small { display: block; color: var(--ato-muted); font-size: .8rem; margin-top: 1px; white-space: normal; }
	.ato-chev { flex: none; width: 8px; height: 13px; color: #b5c0bb; transition: transform .25s var(--s-ease); }
	.ato-check { display: none; flex: none; width: 18px; height: 18px; color: var(--ato-700); }
	.ato-row.is-current .ato-lbl { font-weight: 700; color: var(--ato-800); }
	.ato-row.is-current > .ato-check { display: block; }
	.ato-row.is-current > .ato-chev { display: none; }

	/* Expandable sub-menus */
	.ato-acc > .ato-row .ato-chev { transform: rotate(90deg); }
	.ato-acc.is-open > .ato-row .ato-chev { transform: rotate(-90deg); }
	.ato-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--s-ease); background: #fafcfb; }
	.ato-sub > div { overflow: hidden; }
	.ato-acc.is-open .ato-sub { grid-template-rows: 1fr; }
	.ato-sub .ato-row { padding-left: 60px; min-height: 46px; font-size: .96rem; }
	.ato-sub .ato-row + .ato-row::before { content: ""; position: absolute; top: 0; right: 0; left: 60px; height: .5px; background: var(--s-sep); }

	/* Buttons */
	.ato-cta { display: grid; gap: 10px; margin-bottom: 26px; }
	.ato-btn {
		display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 14px;
		font: 800 1rem var(--ato-font-head); text-decoration: none !important;
	}
	.ato-btn-primary { background: var(--ato-800); color: #fff !important; }
	.ato-btn-light { background: #fff; color: var(--ato-800) !important; }
	.ato-btn:active { transform: scale(.985); }

	.ato-social { display: flex; justify-content: center; gap: 14px; margin: 6px 0 14px; }
	.ato-social a { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--ato-800) !important; }
	.ato-social svg { width: 18px; height: 18px; }
	.ato-sheet-foot { text-align: center; font-size: .76rem; color: var(--ato-muted); margin: 0; }

	/* ---------- Page footer: native sections ---------- */
	.site-footer { padding-bottom: 6px; }
	.footer-top { display: block !important; padding-top: 34px !important; padding-bottom: 10px !important; }
	.footer-top > div:first-child { text-align: center; margin-bottom: 22px; }
	.footer-top > div:first-child p { max-width: 34ch; margin-left: auto; margin-right: auto; }
	.footer-logo { display: flex; justify-content: center; }
	.footer-social { justify-content: center; }
	.footer-social a { width: 44px !important; height: 44px !important; }

	.ato-fsec { border-top: 1px solid rgba(255, 255, 255, .09); }
	.ato-fsec:last-of-type { border-bottom: 1px solid rgba(255, 255, 255, .09); }
	.site-footer .ato-fsec h4 {
		display: flex; align-items: center; justify-content: space-between; margin: 0 !important; padding: 0 !important;
		min-height: 54px; cursor: pointer; font-size: 1rem; user-select: none; -webkit-user-select: none;
	}
	.site-footer .ato-fsec h4::after { display: none; }
	.ato-fsec h4 svg { width: 14px; height: 14px; color: rgba(255, 255, 255, .55); transition: transform .25s var(--s-ease); }
	.ato-fsec.is-open h4 svg { transform: rotate(180deg); }
	.ato-fbody { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--s-ease); }
	.ato-fbody > div { overflow: hidden; }
	.ato-fsec.is-open .ato-fbody { grid-template-rows: 1fr; }
	.ato-fbody ul { padding-bottom: 12px !important; }
	.site-footer .ato-fbody li { padding: 0; }
	.site-footer .ato-fbody li > a, .site-footer .ato-fbody li > span { display: flex; align-items: center; gap: 10px; min-height: 44px; }
	.newsletter-form { display: flex; gap: 8px; padding: 6px 0 18px; }
	.newsletter-form input[type="email"] { flex: 1; min-width: 0; min-height: 48px; border-radius: 12px; }
	.newsletter-form button { min-height: 48px; border-radius: 12px; padding: 0 18px; }

	.footer-bottom { text-align: center; padding: 18px 0 20px !important; }
	.footer-bottom .wrap { flex-direction: column; align-items: center; gap: 10px; }
	.footer-bottom nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; order: -1; }
	.footer-bottom nav a { margin: 0 !important; padding: 8px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); }
}

@media (max-width: 600px) {
	/* WP admin bar scrolls away on phones, so the header sticks to the very top */
	.admin-bar .site-header { top: 0 !important; }
	body.admin-bar .ato-sheet { top: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.ato-sheet, .site-header, .ato-tab svg, .ato-tab::before, .ato-sub, .ato-fbody, .ato-chev { transition: none !important; }
}
