/* AISC mobile layer — applies below 768px only */
:root { --aisc-nav-h: 64px; --aisc-accent: #c8553d; }

@media (max-width: 767.98px) {
	html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
	body { padding-bottom: calc(var(--aisc-nav-h) + env(safe-area-inset-bottom)); overflow-x: hidden; }

	/* Reading comfort */
	.entry-content, .cs-entry__content { font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; hyphens: auto; }
	.entry-content p, .entry-content li { margin-bottom: 1em; }
	.cs-entry__title, h1.cs-entry__title { font-size: clamp(1.7rem, 7.2vw, 2.1rem) !important; line-height: 1.15; text-wrap: balance; }
	.entry-content h2 { font-size: 1.45rem; line-height: 1.22; margin-top: 2.2rem; text-wrap: balance; }
	.entry-content h3 { font-size: 1.2rem; line-height: 1.28; margin-top: 1.6rem; }
	.cs-container { padding-left: 16px; padding-right: 16px; }
	.entry-content img, .entry-content video, .entry-content figure { max-width: 100%; height: auto; }
	.entry-content pre, .entry-content code { white-space: pre-wrap; overflow-wrap: anywhere; }
	.entry-content iframe { max-width: 100%; }
	.entry-content ul, .entry-content ol { padding-left: 1.25em; }

	/* Tables: scroll sideways inside a card, sticky first column */
	.aisc-table-wrap { position: relative; margin: 1.4em -16px; padding: 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
	.aisc-table-wrap table { min-width: 560px; width: max-content; max-width: none; margin: 0; font-size: 15px; line-height: 1.4; border-collapse: separate; border-spacing: 0; }
	.aisc-table-wrap th, .aisc-table-wrap td { padding: 10px 12px; vertical-align: top; min-width: 110px; }
	.aisc-table-wrap th:first-child, .aisc-table-wrap td:first-child { position: sticky; left: 0; z-index: 1; background: var(--cs-layout-background, #f0ede6); min-width: 120px; box-shadow: 1px 0 0 rgba(0,0,0,.12); }
	.aisc-table-hint { display: block; margin: -.6em 0 1em; font-size: 12px; opacity: .6; }
	.aisc-table-wrap.is-scrolled + .aisc-table-hint, .aisc-table-wrap.is-scrolled-end + .aisc-table-hint { display: none; }

	/* Touch targets */
	.entry-content a { text-underline-offset: 3px; }
	.cs-footer a, .cs-offcanvas__nav a { display: inline-block; min-height: 44px; line-height: 44px; }
	button, .wp-block-button__link, input[type=submit], .button { min-height: 44px; }

	/* Forms & calculators: 16px inputs stop iOS zoom, full-width controls */
	input[type=text], input[type=search], input[type=email], input[type=number], input[type=tel], input[type=url], select, textarea { font-size: 16px !important; min-height: 48px; width: 100%; border-radius: 10px; }
	label { display: block; font-weight: 600; margin-bottom: 6px; }

	.cs-sidebar__area, .cs-sidebar__inner { margin-top: 2rem; }

	/* Bottom navigation */
	.aisc-bottomnav { position: fixed; z-index: 9990; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--aisc-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--cs-header-background, #fff); border-top: 1px solid rgba(0,0,0,.1); box-shadow: 0 -4px 18px rgba(0,0,0,.06); transition: transform .25s ease; }
	.aisc-bottomnav.is-hidden { transform: translateY(110%); }
	.aisc-bottomnav a, .aisc-bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: var(--aisc-nav-h); font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1; color: inherit; background: none; border: 0; text-decoration: none; opacity: .72; padding: 0; -webkit-tap-highlight-color: transparent; }
	.aisc-bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
	.aisc-bottomnav [aria-current=page] { opacity: 1; color: var(--aisc-accent); }

	/* "On this page" */
	.aisc-toc { margin: 1.2rem 0 1.6rem; border: 1px solid rgba(0,0,0,.14); border-radius: 12px; background: rgba(255,255,255,.5); }
	.aisc-toc summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; font-weight: 700; cursor: pointer; list-style: none; }
	.aisc-toc summary::-webkit-details-marker { display: none; }
	.aisc-toc summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
	.aisc-toc[open] summary::after { transform: rotate(-135deg); }
	.aisc-toc ol { margin: 0; padding: 0 16px 10px; list-style: none; max-height: 52vh; overflow-y: auto; counter-reset: t; }
	.aisc-toc li { margin: 0; counter-increment: t; border-top: 1px solid rgba(0,0,0,.08); }
	.aisc-toc a, .entry-content .aisc-toc a { font-weight: 500 !important; border: 0 !important; background: none !important; text-decoration: none !important; display: block; padding: 11px 0; font-size: 15px; line-height: 1.3; text-decoration: none; }
	.aisc-toc a::before { content: counter(t) ". "; opacity: .5; }

	/* Reading progress; theme back-to-top lifted above the nav */
	.cs-scroll-top { bottom: calc(var(--aisc-nav-h) + 14px + env(safe-area-inset-bottom)) !important; }
	.aisc-progress { position: fixed; z-index: 9995; top: 0; left: 0; height: 3px; width: 100%; transform: scaleX(0); transform-origin: 0 50%; background: var(--aisc-accent); }

	/* Cookie notice → compact sheet that clears the nav */
	#fupi_cookie_notice { max-height: 46vh; overflow-y: auto; bottom: calc(var(--aisc-nav-h) + env(safe-area-inset-bottom)) !important; padding: 14px 16px !important; border-radius: 16px 16px 0 0; }
	#fupi_cookie_notice, #fupi_cookie_notice p, #fupi_cookie_notice div { font-size: 14px; line-height: 1.4; }
	#fupi_cookie_notice button { min-height: 44px; font-size: 14px; }
}

@media (max-width: 767.98px) and (prefers-color-scheme: dark) {
	.aisc-table-wrap th:first-child, .aisc-table-wrap td:first-child { background: var(--cs-layout-background, #161616); box-shadow: 1px 0 0 rgba(255,255,255,.15); }
	.aisc-toc { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.16); }
	.aisc-toc li { border-color: rgba(255,255,255,.1); }
	.aisc-bottomnav { border-color: rgba(255,255,255,.12); }
	.aisc-bottomnav [aria-current=page] { color: #ff9a82; }
}
