/* ECL Core home-screen app. Everything app-only is scoped to html.ecl-app,
 * which is set only when ECL runs from the home screen. Browser tabs are unchanged
 * except for the install invitation. */

.ecl-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- App mode: layout ---------------------------------------------- */
html.ecl-app {
	--ecl-appbar-h: 52px;
	--ecl-tabbar-h: 60px;
	--ecl-safe-top: env(safe-area-inset-top, 0px);
	--ecl-safe-bottom: env(safe-area-inset-bottom, 0px);
	overscroll-behavior-y: none;
	-webkit-tap-highlight-color: transparent;
}
html.ecl-app body {
	padding-top: calc(var(--ecl-appbar-h) + var(--ecl-safe-top));
	padding-bottom: calc(var(--ecl-tabbar-h) + var(--ecl-safe-bottom));
	padding-left: env(safe-area-inset-left, 0px);
	padding-right: env(safe-area-inset-right, 0px);
}
/* The site header and its menu are replaced by the app bar and tab bar in app mode. */
html.ecl-app .ecl-header { display: none !important; }
html.ecl-sheet-open body { overflow: hidden; }

/* ---- Top bar --------------------------------------------------------- */
.ecl-appbar {
	position: fixed; top: 0; left: 0; right: 0; z-index: 99995;
	background: #FFFFFF; color: #1C2321;
	padding-top: var(--ecl-safe-top);
	border-bottom: 1px solid #DEDBD3;
}
.ecl-appbar__row {
	height: var(--ecl-appbar-h);
	display: flex; align-items: center; gap: 4px;
	padding: 0 calc(6px + env(safe-area-inset-right, 0px)) 0 calc(6px + env(safe-area-inset-left, 0px));
}
.ecl-appbar__title {
	flex: 1; text-align: center; color: #1C2321; text-decoration: none;
	font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: 19px; line-height: 1;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ecl-appbar__btn, .ecl-appbar__spacer {
	flex: 0 0 44px; width: 44px; height: 44px;
}
.ecl-appbar__btn {
	display: inline-flex; align-items: center; justify-content: center;
	border: 0; border-radius: 8px; background: transparent; color: #1C2321; padding: 0; cursor: pointer;
}
.ecl-appbar__btn:active { background: #F4F2EC; }
.ecl-appbar__btn:focus-visible, .ecl-tab:focus-visible, .ecl-sheet a:focus-visible, .ecl-sheet button:focus-visible, .ecl-sheet input:focus-visible, .ecl-invite button:focus-visible {
	outline: 2px solid #1F4A47; outline-offset: 2px;
}

/* ---- Bottom tabs ----------------------------------------------------- */
.ecl-tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 99995;
	display: flex; background: #FFFFFF; border-top: 1px solid #DEDBD3;
	padding-bottom: var(--ecl-safe-bottom);
	padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.ecl-tab {
	flex: 1; height: var(--ecl-tabbar-h); min-width: 48px;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
	border: 0; background: transparent; padding: 0; margin: 0; cursor: pointer;
	color: #5A625F; text-decoration: none;
	font: 600 11.5px/1 "Libre Franklin", system-ui, -apple-system, sans-serif; letter-spacing: .01em;
}
.ecl-tab[aria-current="page"], .ecl-tab[data-current="1"], .ecl-tab[aria-expanded="true"] { color: #1F4A47; }
.ecl-tab[aria-current="page"] svg, .ecl-tab[data-current="1"] svg { stroke-width: 2.3; }
.ecl-tab:active { background: #F4F2EC; }

/* ---- More sheet ------------------------------------------------------ */
.ecl-sheet[hidden] { display: none; }
.ecl-sheet { position: fixed; inset: 0; z-index: 99998; }
.ecl-sheet__scrim { position: absolute; inset: 0; background: rgba(28, 35, 33, .45); }
.ecl-sheet__panel {
	position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto;
	background: #FFFFFF; border-radius: 16px 16px 0 0;
	padding: 8px 20px calc(24px + var(--ecl-safe-bottom));
	animation: ecl-sheet-up .2s ease-out;
}
@keyframes ecl-sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.ecl-sheet__panel:focus { outline: none; }
.ecl-sheet__head { display: flex; align-items: center; justify-content: space-between; }
.ecl-sheet__head h2 { margin: 0; font: 600 13px/1 "Libre Franklin", system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: #5A625F; }
.ecl-sheet__search label { display: block; font: 600 15px/1.4 "Libre Franklin", system-ui, sans-serif; color: #1C2321; margin: 8px 0; }
.ecl-sheet__search div { display: flex; gap: 8px; }
.ecl-sheet__search input {
	flex: 1; min-width: 0; height: 48px; padding: 0 14px; font-size: 17px;
	border: 1px solid #C9C5BA; border-radius: 6px; background: #fff; color: #1C2321;
}
.ecl-sheet__search button {
	height: 48px; padding: 0 18px; border: 0; border-radius: 6px;
	background: #1F4A47; color: #FFFFFF; font: 600 16px "Libre Franklin", system-ui, sans-serif;
}
.ecl-sheet__links { list-style: none; margin: 20px 0 0; padding: 0; }
.ecl-sheet__links li { border-top: 1px solid #DEDBD3; }
.ecl-sheet__links a {
	display: flex; align-items: center; min-height: 52px;
	color: #1C2321; text-decoration: none; font-family: "Newsreader", Georgia, serif; font-size: 21px;
}

/* ---- Pull to refresh -------------------------------------------------- */
.ecl-ptr {
	position: fixed; left: 50%; top: calc(var(--ecl-appbar-h) + var(--ecl-safe-top) - 40px); z-index: 99994;
	width: 40px; height: 40px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: #FFFFFF; color: #1F4A47; box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
	transform: translate(-50%, 0); opacity: 0; pointer-events: none;
	transition: opacity .15s;
}
html:not(.ecl-app) .ecl-ptr { display: none; }
.ecl-ptr.is-ready { color: #FFFFFF; background: #1F4A47; }
.ecl-ptr.is-loading svg { animation: ecl-spin .8s linear infinite; }
@keyframes ecl-spin { to { transform: rotate(360deg); } }

/* ---- Install invitation (browser only) ------------------------------- */
.ecl-invite {
	position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 99990;
	display: flex; gap: 12px; align-items: flex-start;
	max-width: 520px; margin: 0 auto; padding: 14px;
	background: #FFFFFF; color: #1C2321; border: 1px solid #DEDBD3; border-radius: 12px;
	box-shadow: 0 6px 24px rgba(28, 35, 33, .18);
	font: 15px/1.4 "Libre Franklin", system-ui, -apple-system, sans-serif;
	transform: translateY(16px); opacity: 0; transition: transform .25s ease-out, opacity .25s ease-out;
}
.ecl-invite.is-in { transform: none; opacity: 1; }
.ecl-invite img { flex: 0 0 44px; border-radius: 10px; border: 1px solid #DEDBD3; }
.ecl-invite p { margin: 0 0 4px; color: #3B4341; }
.ecl-invite .ecl-invite__title { font-weight: 600; color: #1C2321; }
.ecl-invite { padding-right: 44px; max-height: calc(100vh - 24px); overflow-y: auto; }
.ecl-invite__how { background: #F4F2EC; border-radius: 6px; padding: 8px 10px 8px 6px; margin: 8px 0 0; color: #1C2321; }
.ecl-invite__how[hidden] { display: none; }
.ecl-invite__how ol { margin: 0; padding-left: 22px; }
.ecl-invite__how li { margin: 2px 0; }
.ecl-invite__hint { color: #5A625F; }
.ecl-invite__close {
	position: absolute; top: 4px; right: 4px; width: 44px; height: 44px;
	display: inline-flex; align-items: center; justify-content: center;
	border: 0; border-radius: 8px; background: transparent; color: #5A625F; cursor: pointer; padding: 0;
}
.ecl-invite__close svg { width: 20px; height: 20px; }
.ecl-invite__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ecl-invite__actions button {
	min-height: 44px; padding: 0 16px; border-radius: 6px; cursor: pointer;
	font: 600 15px "Libre Franklin", system-ui, sans-serif;
}
.ecl-invite__go { background: #1F4A47; color: #FFFFFF; border: 0; }
.ecl-invite__later, .ecl-invite__see { background: transparent; color: #1C2321; border: 1px solid #C9C5BA; }
.ecl-invite__see { border-color: #1F4A47; color: #1F4A47; }
.ecl-invite__added {
	display: inline-flex; align-items: center; min-height: 44px; margin-top: 2px; padding: 0 2px;
	border: 0; background: transparent; color: #5A625F; cursor: pointer;
	font: 14px/1.3 "Libre Franklin", system-ui, sans-serif; text-decoration: underline; text-underline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.ecl-sheet__panel, .ecl-invite, .ecl-ptr { animation: none !important; transition: none !important; }
	.ecl-ptr.is-loading svg { animation-duration: 2s; }
}
@media print {
	.ecl-appbar, .ecl-tabbar, .ecl-invite, .ecl-ptr, .ecl-sheet { display: none !important; }
	html.ecl-app body { padding: 0; }
}
