/* ==========================================================================
   Abode & Bloom — Theme UI layer
   Dark palette + theme toggle + subtle, reduced-motion-aware animations.
   Loaded site-wide. Layers on top of homepage.css WITHOUT changing the
   approved light-mode layout or spacing.
   ========================================================================== */

:root { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* Smooth in-page scrolling (disabled for reduced-motion below). */
html { scroll-behavior: smooth; }

/* --------------------------------------------------------------------------
   1) DARK PALETTE
   The homepage design consumes CSS variables that homepage.css declares on
   .ab-home. We override those variables (higher specificity) in dark mode,
   plus add two surface tokens for elements that were hard-coded white.
   -------------------------------------------------------------------------- */
html[data-theme="dark"] .ab-home {
	--ink:            #E9EEE7;
	--moss:           #8FBF9A;
	--fern:           #A9C49A;
	--sage:           #7E9A81;
	--sage-soft:      #1E2A22;
	--canvas:         #0E1512;
	--cream:          #151E19;
	--marigold:       #E6B457;
	--marigold-deep:  #F0C36B;
	--muted:          #9DB0A3;
	--line:           rgba(255,255,255,.10);
	--line-strong:    rgba(255,255,255,.17);
	--surface:        #18211C;
	--surface-2:      #202B24;
	--shadow-sm: 0 1px 2px rgba(0,0,0,.45), 0 2px 10px rgba(0,0,0,.38);
	--shadow-md: 0 12px 36px rgba(0,0,0,.55);
}

/* Elements that used a literal #fff — re-home them onto the dark surface. */
html[data-theme="dark"] .ab-home .story,
html[data-theme="dark"] .ab-home .story-sec,
html[data-theme="dark"] .ab-home .chip,
html[data-theme="dark"] .ab-home .news-form input,
html[data-theme="dark"] .ab-home .pillars .tag {
	background: var(--surface);
	border-color: var(--line);
}
html[data-theme="dark"] .ab-home .btn--ghost:hover { background: var(--surface-2); }

/* Primary solid button: keep an accessible bright green with dark text. */
html[data-theme="dark"] .ab-home .btn--solid { background: #2FA36B; color: #08120C; }
html[data-theme="dark"] .ab-home .btn--solid:hover { background: #37B778; }

/* Trending band stays a dark surface (its own --moss would otherwise lighten). */
html[data-theme="dark"] .ab-home .trend-band { background: var(--surface-2); }
html[data-theme="dark"] .ab-home .trend-band .eyebrow { color: var(--fern); }
html[data-theme="dark"] .ab-home .trend-card { background: rgba(255,255,255,.05); border-color: var(--line); }
html[data-theme="dark"] .ab-home .trend-card:hover { background: rgba(255,255,255,.10); }

/* Dim the gradient FALLBACK tiles only (never real images). */
html[data-theme="dark"] .ab-home .ph:not(.has-img) { filter: brightness(.82) saturate(.9); }

/* --------------------------------------------------------------------------
   2) GLOBAL PALETTE TOKENS + document chrome
   Tokens live on :root so the header, footer and body theme correctly. The
   homepage/single content (.ab-home) carries its own copies (see homepage.css)
   which are overridden for dark mode in section 1 above.
   -------------------------------------------------------------------------- */
:root {
	--ink:#1B2A21; --moss:#34553F; --fern:#5B7F5C; --sage:#9CB18C; --sage-soft:#E7EDE0;
	--canvas:#F4F6F1; --cream:#FBFAF6; --marigold:#E2A23B; --marigold-deep:#C9871F;
	--muted:#6B7166; --line:#E2E6DC; --line-strong:#D2D8C8;
	--f-display:"Fraunces",Georgia,serif; --f-body:"DM Sans",system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
html[data-theme="dark"] {
	--ink:#E9EEE7; --moss:#8FBF9A; --fern:#A9C49A; --sage:#7E9A81; --sage-soft:#1E2A22;
	--canvas:#0E1512; --cream:#151E19; --marigold:#E6B457; --marigold-deep:#F0C36B;
	--muted:#9DB0A3; --line:rgba(255,255,255,.10); --line-strong:rgba(255,255,255,.17);
}
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--f-body); }
#content { background: var(--canvas); padding: 0; width: 100%; max-width: none; }
@media (prefers-reduced-motion: no-preference) { body { transition: background-color .3s ease, color .3s ease; } }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: #fff; color: #1B2A21; padding: 8px 14px; border-radius: 8px; }

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
.ab-head { position: sticky; top: 0; z-index: 60; background: rgba(251,250,246,.92); backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--line); }
html[data-theme="dark"] .ab-head { background: rgba(18,25,21,.92); }
.ab-head-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; min-height: 64px; display: flex; align-items: center; gap: 16px; }
.ab-brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; font-family: var(--f-display); font-weight: 600; font-size: 20px; color: var(--ink); text-decoration: none; }
.ab-brand .amp, .ab-brand span em { color: var(--fern); font-style: italic; }
.ab-brand .brand-mark { width: 34px; height: 34px; flex: none; }
.ab-brand-logo img { max-height: 40px; width: auto; height: auto; display: block; }
.ab-nav { display: none; }
@media (min-width: 900px) { .ab-nav { display: block; } }
.ab-nav .ab-menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.ab-nav .ab-menu a { display: inline-flex; align-items: center; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; transition: background-color .15s ease, color .15s ease; }
.ab-nav .ab-menu a:hover, .ab-nav .ab-menu .current-menu-item > a { background: var(--sage-soft); color: var(--moss); }

/* Dropdown sub-menus (desktop) — !important guards against theme/plugin overrides */
.ab-nav .ab-menu, .ab-nav .ab-menu li { position: relative; }
.ab-nav .ab-menu .menu-item-has-children > a::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-1px); opacity: .55; }
.ab-nav .sub-menu {
	position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
	min-width: 210px; margin: 0; padding: 8px; list-style: none;
	display: none !important; flex-direction: column; gap: 2px;
	background: var(--cream); border: 1px solid var(--line); border-radius: 14px;
	box-shadow: 0 18px 40px rgba(27,42,33,.14);
}
.ab-nav .menu-item-has-children:hover > .sub-menu,
.ab-nav .menu-item-has-children:focus-within > .sub-menu { display: flex !important; }
.ab-nav .sub-menu li { position: relative; }
.ab-nav .sub-menu a { display: block; white-space: nowrap; padding: 9px 12px; font-size: 14.5px; border-radius: 9px; }
.ab-nav .sub-menu .menu-item-has-children > a::after { transform: rotate(-45deg); margin-left: auto; }
.ab-nav .sub-menu .sub-menu { top: -9px; left: calc(100% + 6px); }

/* Dropdown submenus */
.ab-nav .ab-menu > li { position: relative; }
.ab-nav .menu-item-has-children > a::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-1px); opacity: .55; }
.ab-nav .sub-menu {
	position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
	min-width: 210px; list-style: none; margin: 0; padding: 8px;
	background: var(--cream); border: 1px solid var(--line); border-radius: 14px;
	box-shadow: 0 14px 34px rgba(27,42,33,.14);
	display: block; opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.ab-nav .menu-item-has-children:hover > .sub-menu,
.ab-nav .menu-item-has-children:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.ab-nav .sub-menu li { display: block; }
.ab-nav .sub-menu a { display: block; white-space: nowrap; padding: 9px 12px; border-radius: 9px; font-size: 14.5px; font-weight: 500; }
.ab-nav .sub-menu a:hover { background: var(--sage-soft); color: var(--moss); }
/* Parent items get a caret */
.ab-nav .ab-menu .menu-item-has-children > a { gap: 5px; }
.ab-nav .ab-menu .menu-item-has-children > a::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-1px); opacity: .6; }
/* Dropdown sub-menus (hidden until hover / keyboard focus) */
.ab-nav .ab-menu li { position: relative; }
.ab-nav .ab-menu .sub-menu {
	position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
	min-width: 210px; margin: 0; padding: 8px; list-style: none;
	background: var(--cream); border: 1px solid var(--line); border-radius: 12px;
	box-shadow: 0 14px 34px rgba(27,42,33,.14);
	opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.ab-nav .ab-menu li:hover > .sub-menu,
.ab-nav .ab-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.ab-nav .ab-menu .sub-menu li { position: relative; }
.ab-nav .ab-menu .sub-menu a { display: block; padding: 9px 12px; border-radius: 8px; white-space: nowrap; font-size: 14.5px; }
.ab-nav .ab-menu .sub-menu a::after { display: none; }
.ab-nav .ab-menu .sub-menu .sub-menu { top: -8px; left: 100%; }
.ab-cta { display: none; align-items: center; padding: 11px 18px; border-radius: 999px; background: var(--marigold); color: #3a2a06; font-weight: 600; font-size: 14px; text-decoration: none; transition: background-color .2s ease, color .2s ease, transform .18s ease; }
@media (min-width: 900px) { .ab-cta { display: inline-flex; } }
.ab-cta:hover { background: var(--marigold-deep); color: #fff; transform: translateY(-1px); }
.ab-burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; margin-left: auto; border: 1px solid var(--line-strong); border-radius: 11px; background: transparent; cursor: pointer; }
@media (min-width: 900px) { .ab-burger { display: none; margin-left: 0; } }
.ab-burger span { display: block; width: 20px; height: 2px; margin: 0 auto; background: var(--ink); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.ab-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ab-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.ab-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.ab-mobile-nav { border-top: 1px solid var(--line); background: var(--cream); padding: 10px 16px 18px; }
@media (min-width: 900px) { .ab-mobile-nav { display: none !important; } }
.ab-mobile-nav .ab-menu { list-style: none; margin: 0; padding: 0; }
.ab-mobile-nav .ab-menu a { display: block; padding: 12px 8px; font-weight: 600; font-size: 16px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.ab-mobile-nav .ab-menu a:hover { color: var(--moss); }
.ab-mobile-nav .sub-menu { list-style: none; margin: 0; padding: 0 0 0 16px; }
.ab-mobile-nav .sub-menu a { font-size: 15px; font-weight: 500; color: var(--muted); }
.ab-mobile-nav .menu-item-has-children > a::after { content: ""; }
.ab-mobile-nav .ab-cta { display: inline-flex; margin-top: 14px; }

/* --------------------------------------------------------------------------
   3) THEME TOGGLE BUTTON
   Injected into the primary menu (falls back to a fixed control if no menu).
   -------------------------------------------------------------------------- */
.ab-theme-toggle {
	--tg: 40px;
	display: inline-flex; align-items: center; justify-content: center;
	width: var(--tg); height: var(--tg);
	margin: 0; padding: 0; cursor: pointer;
	background: transparent;
	border: 1px solid rgba(120,130,115,.35);
	border-radius: 50%;
	color: currentColor;
	line-height: 0;
	transition: background-color .2s ease, border-color .2s ease, transform .2s ease, color .2s ease;
	-webkit-tap-highlight-color: transparent;
}
.ab-theme-toggle:hover { background: rgba(120,130,115,.14); transform: translateY(-1px); }
.ab-theme-toggle:active { transform: translateY(0); }
.ab-theme-toggle svg { width: 19px; height: 19px; display: block; transition: transform .35s ease, opacity .25s ease; }
.ab-theme-toggle .ab-icon-sun { display: none; }
html[data-theme="dark"] .ab-theme-toggle .ab-icon-moon { display: none; }
html[data-theme="dark"] .ab-theme-toggle .ab-icon-sun  { display: block; }
html[data-theme="dark"] .ab-theme-toggle { border-color: rgba(255,255,255,.22); }

/* Toggle sitting inside the primary nav as a menu item. */

/* --------------------------------------------------------------------------
   4) SUBTLE ANIMATIONS  (only when the user hasn't asked to reduce motion)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {

	/* Smooth theme colour transition on toggle (curated set, not global). */
	.ab-home .story,
	.ab-home .story-sec,
	.ab-home .showcase,
	.ab-home .news,
	.ab-home .trend-band,
	.ab-home .trend-card,
	.ab-home .chip,
	.ab-home .news-form input,
	.ab-home .tag,
	.ab-home .btn,
	.ab-home .card h3 {
		transition-property: background-color, color, border-color, box-shadow, transform;
		transition-duration: .3s;
		transition-timing-function: ease;
	}

	/* Card & story hover lift + image zoom. */
	.ab-home .card .ph img,
	.ab-home .trend-card .ph img,
	.ab-home .story-lead .ph img { transition: transform .55s cubic-bezier(.2,.6,.2,1); will-change: transform; }
	.ab-home .card:hover .ph img,
	.ab-home .trend-card:hover .ph img,
	.ab-home .story-lead:hover .ph img { transform: scale(1.05); }

	.ab-home .story { transition: transform .25s ease, box-shadow .25s ease, background-color .3s ease; }
	.ab-home .story:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
	.ab-home .card { transition: transform .2s ease; }
	.ab-home .card:hover { transform: translateY(-2px); }
	.ab-home .mr-item { transition: background-color .2s ease; border-radius: 12px; }
	.ab-home .mr-item:hover { background: color-mix(in srgb, var(--sage-soft) 55%, transparent); }

	/* Section reveal-on-scroll (JS adds .reveal, then .in when visible). */
	.ab-home .section.reveal { opacity: 0; transform: translateY(16px); }
	.ab-home .section.reveal.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.6,.2,1); }

	/* Toggle icon spin on theme change. */
	html[data-theme="dark"] .ab-theme-toggle .ab-icon-sun { animation: ab-pop .4s ease; }
	@keyframes ab-pop { from { transform: rotate(-90deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Respect reduced-motion everywhere. */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.ab-home .section.reveal { opacity: 1 !important; transform: none !important; }
}

/* Keep focus rings crisp in both themes. */
html[data-theme="dark"] .ab-home :focus-visible { outline-color: var(--marigold); }

/* ==========================================================================
   SITE FOOTER (custom, dynamic).
   ========================================================================== */

.ab-site-footer { background: #141E18; color: #B9C7BC; font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.ab-site-footer a { color: #B9C7BC; text-decoration: none; transition: color .15s ease; }
.ab-site-footer a:hover { color: #fff; }
.ab-foot-inner { max-width: 1180px; margin: 0 auto; padding: 54px 20px 0; }
.ab-foot-cols { display: grid; grid-template-columns: 1fr; gap: 32px; padding-bottom: 38px; }
@media (min-width: 700px) { .ab-foot-cols { grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: 40px; } }
.ab-foot-name { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 22px; color: #fff; display: block; }
.ab-foot-about { margin: 12px 0 18px; font-size: 14px; line-height: 1.65; max-width: 40ch; color: #9DB0A3; }
.ab-foot-social { display: flex; gap: 10px; }
.ab-foot-social a { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #C6D2C7; transition: background-color .2s ease, border-color .2s ease, transform .2s ease, color .2s ease; }
.ab-foot-social a:hover { background: rgba(255,255,255,.10); border-color: transparent; transform: translateY(-2px); color: #fff; }
.ab-foot-social svg { width: 18px; height: 18px; }
.ab-foot-col h4 { color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 16px; }
.ab-foot-menu { list-style: none; margin: 0; padding: 0; }
.ab-foot-menu li { margin-bottom: 10px; }
.ab-foot-menu a { font-size: 14.5px; }
.ab-foot-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 20px 0; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.ab-foot-copy { font-size: 13px; color: #8A9588; margin: 0; }
.ab-foot-legal { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; }
.ab-foot-legal a { font-size: 13px; }
html[data-theme="dark"] .ab-site-footer { background: #0D140F; }
@media (prefers-reduced-motion: no-preference) {
	.ab-foot-menu a, .ab-foot-legal a { transition: color .15s ease, padding-left .15s ease; }
	.ab-foot-menu a:hover { padding-left: 3px; }
}

/* Footer logo + widget columns */
.ab-foot-logo img { max-height: 46px; width: auto; height: auto; }
.ab-foot-col .widget { margin: 0; }
.ab-foot-col ul { list-style: none; margin: 0; padding: 0; }
.ab-foot-col li { margin-bottom: 10px; }
.ab-foot-col a { font-size: 14.5px; }
.ab-foot-col select { max-width: 100%; }

/* Responsive safeguards (mobile-first) */
img { max-width: 100%; height: auto; }
.ab-home, .ab-single { overflow-wrap: break-word; }
