/* ESW Site Essentials: front-end styles (all scoped to .esw-se-*). */

/* Reading time line */
.esw-se-meta { font-size: .9em; opacity: .8; margin: 0 0 1.2em; }

/* Share button: sized to its text, centered, follows the theme's text color */
.esw-se-share-wrap { display: flex; justify-content: center; margin: 1.5em 0; }
.esw-se-share-wrap.is-before { margin-top: 0; }
.esw-se-share-wrap.is-shortcode { display: inline-flex; margin: .5em 0; }
.esw-se-share-wrap.is-align-left { justify-content: flex-start; }
.esw-se-share-wrap.is-align-right { justify-content: flex-end; }
.esw-se-share-wrap.has-color .esw-se-share-btn { color: var(--esw-se-share); border-color: var(--esw-se-share); }
.esw-se-share-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px; padding: 8px 20px; margin: 0;
	font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.2; color: inherit;
	background: transparent; border: 1px solid currentColor; border-radius: 999px; cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.esw-se-share-btn:hover { background: rgba(127, 127, 127, .12); }
.esw-se-share-btn:focus-visible, .esw-se-top:focus-visible, .esw-se-yt-btn:focus-visible,
.esw-se-sheet button:focus-visible, .esw-se-sheet input:focus-visible { outline: 2px solid #2c5f8a; outline-offset: 2px; }

/* Share window: bottom sheet on phones, centered dialog on larger screens */
html.esw-se-lock, html.esw-se-lock body { overflow: hidden; }
.esw-se-sheet-host {
	--se-bg: #ffffff; --se-text: #1b1c1e; --se-muted: #585b61; --se-border: #c9c6bd; --se-acc: #2c5f8a; --se-on-acc: #ffffff; --se-soft: #f5f4f0;
	position: fixed; inset: 0; z-index: 999999; display: flex; align-items: flex-end; justify-content: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.5;
}
.esw-se-sheet-host.is-dark { --se-bg: #1b1e22; --se-text: #ecebe7; --se-muted: #a9acb1; --se-border: #4a5058; --se-acc: #8fbbe3; --se-on-acc: #0f1419; --se-soft: #121416; }
.esw-se-sheet-host *, .esw-se-sheet-host *::before, .esw-se-sheet-host *::after { box-sizing: border-box; }
.esw-se-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.esw-se-sheet {
	position: relative; width: 100%; max-width: 560px; max-height: calc(100% - 24px); overflow-y: auto;
	background: var(--se-bg); color: var(--se-text); border: 1px solid var(--se-border); border-bottom: 0;
	border-radius: 20px 20px 0 0; padding: 20px 16px calc(12px + env(safe-area-inset-bottom, 0px)); text-align: center;
	animation: esw-se-up .2s ease-out;
}
@media (min-width: 700px) {
	.esw-se-sheet-host { align-items: center; padding: 24px; }
	.esw-se-sheet { border-bottom: 1px solid var(--se-border); border-radius: 20px; max-width: 440px; animation: esw-se-fade .15s ease-out; }
}
@keyframes esw-se-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes esw-se-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .esw-se-sheet { animation: none; } }
.esw-se-sheet-t { margin: 0 0 2px; font-size: 1.3rem; line-height: 1.25; font-weight: 700; color: var(--se-text); font-family: inherit; }
.esw-se-sheet-page { margin: 0 0 12px; color: var(--se-muted); font-size: .95rem; overflow-wrap: anywhere; }
.esw-se-qr { display: inline-block; width: min(240px, 70vw); padding: 12px; background: #fff; border: 1px solid var(--se-border); border-radius: 16px; line-height: 0; }
.esw-se-qr svg { display: block; width: 100%; height: auto; }
.esw-se-small { margin: 10px 0 10px; color: var(--se-muted); font-size: .9rem; }
.esw-se-url {
	display: block; width: 100%; min-height: 44px; margin: 0 0 12px; padding: 8px 12px;
	font: inherit; font-size: 16px; color: var(--se-text); background: var(--se-soft);
	border: 1px solid var(--se-border); border-radius: 12px; text-align: center; text-overflow: ellipsis;
}
.esw-se-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.esw-se-btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 22px;
	font: inherit; font-weight: 700; color: var(--se-text); background: transparent;
	border: 1px solid var(--se-border); border-radius: 999px; cursor: pointer;
}
.esw-se-btn.is-primary { background: var(--se-acc); color: var(--se-on-acc); border-color: var(--se-acc); }
.esw-se-btn.is-done { background: transparent; color: var(--se-text); border-color: var(--se-acc); }
.esw-se-center { display: flex; justify-content: center; margin-top: 12px; }
/* Round "−" close: two-bar drawing, centered, 44px tap area */
.esw-se-close { position: relative; width: 44px; height: 44px; padding: 0; background: transparent; border: 0; cursor: pointer; }
.esw-se-minus { position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border: 1.5px solid var(--se-text); border-radius: 50%; }
.esw-se-minus::before { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; background: var(--se-text); border-radius: 2px; }

/* Back to top */
.esw-se-top {
	position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 9990;
	display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0;
	color: #1b1c1e; background: rgba(255, 255, 255, .94); border: 1px solid #8c8f94; border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15); cursor: pointer;
}
.esw-se-top.is-right { right: calc(16px + env(safe-area-inset-right, 0px)); }
.esw-se-top.is-left { left: calc(16px + env(safe-area-inset-left, 0px)); }
.esw-se-top[hidden] { display: none; }
@media (prefers-color-scheme: dark) { html:not([data-tr-theme="light"]) .esw-se-top { color: #ecebe7; background: rgba(27, 30, 34, .94); border-color: #6b7078; } }
html[data-tr-theme="dark"] .esw-se-top { color: #ecebe7; background: rgba(27, 30, 34, .94); border-color: #6b7078; }
/* Focus ring for the back to top button on dark pages (the dark blue ring is hard to see there). */
@media (prefers-color-scheme: dark) { html:not([data-tr-theme="light"]) .esw-se-top:focus-visible { outline-color: #9cc3e6; } }
html[data-tr-theme="dark"] .esw-se-top:focus-visible { outline-color: #9cc3e6; }

/* Private YouTube box */
.esw-se-yt { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #1b1c1e center / cover no-repeat; border-radius: 12px; overflow: hidden; }
.esw-se-yt-btn {
	position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
	width: 100%; height: 100%; padding: 16px; margin: 0; border: 0; cursor: pointer;
	color: #fff; background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .55)); font: inherit; text-align: center;
}
.esw-se-yt:not(.has-thumb) .esw-se-yt-btn { background: #1b1c1e; }
.esw-se-yt-btn:hover .esw-se-yt-play path:first-child { fill: #f00; fill-opacity: 1; }
.esw-se-yt-title { font-weight: 700; font-size: 1rem; line-height: 1.3; max-width: 90%; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.esw-se-yt-note { font-size: .8rem; opacity: .85; }
.esw-se-yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@supports not (aspect-ratio: 16 / 9) { .esw-se-yt { height: 0; padding-bottom: 56.25%; } }
/* Inside the block editor's responsive embed wrapper (which already reserves the 16:9 space) */
.wp-has-aspect-ratio .wp-block-embed__wrapper > .esw-se-yt { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; padding: 0; }
