/*
 * Phones and small tablets.
 * Loaded after every skin (default, emerald, apple), so these rules win
 * without !important wars. Desktop is untouched unless a rule says so.
 */

/* ---------- Never scroll sideways ----------
   clip (not hidden) so position:sticky on the header keeps working. */
body { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }

/* The skip link sat at left:-999px. In Arabic (right-to-left) that pushed the
   page 999px wide. Hide it the direction-proof way instead. */
.skip {
	position: absolute; left: 8px; top: 8px; right: auto;
	clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap;
}
.skip:focus { clip-path: none; width: auto; height: auto; overflow: visible; left: 8px; }
[dir="rtl"] .skip, [dir="rtl"] .skip:focus { left: auto; right: 8px; }

/* No 300 ms tap delay, no double-tap zoom on controls. Pinch-zoom still works. */
a, button, label, summary, input, select, textarea, [role="button"] { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

/* ---------- Scope groups: collapsible, open by default ---------- */
.svc-group > summary { list-style: none; cursor: default; }
.svc-group > summary::-webkit-details-marker { display: none; }
.svc-group > summary .group-head { margin: 48px 0 14px; }
.svc-group:first-child > summary .group-head { margin-top: 0; }
.svc-group > summary .chev { display: none; }

/* ---------- The price wizard never overflows its card ---------- */
.wiz { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.wiz-main, .wiz-side { min-width: 0; }
.wiz .opts { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.wiz .scope-group .opts { grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
.wiz-side .sum-row > span:last-child { min-width: 0; overflow-wrap: anywhere; text-align: end; }

/* Scope group headings in the form become buttons on phones; plain text elsewhere. */
.sg-toggle { border: 0; background: none; color: inherit; font: inherit; padding: 0; text-align: start; cursor: default; display: inline-flex; align-items: baseline; gap: 10px; }
.sg-toggle .chev { display: none; }
.sg-count { font-size: .78rem; font-weight: 700; color: var(--green-deep, var(--orange-ink)); white-space: nowrap; }

/* Grids with a fixed minimum column width must still fit a 320px phone. */
.auth-grid { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }

/* iPads zoom into small fields as well, so any touch screen gets 16px fields. */
@media (pointer: coarse) {
	input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, .news input { font-size: 16px; }
}

/* Slider steppers (added by script) */
.rstep { display: flex; align-items: center; gap: 10px; }
.rstep input[type="range"] { flex: 1; min-width: 0; height: 44px; }
.rstep button {
	flex: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line);
	background: var(--card); color: var(--fg); font: 700 1.3rem/1 var(--f, inherit); cursor: pointer;
	display: grid; place-items: center;
}
.rstep button:active { transform: scale(.94); }

/* Phone fee bar on the price page (shown by script) */
.feebar { display: none; }

@media (max-width: 960px) {
	.wiz { grid-template-columns: minmax(0, 1fr); }
	/* The questions come first; the full summary follows them. */
	.wiz-side { order: 0; }
}

/* ---------- Off-canvas menu (it takes over below 980px) ---------- */
@media (max-width: 980px) {
	/* Menu: slides from the reading edge, can scroll if the list is long,
	   and is properly hidden (not just off-screen) when closed. */
	.nav {
		width: min(88vw, 360px); overflow-y: auto; overscroll-behavior: contain;
		padding-top: max(90px, calc(70px + env(safe-area-inset-top, 0px)));
		padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
		visibility: hidden; transition: transform .5s var(--spring, ease), visibility 0s linear .5s;
	}
	.nav.open { visibility: visible; transition: transform .5s var(--spring, ease), visibility 0s; }
	[dir="rtl"] .nav { inset: 0 auto 0 0; transform: translateX(-105%); box-shadow: 20px 0 60px rgba(0, 0, 0, .25); }
	[dir="rtl"] .nav.open { transform: none; }
	.nav a { min-height: 48px; display: flex; align-items: center; }

	.nav-scrim {
		position: fixed; inset: 0; z-index: 110; background: rgba(4, 10, 8, .5);
		opacity: 0; pointer-events: none; transition: opacity .35s;
	}
	.nav-scrim.on { opacity: 1; pointer-events: auto; }


	/* Sectioned phone menu. #pss-nav out-ranks the skins' big single-level type. */
	#pss-nav .menu > li > a { font-size: 1.35rem; font-weight: 700; padding: 12px 6px; letter-spacing: -.02em; }
	#pss-nav .sub-menu a { font-family: inherit; font-size: 1rem; font-weight: 600; letter-spacing: 0; padding: 10px 12px; }
	#pss-nav .sub-menu a::after, #pss-nav .menu > li > a::after { display: none; }
	#pss-nav .sub-menu a small { font-size: .8rem; font-weight: 500; color: var(--muted); }
	#pss-nav .current-menu-ancestor > a, #pss-nav .current-menu-parent > a { background: none; color: var(--green-deep, var(--orange-ink)); }
	#pss-nav .sub-menu .current-menu-item > a { background: var(--steel-2); color: var(--fg); }
	#pss-nav .sub-toggle { color: inherit; }
	/* emerald draws this menu dark */
	html[data-skin="emerald"] #pss-nav .menu > li { border-bottom-color: rgba(255, 255, 255, .12); }
	html[data-skin="emerald"] #pss-nav .sub-menu a { color: #D5E6DD; }
	html[data-skin="emerald"] #pss-nav .sub-menu a small { color: #8FA89C; }
	html[data-skin="emerald"] #pss-nav .sub-toggle { color: #fff; }
	html[data-skin="emerald"] #pss-nav .current-menu-ancestor > a, html[data-skin="emerald"] #pss-nav .current-menu-parent > a { color: var(--green-bright); }
	html[data-skin="emerald"] #pss-nav .sub-menu .current-menu-item > a { background: rgba(255, 255, 255, .08); color: #fff; }
	html[data-skin="emerald"] #pss-nav .sub-menu a:hover { background: rgba(255, 255, 255, .06); }
}

/* =====================================================================
   Phones
   ===================================================================== */
@media (max-width: 760px) {
	/* Respect the notch and the home indicator. */
	.site-header .wrap, .promobar .wrap, .site-footer .wrap {
		padding-left: max(18px, env(safe-area-inset-left, 0px));
		padding-right: max(18px, env(safe-area-inset-right, 0px));
	}
	.site-header .wrap { gap: 10px; padding-top: 10px; padding-bottom: 10px; }
	.h-actions { gap: 8px; }
	.h-actions > .btn { display: none; } /* the bottom bar already carries "Get a price" */

	/* iOS zooms into any field under 16px. Keep every field at 16px. */
	input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
	select, textarea, .news input { font-size: 16px; }

	/* Thumb-sized targets: 44px minimum. */
	.icon-btn, .langsw-btn { min-width: 44px; min-height: 44px; }
	.promobar-close { min-width: 44px; min-height: 44px; display: grid; place-items: center; margin-right: -10px; }
	.promocode { min-height: 40px; }
	.vat-toggle, .pick-all, .mini, .filters button, .bill-toggle button { min-height: 44px; }
	.pick-all { padding: 0 10px; }
	.site-footer a { display: inline-block; padding: 9px 0; }
	.site-footer p a, .site-footer small a, .legal-line a { padding: 0; display: inline; }
	.chips a, .tags a, .area-links a, .near a, .loc-list a, .scope-links a { display: inline-flex; align-items: center; min-height: 44px; }
	.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
	td > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
	.tdots button { position: relative; }
	.tdots button::before { content: ""; position: absolute; inset: -16px -8px; }

	/* Compact promo bar: one line, close button on the right. */
	.promobar { font-size: .84rem; }
	.promobar .wrap { padding-top: 4px; padding-bottom: 4px; }
	.promobar p { flex-wrap: nowrap; gap: 8px; min-width: 0; }
	.promobar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

	/* Header tucks away while you read, comes back as soon as you scroll up. */
	.site-header { transition: top .3s var(--ease, ease), padding .3s, border-color .3s; }
	.site-header.tuck { top: calc(-1 * var(--pss-hh, 72px)); }
	.site-header.tuck:has(:focus-visible) { top: 0; }

	/* Service rows: icon and title side by side, the text uses the full width. */
	.svc { grid-template-columns: 46px minmax(0, 1fr); gap: 6px 14px; padding: 18px 4px; }
	.svc .ico { width: 46px; height: 46px; }
	.svc h3 { align-self: center; font-size: 1.05rem; }
	.svc p, .svc .from { grid-column: 1 / -1; }
	.svc .from { display: flex; align-items: baseline; gap: 8px; text-align: start; }
	.svc .from small { display: inline; }
	.svc:hover { padding-left: 4px; }

	/* Scope groups fold on phones: tap a group to open it. */
	.svc-group > summary { cursor: pointer; }
	.svc-group > summary .group-head {
		margin: 0; padding: 16px 4px; min-height: 56px; display: flex; align-items: center; gap: 10px;
		border-bottom: 1px solid var(--line);
	}
	.svc-group > summary .chev {
		display: block; margin-inline-start: auto; width: 12px; height: 12px; flex: none;
		border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
		transform: rotate(45deg); transition: transform .3s var(--spring, ease);
	}
	.svc-group[open] > summary .chev { transform: rotate(-135deg); }
	.svc-group[open] > summary .group-head { border-bottom-color: transparent; }
	.svc-group .svc-list { border-top: 0; }

	/* Cards: less padding, and inline desktop padding gives way on a phone. */
	.card { padding: 22px 18px; }
	.card[style*="padding"] { padding: 22px 18px !important; }
	.calc { grid-template-columns: minmax(0, 1fr); gap: 16px; }
	.calc > div[style*="text-align:right"] { text-align: start !important; }
	.calc .out { font-size: 2rem; }
	.calc .btn { width: 100%; justify-content: center; }
	.range-row { gap: 10px; min-width: 0; }
	.range-row .rstep { flex: 1; min-width: 0; }
	.range-row output { min-width: 52px; }
	/* Grids that were fixed two-up stay readable. */
	.grid-2, .two-col, .cols-2 { grid-template-columns: minmax(0, 1fr) !important; }

	/* The wizard */
	.wiz { border-radius: var(--r-m, 18px); }
	.wiz-main, .wiz-side { padding: 22px 18px; }
	.scope-groups { max-height: none; overflow: visible; padding-right: 0; margin-right: 0; }
	.presets { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
	.presets::-webkit-scrollbar { display: none; }
	.preset { flex: none; scroll-snap-align: start; }
	.scope-group h3 { align-items: center; margin: 0; padding: 4px 0; border-bottom: 1px solid var(--line); }
	.sg-toggle {
		flex: 1; min-width: 0; min-height: 52px; display: flex; align-items: center; gap: 10px;
		border: 0; background: none; color: inherit; font: inherit; text-align: start; padding: 0; cursor: pointer;
	}
	.sg-count { font-size: .78rem; font-weight: 700; color: var(--green-deep, var(--orange-ink)); white-space: nowrap; }
	.sg-toggle .chev {
		margin-inline-start: auto; width: 10px; height: 10px; flex: none;
		border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
		transform: rotate(-135deg); transition: transform .3s var(--spring, ease); display: block;
	}
	.scope-group.fold .sg-toggle .chev { transform: rotate(45deg); }
	.scope-group.fold .opts { display: none; }
	.scope-groups.searching .scope-group.fold .opts { display: grid; }
	.scope-group { margin-bottom: 6px; }
	.scope-group .opts { margin-top: 12px; margin-bottom: 14px; }
	.wiz-nav { flex-wrap: wrap; }
	.wiz-nav .btn { flex: 1 1 auto; min-height: 50px; }
	.wiz-nav [data-back] { flex: 0 0 auto; }
	.side-actions { display: flex; flex-wrap: wrap; gap: 8px; }

	.feebar {
		display: flex; position: fixed; z-index: 61; align-items: center; gap: 10px;
		left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
		padding: 8px 8px 8px 16px; border-radius: 20px;
		background: rgba(7, 16, 12, .94); color: #fff;
		-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
		box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .55);
		transform: translateY(160%); transition: transform .4s var(--spring, ease);
	}
	.feebar.show { transform: none; }
	.feebar[hidden] { display: none; }
	.feebar .fb-sum { flex: 1; min-width: 0; border: 0; background: none; color: inherit; text-align: start; padding: 4px 0; cursor: pointer; line-height: 1.2; }
	.feebar .fb-total { display: block; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
	.feebar .fb-eta { display: block; font-size: .76rem; color: #9DB4AA; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.feebar .btn { flex: none; min-height: 48px; padding: 10px 20px; }
	body.has-feebar .actionbar { transform: translateY(160%); }
	.actionbar { transition: transform .4s var(--spring, ease); }
	body.kb-open .feebar, body.kb-open .actionbar, body.kb-open .fab { transform: translateY(160%); }

	/* Cookie notice sits above the bottom bar, never on top of it. */
	.cookie {
		left: 10px; right: 10px; max-width: none;
		bottom: calc(84px + env(safe-area-inset-bottom, 0px));
		padding: 16px; font-size: .88rem;
	}
	.cookie .btn { min-height: 44px; }

	/* Tables become stacked cards: one row per card, the label beside each value. */
	.ctable.stack thead, .entry-content table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
	.ctable.stack, .ctable.stack tbody, .ctable.stack tr, .ctable.stack td,
	.entry-content table.stack, .entry-content table.stack tbody, .entry-content table.stack tr, .entry-content table.stack td { display: block; width: 100%; }
	.ctable.stack tr, .entry-content table.stack tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 10px; background: var(--card); }
	.ctable.stack td, .entry-content table.stack td { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); text-align: end; }
	.ctable.stack td:last-child, .entry-content table.stack td:last-child { border-bottom: 0; }
	.ctable.stack td::before, .entry-content table.stack td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: start; flex: none; max-width: 50%; }
	.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

	/* Anything wide inside content scrolls inside itself, not the page. */
	.entry-content pre, .entry-content table:not(.stack) { display: block; max-width: 100%; overflow-x: auto; }
	img, svg, video, iframe { max-width: 100%; }
	img, video { height: auto; }

	/* Long words, references and emails wrap rather than push the page out. */
	h1, h2, h3, p, li, td, dd { overflow-wrap: break-word; }
	h1 { font-size: clamp(1.9rem, 8.4vw, 2.6rem); }

	/* Bigger slider thumbs. */
	input[type="range"] { height: 44px; }
	input[type="range"]::-webkit-slider-thumb { width: 28px; height: 28px; }
	input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; }
}

/* ---------- Phones held sideways ---------- */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 960px) {
	.actionbar a { flex-direction: row; min-height: 40px; padding: 6px 8px; }
	.actionbar { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
	body { padding-bottom: 60px; }
	.hero { min-height: 0; padding-top: 32px; padding-bottom: 32px; }
	.nav { padding-top: 64px; }
	.cookie { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
	.site-header .wrap { padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
	.site-header, .feebar, .actionbar, .nav, .svc-group > summary .chev { transition: none; }
}
@media print { .feebar, .nav-scrim, .rstep button { display: none !important; } }
