/* ============================================================================
   LLMIC — Base layer
   Typography, surfaces, links, buttons, frosted chrome, focus, dark mode.
   Overrides Newspack only where it earns its place. Content is the hero.
   ========================================================================== */

/* Newspack forces the root font-size to 20px, which inflates our entire
   rem-based type + spacing scale by ~25%. Reset it to the browser default so
   our scale renders at its intended sizes (and so we respect the visitor's own
   browser font-size preference — better accessibility). */
html {
	font-size: 100% !important; /* 16px default, user-overridable */
	scroll-behavior: smooth;
	scroll-padding-top: 5rem; /* clears the sticky header on anchor jumps */
}

body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: var(--step-0);
	line-height: var(--leading-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	transition: background var(--dur-base) var(--ease-out),
		color var(--dur-base) var(--ease-out);
}

::selection { background: var(--selection); }
.llmic-logo__dark { display: none; }
[data-theme="dark"] .llmic-logo__light { display: none; }
[data-theme="dark"] .llmic-logo__dark { display: block; }

/* --- Headings: tight, confident, optical tracking ----------------------- */
h1, h2, h3, h4, h5, h6,
.entry-title,
.entry-title a {
	font-family: var(--font-display);
	color: var(--ink);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-tight);
	font-weight: var(--llmic-weight-semibold);
	text-wrap: balance;
}

/* --- Links: deferential until touched ----------------------------------- */
a {
	color: var(--accent-strong);
	text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
	transition: color var(--dur-fast) var(--ease-out),
		text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

/* --- Focus: visible, calm, never suppressed ----------------------------- */
:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: var(--radius-s);
}

/* --- Frosted, deferential header chrome --------------------------------- */
.site-header {
	background: var(--surface-glass);
	-webkit-backdrop-filter: saturate(180%) blur(var(--chrome-blur));
	backdrop-filter: saturate(180%) blur(var(--chrome-blur));
	border-bottom: 1px solid var(--line);
	transition: background var(--dur-base) var(--ease-out),
		border-color var(--dur-base) var(--ease-out),
		box-shadow var(--dur-base) var(--ease-out);
}
/* Subtle depth once the reader scrolls (class toggled by enhancements.js). */
.site-header.is-scrolled { box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 7%, transparent); }

/* --- Primary navigation — refined, with an animated underline ----------- */
.main-menu > li > a,
.main-navigation .main-menu > li > a {
	position: relative;
	font-weight: 600;
	color: var(--ink);
	transition: color var(--dur-fast) var(--ease-out);
}
.main-menu > li > a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -0.25em;
	height: 2px;
	border-radius: 2px;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: center;
	transition: transform var(--dur-base) var(--ease-out);
}
.main-menu > li > a:hover::after,
.main-menu > li.current-menu-item > a::after,
.main-menu > li.current_page_item > a::after,
.main-menu > li.current-menu-ancestor > a::after { transform: scaleX(1); }
.main-menu > li > a:hover { color: var(--accent-strong); }
.main-menu > li.current-menu-item > a { color: var(--accent-strong); }

/* "Download" promoted to a brand button (class added by enhancements.js). */
.main-menu a.llmic-nav-cta {
	background: linear-gradient(140deg, var(--accent), var(--brand-600));
	color: #fff !important;
	padding: 0.5em 1.15em;
	border-radius: var(--radius-pill);
	box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 36%, transparent);
	transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}
.main-menu a.llmic-nav-cta::after { display: none !important; }
.main-menu a.llmic-nav-cta:hover { color: #fff !important; transform: translateY(-1px); filter: brightness(1.06); }

/* --- Dropdown submenu — a clean frosted card (overrides Newspack's dark) -- */
.main-menu .sub-menu {
	background: var(--surface-1);
	-webkit-backdrop-filter: saturate(180%) blur(var(--chrome-blur));
	backdrop-filter: saturate(180%) blur(var(--chrome-blur));
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	box-shadow: var(--shadow-2);
	padding: var(--space-2xs);
	min-width: 18rem;
	list-style: none;
	margin: 0;
}
.main-menu .sub-menu li { list-style: none; margin: 0; }
.main-menu .sub-menu li::marker { content: ""; }
.main-menu > li > .sub-menu { padding-top: var(--space-2xs); }
.main-menu .sub-menu::before { display: none !important; } /* drop Newspack's dark arrow */
.main-menu .sub-menu a {
	background: transparent !important;
	color: var(--ink) !important;
	font-weight: 500;
	line-height: var(--leading-snug);
	padding: 0.7em 0.85em !important;
	border-radius: var(--radius-m);
	transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.main-menu .sub-menu a:hover,
.main-menu .sub-menu a:focus {
	background: var(--accent-wash) !important;
	color: var(--accent-strong) !important;
}
.main-menu .sub-menu a::after { display: none !important; }
.main-menu .sub-menu .submenu-expand { color: var(--ink-3) !important; }

/* --- Search as a command-bar pill (with ⌘K hint injected by JS) --------- */
.header-search-contain #search-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	height: 2.5rem;
	padding: 0 0.55em 0 0.85em;
	border-radius: var(--radius-pill);
	border: 1px solid var(--line-strong);
	background: var(--surface-1);
	color: var(--ink-3);
	cursor: pointer;
	transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.header-search-contain #search-toggle:hover { border-color: var(--accent); color: var(--accent-strong); box-shadow: var(--shadow-1); }
.header-search-contain #search-toggle .search-icon { display: inline-flex; order: -1; }
.header-search-contain #search-toggle .search-icon svg,
.header-search-contain #search-toggle .close-icon svg { width: 1.2rem; height: 1.2rem; }
/* Show the right icon for the open/closed state, independent of parent CSS. */
.hide-header-search .header-search-contain #search-toggle .close-icon { display: none; }
.show-header-search .header-search-contain #search-toggle .search-icon { display: none; }
.llmic-search-label { font-size: var(--step--1); font-weight: 500; }
.show-header-search .header-search-contain .llmic-kbd { display: none; }
/* Belt-and-suspenders: keep the a11y label out of view. */
.header-search-contain #search-toggle .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.llmic-kbd {
	font-family: var(--font-mono);
	font-size: 0.68rem;
	font-weight: 600;
	color: var(--ink-3);
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-bottom-width: 2px;
	border-radius: var(--radius-s);
	padding: 0.15em 0.45em;
	line-height: 1.3;
}

/* --- Buttons: quiet primary, honest hierarchy --------------------------- */
.llmic-btn,
.wp-block-button__link,
button.llmic-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	font: inherit;
	font-weight: 600;
	line-height: 1;
	padding: 0.7em 1.15em;
	border-radius: var(--radius-m);
	border: 1px solid var(--line-strong);
	background: var(--surface-1);
	color: var(--ink);
	cursor: pointer;
	transition: transform var(--dur-fast) var(--ease-out),
		background var(--dur-fast) var(--ease-out),
		box-shadow var(--dur-fast) var(--ease-out);
}
.llmic-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.llmic-btn:active { transform: translateY(0); }
.llmic-btn--primary {
	background: var(--accent);
	color: var(--accent-ink);
	border-color: transparent;
}
.llmic-btn--primary:hover { background: var(--accent-hover); }

/* --- Theme toggle ------------------------------------------------------- */
.llmic-theme-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--line);
	background: var(--surface-1);
	color: var(--ink-2);
	cursor: pointer;
	overflow: hidden;
	transition: color var(--dur-fast) var(--ease-out),
		border-color var(--dur-fast) var(--ease-out),
		background var(--dur-fast) var(--ease-out);
}
.llmic-theme-toggle:hover { color: var(--accent-strong); border-color: var(--accent); }
.llmic-theme-toggle:focus { outline: none; }
.llmic-theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Both icons are absolutely centered and cross-fade/rotate — no position jump. */
.llmic-theme-toggle svg {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 1.15rem;
	height: 1.15rem;
	transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}

/* Toggle when placed inside the primary nav menu — stay inline with the other
   menu items (display:flex made the <li> block-level and dropped it to its own
   line). */
.llmic-menu-toggle {
	display: inline-flex !important;
	align-items: center;
	vertical-align: middle;
	list-style: none;
	margin: 0 0 0 0.25rem;
	padding: 0;
	border: 0 !important;
}
.llmic-menu-toggle::before,
.llmic-menu-toggle::after { content: none !important; display: none !important; }
.llmic-menu-toggle .llmic-theme-toggle { width: 2.1rem; height: 2.1rem; }
.llmic-theme-toggle .icon-moon { transform: translate(-50%, -50%) rotate(0deg) scale(1); opacity: 1; }
.llmic-theme-toggle .icon-sun { transform: translate(-50%, -50%) rotate(-90deg) scale(0.4); opacity: 0; }
[data-theme="dark"] .llmic-theme-toggle .icon-moon { transform: translate(-50%, -50%) rotate(90deg) scale(0.4); opacity: 0; }
[data-theme="dark"] .llmic-theme-toggle .icon-sun { transform: translate(-50%, -50%) rotate(0deg) scale(1); opacity: 1; }

/* --- Mono voice for technical metadata ---------------------------------- */
.llmic-mono,
.llmic-meta time,
.llmic-reading-time {
	font-family: var(--font-mono);
	font-size: var(--step--1);
	letter-spacing: var(--tracking-flat);
	color: var(--ink-3);
}

/* --- Breadcrumb (parent .site-breadcrumb, styled to our system) --------- */
.site-breadcrumb {
	font-size: var(--step--1);
	color: var(--ink-3);
	padding-block: var(--space-s);
}
.site-breadcrumb .wrapper {
	max-width: var(--content-max);
	margin-inline: auto;
	padding-inline: var(--space-m);
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.15em;
}
.site-breadcrumb a {
	color: var(--ink-2);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	transition: color var(--dur-fast) var(--ease-out);
}
.site-breadcrumb a:hover { color: var(--accent-strong); }
/* Home icon on the first crumb. */
.site-breadcrumb a:first-of-type::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-right: 0.4em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 9.5V21h14V9.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 9.5V21h14V9.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Current page as a soft brand pill. */
.site-breadcrumb .breadcrumb_last {
	color: var(--accent-strong);
	font-weight: 600;
	background: var(--accent-wash);
	padding: 0.25em 0.7em;
	border-radius: var(--radius-pill);
}

/* --- Site logo (aperture mark + wordmark) ------------------------------ */
.site-branding.has-llmic-logo {
	display: flex;
	align-items: center;
	gap: 0.7rem;
}
.llmic-logo {
	display: inline-flex;
	flex: none;
	line-height: 0;
}
.llmic-logo img {
	width: 40px;
	height: 40px;
	display: block;
}

/* --- Social icon links (author card + archive header) ------------------ */
.llmic-social { display: inline-flex; align-items: center; gap: var(--space-2xs); }
.llmic-social__link {
	color: var(--ink-3);
	display: inline-flex;
	transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.llmic-social__link:hover { color: var(--accent-strong); transform: translateY(-1px); }
.llmic-social__link svg { width: 18px; height: 18px; display: block; }

/* --- Surfaces ----------------------------------------------------------- */
.llmic-card {
	background: var(--surface-1);
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	box-shadow: var(--shadow-1);
}

/* --- Form controls (sitewide) ------------------------------------------ */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
	font: inherit;
	color: var(--ink);
	background: var(--surface-1);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-m);
	padding: 0.6em 0.85em;
	width: 100%;
	max-width: 100%;
	transition: border-color var(--dur-fast) var(--ease-out),
		box-shadow var(--dur-fast) var(--ease-out);
}
input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--accent-strong);
	box-shadow: 0 0 0 3px var(--accent-wash);
}
::placeholder { color: var(--ink-3); }

/* Search form */
.search-form,
.wp-block-search__inside-wrapper {
	display: flex;
	gap: var(--space-2xs);
}
.search-form .search-submit,
.wp-block-search__button {
	flex: none;
	font: inherit;
	font-weight: 600;
	padding: 0.6em 1.1em;
	border-radius: var(--radius-m);
	border: 1px solid transparent;
	background: var(--accent);
	color: var(--accent-ink);
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease-out);
}
.search-form .search-submit:hover,
.wp-block-search__button:hover { background: var(--accent-hover); }

/* --- Pagination / posts navigation ------------------------------------- */
.navigation .nav-links,
.posts-navigation .nav-links,
.pagination {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2xs);
	justify-content: center;
	margin: var(--space-xl) 0;
}
.navigation a,
.navigation .current,
.page-numbers {
	display: inline-flex;
	align-items: center;
	padding: 0.5em 0.9em;
	border-radius: var(--radius-m);
	border: 1px solid var(--line);
	color: var(--ink-2);
	text-decoration: none;
	font-weight: 600;
	transition: border-color var(--dur-fast) var(--ease-out),
		color var(--dur-fast) var(--ease-out);
}
.navigation a:hover,
.page-numbers:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.page-numbers.current {
	background: var(--accent);
	color: var(--accent-ink);
	border-color: transparent;
}

/* --- Comments ----------------------------------------------------------- */
.comments-area {
	max-width: var(--measure);
	margin: var(--space-l) auto 0;
	padding-top: var(--space-l);
	border-top: 1px solid var(--line);
}
.comments-title,
.comment-reply-title { font-size: var(--step-2); margin-bottom: var(--space-m); }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-body {
	padding: var(--space-m);
	margin-bottom: var(--space-s);
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	background: var(--surface-1);
}
.comment-author .fn { font-weight: var(--llmic-weight-semibold); }
.comment-metadata,
.comment-author .says { color: var(--ink-3); font-size: var(--step--1); }
.comment-respond { margin-top: var(--space-l); }
.comment-form label { display: block; font-weight: 600; margin: var(--space-s) 0 var(--space-3xs); }

/* Comment fields — ID-scoped to beat Newspack's higher-specificity rules. */
#respond textarea,
#respond input[type="text"],
#respond input[type="email"],
#respond input[type="url"] {
	font: inherit;
	color: var(--ink);
	background: var(--surface-1);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-m);
	padding: 0.6em 0.85em;
}
#respond textarea:focus,
#respond input:focus {
	border-color: var(--accent-strong);
	box-shadow: 0 0 0 3px var(--accent-wash);
	outline: none;
}

/* Submit button — #respond #submit (two IDs) outranks Newspack's #submit. */
#respond #submit,
.comment-form .submit,
.form-submit input[type="submit"] {
	font: inherit;
	font-weight: 600;
	margin-top: var(--space-s);
	padding: 0.7em 1.3em;
	border-radius: var(--radius-m);
	border: 1px solid transparent;
	background: var(--accent);
	color: var(--accent-ink);
	cursor: pointer;
	width: auto;
	transition: background var(--dur-fast) var(--ease-out);
}
#respond #submit:hover,
.comment-form .submit:hover { background: var(--accent-hover); }

/* --- Editor-authored knowledge components ------------------------------ */
.entry-content .is-style-llmic-callout,
.entry-content .is-style-llmic-callout-tip,
.entry-content .is-style-llmic-callout-warning,
.entry-content .is-style-llmic-definition,
.entry-content .is-style-llmic-expert,
.entry-content .is-style-llmic-references {
	margin: var(--space-l) 0;
	padding: var(--space-m);
	border: 1px solid var(--line);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-l);
	background: var(--surface-1);
	box-shadow: var(--shadow-1);
}
.entry-content .is-style-llmic-callout-tip { border-left-color: var(--success); }
.entry-content .is-style-llmic-callout-warning { border-left-color: var(--warning); }
.entry-content .is-style-llmic-definition { border-left-color: var(--ink); background: var(--surface-2); }
.entry-content .is-style-llmic-expert { border-left-color: var(--llmic-color-accent); }
.entry-content .is-style-llmic-references { border-left-color: var(--ink-3); }
.entry-content .is-style-llmic-references a[href^="http"]::after { content: " ↗"; font-size: 0.85em; }
.entry-content ul.is-style-llmic-checklist { list-style: none; padding-left: 0; }
.entry-content ul.is-style-llmic-checklist li { position: relative; padding-left: 2em; margin-block: var(--space-2xs); }
.entry-content ul.is-style-llmic-checklist li::before {
	content: "✓";
	position: absolute;
	left: 0;
	top: 0;
	color: var(--success);
	font-weight: 700;
}
.entry-content .is-style-llmic-pullquote {
	border: 0;
	border-top: 2px solid var(--ink);
	border-bottom: 2px solid var(--ink);
	padding: var(--space-l) var(--space-m);
	margin: var(--space-xl) 0;
	text-align: center;
	font-style: normal;
}
.entry-content .is-style-llmic-pullquote p { font-size: var(--step-2); line-height: var(--leading-snug); font-weight: 600; }
