/* ==========================================================================
   Rex Word Puzzle — design system v2 ("the grid is the brand")
   1. Tokens  2. Base  3. Layout  4. Header/nav  5. Hero  6. Sections & cards
   7. Tool pages  8. Blog & prose  9. Footer  10. Utilities
   Everything decorative is built from crossword squares: letter tiles, the
   yellow active cell, the blue active word, black squares.
   Tool components live in the plugin's tools.css and read these tokens.
   ========================================================================== */

/* 1. Tokens */
:root {
	/* Brand base (from the brief) */
	--rex-navy: #172B4D;
	--rex-blue: #356AE6;
	--rex-bg: #F7F9FC;
	--rex-white: #FFFFFF;
	--rex-text: #172033;
	--rex-muted: #68758A;
	--rex-success: #23865B;
	--rex-error: #D94C4C;
	--rex-line: #DDE3EC;
	--rex-blue-soft: #EAF0FD;

	/* Vibrant layer */
	--rex-brand-a: #3D6BFF;            /* electric blue */
	--rex-brand-b: #7B4DFF;            /* violet */
	--rex-gradient: linear-gradient(135deg, var(--rex-brand-a), var(--rex-brand-b));
	--rex-sun: #FFD23F;                /* active cell */
	--rex-sky: #D7E3FF;                /* active word */
	--rex-mint: #10B981;
	--rex-coral: #FF5A6E;
	--rex-orange: #FF8A1F;
	--rex-cyan: #0EA5E9;
	--rex-violet: #7B4DFF;
	--rex-accent: var(--rex-brand-a);  /* per-tool override */

	--rex-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--rex-display: "Inter Display", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--rex-radius: 12px;
	--rex-radius-lg: 20px;
	--rex-radius-xl: 28px;
	--rex-shadow: 0 1px 2px rgba(23,43,77,.06), 0 10px 30px -10px rgba(23,43,77,.18);
	--rex-shadow-lift: 0 2px 4px rgba(23,43,77,.06), 0 24px 48px -16px rgba(45,60,160,.35);
	--rex-max: 1240px;
	--rex-narrow: 760px;
	--rex-gutter: clamp(1rem, 4vw, 2rem);
	--rex-header-h: 4.25rem;

	--step--1: clamp(.83rem, .8rem + .15vw, .9rem);
	--step-0: clamp(1rem, .97rem + .15vw, 1.0625rem);
	--step-1: clamp(1.2rem, 1.12rem + .4vw, 1.4rem);
	--step-2: clamp(1.6rem, 1.35rem + 1vw, 2.2rem);
	--step-3: clamp(2rem, 1.6rem + 2vw, 3rem);
	--step-4: clamp(2.5rem, 1.7rem + 3.8vw, 4.6rem);
}

/* Per-tool accents (cards, tool pages, results) */
.tool-card--solver, .tool-page--solver { --rex-accent: var(--rex-brand-a); }
.tool-card--word-finder, .tool-page--word-finder { --rex-accent: var(--rex-mint); --rex-on-accent: var(--rex-navy); }
.tool-card--pattern-finder, .tool-page--pattern-finder { --rex-accent: var(--rex-orange); --rex-on-accent: var(--rex-navy); }
.tool-card--anagram, .tool-page--anagram { --rex-accent: var(--rex-coral); --rex-on-accent: var(--rex-navy); }
.tool-card--dictionary, .tool-page--dictionary { --rex-accent: var(--rex-cyan); --rex-on-accent: var(--rex-navy); }
.tool-card--abbreviations, .tool-page--abbreviations { --rex-accent: var(--rex-violet); }

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--rex-header-h) + 1rem); }
body { margin: 0; font-family: var(--rex-font); font-size: var(--step-0); line-height: 1.6; color: var(--rex-text); background: var(--rex-bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; font-feature-settings: "cv11", "ss01"; }
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--rex-blue); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { color: var(--rex-navy); }
:focus-visible { outline: 3px solid var(--rex-brand-a); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { color: var(--rex-navy); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 .55em; font-family: var(--rex-display); font-weight: 800; }
h1 { font-size: var(--step-3); font-weight: 900; letter-spacing: -.03em; }
h2 { font-size: var(--step-2); }
h3, .h3 { font-size: var(--step-1); letter-spacing: -.015em; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; }
::selection { background: var(--rex-sun); color: var(--rex-navy); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 1000; background: var(--rex-navy); color: #fff; padding: .75rem 1rem; border-radius: var(--rex-radius); }
.skip-link:focus { top: 1rem; color: #fff; }

/* 3. Layout */
.container { width: 100%; max-width: var(--rex-max); margin-inline: auto; padding-inline: var(--rex-gutter); }
.container--narrow { max-width: calc(var(--rex-narrow) + 2 * var(--rex-gutter)); }
.site-main { padding-block: 1.5rem 4rem; min-height: 60vh; }
.home.site-main { padding-top: 0; }
.page-header { margin: 1rem 0 2rem; }
.page-title { font-size: var(--step-3); }
.lead { font-size: var(--step-1); color: var(--rex-muted); max-width: 60ch; line-height: 1.5; }

.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; font-size: var(--step--1); color: var(--rex-muted); }
.breadcrumbs li + li::before { content: "/"; margin: 0 .45rem; opacity: .5; }
.breadcrumbs a { color: var(--rex-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--rex-blue); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--rex-text); overflow-wrap: anywhere; }

/* 4. Header & nav */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid rgba(221,227,236,.8); }
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; } }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--rex-header-h); gap: 1rem; }

.brand__link { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--rex-navy); }
.brand__link:hover { color: var(--rex-navy); }
.brand__mark { width: 2.5rem; height: 2.5rem; flex: none; border-radius: 22.6%; transition: transform .25s cubic-bezier(.2,.8,.2,1.4); }
.brand__link:hover .brand__mark { transform: rotate(-6deg) scale(1.05); }
.brand__name { font-family: var(--rex-display); font-size: 1.3rem; line-height: 1; letter-spacing: -.012em; white-space: nowrap; }
.brand__name-a { font-weight: 900; }
.brand__name-b { font-weight: 600; }
.brand__link--light, .brand__link--light:hover { color: #fff; }
.custom-logo { max-height: 44px; width: auto; }
@media (max-width: 380px) { .brand__name-b { display: none; } }

.nav-toggle { display: inline-grid; place-items: center; width: 2.875rem; height: 2.875rem; border: 1px solid var(--rex-line); border-radius: var(--rex-radius); background: #fff; color: var(--rex-navy); cursor: pointer; }
.nav-toggle__close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__close { display: inline; }
.nav { display: none; position: absolute; inset: var(--rex-header-h) 0 auto 0; background: #fff; border-bottom: 1px solid var(--rex-line); box-shadow: var(--rex-shadow); padding: .5rem var(--rex-gutter) 1rem; }
.nav.is-open { display: block; }
.nav__list, .nav ul { list-style: none; margin: 0; padding: 0; }
.nav a { display: flex; align-items: center; min-height: 3rem; padding: 0 .9rem; color: var(--rex-navy); font-weight: 600; text-decoration: none; border-radius: 999px; }
.nav a:hover, .nav a:focus-visible { background: var(--rex-blue-soft); color: var(--rex-brand-a); }
.nav .current-menu-item > a, .nav .current_page_item > a { background: var(--rex-navy); color: #fff; }
@media (min-width: 960px) {
	.nav-toggle { display: none; }
	.nav { display: block; position: static; background: none; border: 0; box-shadow: none; padding: 0; }
	.nav__list, .nav ul { display: flex; gap: .2rem; }
	.nav a { min-height: 2.5rem; font-size: .95rem; }
}

/* 5. Hero */
.hero { position: relative; overflow: hidden; color: #fff; background: #2A4BFF; padding-block: clamp(2.75rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5.5rem); isolation: isolate; }
.hero__bg { position: absolute; inset: 0; z-index: -1;
	background:
		radial-gradient(60rem 30rem at 100% 0%, rgba(255,210,63,.28), transparent 60%),
		radial-gradient(50rem 40rem at 0% 100%, rgba(255,90,110,.32), transparent 60%),
		linear-gradient(135deg, #2F5BFF 0%, #5B3DF5 55%, #8A3FFC 100%); }
.hero__bg::after { content: ""; position: absolute; inset: 0; opacity: .16;
	background-image: linear-gradient(#fff 1.5px, transparent 1.5px), linear-gradient(90deg, #fff 1.5px, transparent 1.5px);
	background-size: 56px 56px; background-position: -1px -1px;
	-webkit-mask-image: linear-gradient(90deg, #000, transparent 70%); mask-image: linear-gradient(90deg, #000, transparent 70%); }
.hero__inner { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (min-width: 980px) { .hero__inner { grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); } }
.hero__title { color: #fff; font-size: var(--step-4); line-height: 1.02; letter-spacing: -.028em; margin-bottom: .4em; max-width: 13ch; }
.hero__kicker { display: block; font-size: .42em; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; margin-bottom: .35em; color: var(--rex-sun); }
.hero__lead { color: rgba(255,255,255,.88); font-size: var(--step-1); max-width: 44ch; line-height: 1.5; margin-bottom: 1.75rem; }

.hero__search { background: #fff; color: var(--rex-text); border-radius: var(--rex-radius-lg); padding: .6rem; box-shadow: 0 30px 60px -20px rgba(16,20,80,.55), 0 0 0 6px rgba(255,255,255,.14); max-width: 640px; }
.hero__tabs { display: flex; gap: .25rem; padding: .15rem .15rem .55rem; overflow-x: auto; scrollbar-width: none; }
.hero__tab { flex: none; display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 1rem; border-radius: 999px; font-weight: 600; font-size: .95rem; color: var(--rex-muted); text-decoration: none; }
.hero__tab:hover { color: var(--rex-navy); background: var(--rex-bg); }
.hero__tab.is-active, .hero__tab[aria-selected="true"] { background: var(--rex-navy); color: #fff; }
.hero__panel[hidden] { display: none; }
.hero__search .rex-field__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hero__search .rex-tool.is-compact .rex-form { gap: .5rem; }
.hero__search .rex-field--wide .rex-input { border-color: transparent; background: var(--rex-bg); min-height: 3.5rem; font-size: 1.15rem; border-radius: 14px; }
.hero__search .rex-field--wide .rex-input:focus { background: #fff; border-color: var(--rex-brand-a); }
.hero__search .rex-btn--primary { min-height: 3.5rem; padding-inline: 1.6rem; border-radius: 14px; font-size: 1.05rem; }
@media (max-width: 560px) { .hero__search .rex-tool.is-compact .rex-form { grid-template-columns: 1fr; } .hero__search .rex-btn { width: 100%; } }

/* Demo crossword (decorative, aria-hidden) */
.hero__demo { display: none; justify-self: center; }
@media (min-width: 980px) { .hero__demo { display: block; } }
.demo { --cell: clamp(4rem, 6.2vw, 5.4rem); background: #fff; border-radius: 22px; padding: 14px; transform: rotate(3deg); box-shadow: 0 40px 80px -24px rgba(16,20,80,.6), 0 0 0 8px rgba(255,255,255,.12); }
.demo__grid { display: grid; grid-template-columns: repeat(4, var(--cell)); border: 3px solid var(--rex-navy); border-radius: 6px; overflow: hidden; background: var(--rex-navy); gap: 2px; }
.demo__cell { position: relative; display: grid; place-items: center; height: var(--cell); background: #fff; transition: background-color .2s; }
.demo__cell small { position: absolute; top: 4px; left: 6px; font-size: .78rem; font-weight: 600; color: var(--rex-navy); line-height: 1; }
.demo__cell b { font-family: var(--rex-display); font-weight: 800; font-size: calc(var(--cell) * .5); color: var(--rex-navy); line-height: 1; }
.demo__cell.is-word { background: var(--rex-sky); }
.demo__cell.is-active { background: var(--rex-sun); }
.demo__cell.is-hidden b { opacity: 0; }
.demo__cell.is-typed b { animation: rex-pop .22s cubic-bezier(.2,.8,.2,1.4); }
.demo__clue { margin: 12px 2px 2px; padding: .7rem 1rem; border-radius: 12px; background: var(--rex-sky); color: var(--rex-navy); font-weight: 500; min-height: 2.9rem; }
.demo__clue strong { font-weight: 800; margin-right: .4rem; }
.demo__clue [hidden] { display: none; }
@keyframes rex-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 6. Sections & cards */
.section { padding-block: clamp(2.25rem, 4.5vw, 3.75rem); }
.section--tint { background: #fff; }
.section--today { padding-top: 0; }
.section__head { margin-bottom: 2rem; max-width: 62ch; }
.section__head--split { max-width: none; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.section__title { font-size: var(--step-2); margin-bottom: .3em; }
.section__lead { color: var(--rex-muted); margin: 0; font-size: 1.05rem; }
.link-arrow { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; text-decoration: none; color: var(--rex-brand-a); }
.link-arrow .rex-icon { width: 1.1em; height: 1.1em; transition: transform .2s; }
.link-arrow:hover .rex-icon { transform: translateX(3px); }

.card { position: relative; background: #fff; border: 1px solid var(--rex-line); border-radius: var(--rex-radius-lg); padding: 1.35rem; }
.card__title { font-size: 1.1rem; margin-bottom: .5rem; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stretched { text-decoration: none; color: inherit; }

/* Tool cards: the solver gets a wide feature card; the rest share a row. */
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.tool-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--rex-line); border-radius: var(--rex-radius-lg); padding: 1.35rem 1.35rem 1.2rem; transition: border-color .2s, box-shadow .2s, transform .2s; }
.tool-card:hover, .tool-card:focus-within { border-color: var(--rex-accent); box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--rex-accent) 55%, transparent); transform: translateY(-3px); }
.tool-card__icon { display: inline-grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 14px; background: var(--rex-accent); color: var(--rex-on-accent, #fff); margin-bottom: 1rem; box-shadow: 0 8px 18px -8px var(--rex-accent); }
.tool-card__title { font-size: 1.15rem; margin-bottom: .35rem; }
.tool-card__title a { color: var(--rex-navy); }
.tool-card__text { color: var(--rex-muted); margin: 0 0 1.1rem; font-size: .95rem; line-height: 1.5; }
.tool-card__demo { margin-top: auto; display: grid; justify-items: start; gap: .35rem; padding-top: .9rem; border-top: 1px dashed var(--rex-line); }
.tool-card__out { display: inline-flex; align-items: center; gap: .35rem; }
.tool-card__to { color: var(--rex-muted); display: inline-flex; }
.tool-card__to .rex-icon { width: 1rem; height: 1rem; }
.tool-card__clue { font-weight: 600; color: var(--rex-navy); font-size: .9rem; }
.mini-tiles { display: inline-flex; gap: 2px; }
@media (max-width: 759px) {
	.tool-grid { gap: .6rem; }
	.tool-card { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .9rem; padding: 1rem 1.1rem; }
	.tool-card__icon { grid-row: span 2; margin: 0; width: 2.6rem; height: 2.6rem; border-radius: 12px; }
	.tool-card__title { margin: 0; font-size: 1.05rem; }
	.tool-card__text { margin: 0; font-size: .9rem; }
	.tool-card__demo { display: none; }
}
.mini-tile { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 4px; background: #fff; border: 1.5px solid var(--rex-navy); color: var(--rex-navy); font-size: .78rem; font-weight: 800; line-height: 1; }
.mini-tile.is-empty { border-style: dashed; border-color: var(--rex-muted); }
.mini-tile.is-fill { background: var(--rex-accent); border-color: var(--rex-accent); color: var(--rex-on-accent, #fff); }
.tool-card__demo > .mini-tiles:last-child .mini-tile:not(.is-fill) { background: color-mix(in srgb, var(--rex-accent) 12%, #fff); }

@media (min-width: 760px) {
	.tool-card--solver { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 1.5rem; align-items: center; padding: 1.75rem 2rem; color: #fff; border: 0; background: var(--rex-navy); overflow: hidden; isolation: isolate; }
	.tool-card--solver::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .12; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 32px 32px; -webkit-mask-image: linear-gradient(270deg, #000, transparent 60%); mask-image: linear-gradient(270deg, #000, transparent 60%); }
	.tool-card--solver .tool-card__icon { grid-row: span 2; width: 4rem; height: 4rem; margin: 0; border-radius: 18px; background: var(--rex-sun); color: var(--rex-navy); box-shadow: none; }
	.tool-card--solver .tool-card__icon .rex-icon { width: 1.9rem; height: 1.9rem; }
	.tool-card--solver .tool-card__title { font-size: var(--step-1); margin: 0; align-self: end; }
	.tool-card--solver .tool-card__title a { color: #fff; }
	.tool-card--solver .tool-card__text { color: rgba(255,255,255,.75); margin: 0; align-self: start; max-width: 56ch; }
	.tool-card--solver .tool-card__demo { display: flex; align-items: center; gap: .6rem; grid-column: 3; grid-row: 1 / span 2; margin: 0; padding: 1rem 1.2rem; border: 0; border-radius: 16px; background: rgba(255,255,255,.08); }
	.tool-card--solver .tool-card__clue { color: #fff; }
	.tool-card--solver .mini-tile { width: 2.1rem; height: 2.1rem; font-size: 1.05rem; }
	.tool-card--solver:hover { box-shadow: var(--rex-shadow-lift); }
}

.today { display: grid; gap: 1.5rem; align-items: center; padding: clamp(1.5rem, 3vw, 2.25rem); border: 0; color: var(--rex-navy); background: var(--rex-sun); overflow: hidden; isolation: isolate; }
.today::after { content: ""; position: absolute; right: -2rem; top: -2rem; width: 14rem; height: 14rem; z-index: -1; opacity: .18; background-image: linear-gradient(var(--rex-navy) 3px, transparent 3px), linear-gradient(90deg, var(--rex-navy) 3px, transparent 3px); background-size: 46px 46px; transform: rotate(12deg); }
@media (min-width: 760px) { .today { grid-template-columns: auto 1fr auto; } }
.today__icon { display: inline-grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 18px; background: var(--rex-navy); color: var(--rex-sun); }
.today__icon .rex-icon { width: 2.4rem; height: 2.4rem; }
.today__title { font-size: var(--step-2); margin-bottom: .2rem; }
.today .eyebrow { color: var(--rex-navy); }
.today .muted { color: rgba(23,43,77,.75); margin: 0; }
.today__actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.today .rex-btn--primary { background: var(--rex-navy); }
.today .rex-btn--ghost { border-color: rgba(23,43,77,.35); background: rgba(255,255,255,.5); }

.explorer { position: relative; display: grid; gap: 1.75rem; align-items: center; color: #fff; background: linear-gradient(135deg, #0B8FD1, #0EA5E9 45%, #22C7B8); border-radius: var(--rex-radius-xl); padding: clamp(1.5rem, 4vw, 3rem); overflow: hidden; isolation: isolate; }
.explorer::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .14; background-image: linear-gradient(#fff 1.5px, transparent 1.5px), linear-gradient(90deg, #fff 1.5px, transparent 1.5px); background-size: 48px 48px; }
.explorer .section__title { color: #fff; }
.explorer .section__lead { color: rgba(255,255,255,.9); }
@media (min-width: 900px) { .explorer { grid-template-columns: 1fr 1.15fr; } }
.explorer .rex-tool { background: #fff; border: 0; border-radius: var(--rex-radius-lg); padding: .6rem; box-shadow: 0 24px 48px -20px rgba(4,60,90,.6); }
.explorer .rex-tool.is-compact { padding: .6rem; }
.explorer .rex-field__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.explorer .rex-field--wide .rex-input { border-color: transparent; background: var(--rex-bg); }
.explorer .rex-tool.is-compact .rex-form { grid-template-columns: 1fr auto; gap: .5rem; }
.explorer .rex-btn--primary { background: var(--rex-navy); color: #fff; min-height: 3.25rem; box-shadow: none; }
.explorer .rex-field--wide .rex-input { min-height: 3.25rem; background: #fff; }
.explorer__chips { margin-top: 1rem; }
.explorer .rex-chip { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; letter-spacing: .06em; font-weight: 700; }
.explorer .rex-chip:hover, .explorer .rex-chip:focus-visible { background: #fff; color: var(--rex-navy); }

.archive-strip { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.archive-strip__item { transition: border-color .2s, transform .2s; }
.archive-strip__item:hover { border-color: var(--rex-brand-a); transform: translateY(-2px); }

.faq { display: grid; gap: .6rem; }
.faq__item { background: #fff; border: 1.5px solid var(--rex-line); border-radius: var(--rex-radius); transition: border-color .2s; }
.faq__item[open] { border-color: var(--rex-brand-a); }
.faq__q { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 3.5rem; padding: .8rem 1.15rem; font-weight: 700; color: var(--rex-navy); }
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after { content: ""; flex: none; width: 1.75rem; height: 1.75rem; border-radius: 8px; background: var(--rex-blue-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233D6BFF' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M12 6v12M6 12h12'/%3E%3C/svg%3E") center / 1rem no-repeat; transition: transform .2s, background-color .2s; }
.faq__item[open] .faq__q::after { transform: rotate(45deg); background-color: var(--rex-sun); }
.faq__a { padding: 0 1.15rem 1.1rem; color: var(--rex-text); }
.faq__a p { margin: 0; }

.band { padding-block: 2.25rem 2.75rem; margin-bottom: 2rem; }
.band--navy { position: relative; background: var(--rex-navy); color: #fff; overflow: hidden; isolation: isolate; }
.band--navy::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .1; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 40px 40px; }
.band__title { color: #fff; font-size: var(--step-3); margin-top: 1rem; }
.band .lead { color: rgba(255,255,255,.82); }
.band .breadcrumbs, .band .breadcrumbs a, .band .breadcrumbs [aria-current] { color: rgba(255,255,255,.82); }

.empty-state, .notice-box { padding: 2rem; text-align: center; color: var(--rex-muted); background: #fff; border: 1.5px dashed var(--rex-line); border-radius: var(--rex-radius-lg); }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .15rem; }
.link-list a { display: flex; align-items: center; justify-content: space-between; min-height: 2.75rem; padding: 0 .75rem; border-radius: 10px; font-weight: 600; text-decoration: none; color: var(--rex-navy); }
.link-list a:hover { background: var(--rex-blue-soft); color: var(--rex-brand-a); }
.contact-card { margin-top: 2rem; }

/* Shared buttons and chips for theme-only contexts (the plugin defines the same classes) */
.rex-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.875rem; padding: 0 1.3rem; font-weight: 700; border-radius: var(--rex-radius); border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s, background-color .15s; }
.rex-btn--primary { background: var(--rex-brand-a); color: #fff; box-shadow: 0 8px 20px -10px var(--rex-brand-a); }
.rex-btn--primary:hover { background: #2C58F0; color: #fff; transform: translateY(-1px); }
.rex-btn--ghost { background: transparent; color: var(--rex-navy); border-color: var(--rex-line); }
.rex-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.rex-chip { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 1rem; border-radius: 999px; background: #fff; border: 1.5px solid var(--rex-line); color: var(--rex-navy); text-decoration: none; font-weight: 600; transition: border-color .15s, color .15s, background-color .15s; }
.rex-chip:hover, .rex-chip:focus-visible { border-color: var(--rex-brand-a); color: var(--rex-brand-a); }
.section--tint .rex-chip { background: var(--rex-bg); }

/* 7. Tool pages */
.tool-page__header { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; align-items: center; margin: 1rem 0 1.75rem; padding: clamp(1.5rem, 4vw, 2.25rem); border-radius: var(--rex-radius-xl); color: #fff; background: var(--rex-navy); overflow: hidden; isolation: isolate; }
.tool-page__header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(30rem 16rem at 100% 0%, color-mix(in srgb, var(--rex-accent) 65%, transparent), transparent 70%), radial-gradient(20rem 12rem at 0% 100%, color-mix(in srgb, var(--rex-brand-b) 45%, transparent), transparent 70%); }
.tool-page__header::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 50%; z-index: -1; opacity: .14; background-image: linear-gradient(#fff 2px, transparent 2px), linear-gradient(90deg, #fff 2px, transparent 2px); background-size: 44px 44px; -webkit-mask-image: linear-gradient(270deg, #000, transparent); mask-image: linear-gradient(270deg, #000, transparent); }
.tool-page__icon { display: inline-grid; place-items: center; width: clamp(3.25rem, 7vw, 4.5rem); aspect-ratio: 1; border-radius: 18px; background: var(--rex-accent); color: var(--rex-on-accent, #fff); box-shadow: 0 12px 28px -10px var(--rex-accent); }
.tool-page__icon .rex-icon { width: 55%; height: 55%; }
.tool-page__header .page-title { color: #fff; margin-bottom: .15em; }
.tool-page__header .lead { color: rgba(255,255,255,.85); margin: 0; }
@media (max-width: 480px) { .tool-page__header { grid-template-columns: 1fr; } }
.tool-page__grid { display: grid; gap: 2rem; }
.tool-page__main { min-width: 0; }
.tool-page__content { margin-top: 2.5rem; }
@media (min-width: 1024px) { .tool-page__grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } .tool-page__aside { position: sticky; top: calc(var(--rex-header-h) + 1rem); } }

/* 8. Blog & prose */
.post-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.post-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--rex-line); border-radius: var(--rex-radius-lg); overflow: hidden; transition: border-color .2s, transform .2s; }
.post-card:hover { border-color: var(--rex-brand-a); transform: translateY(-2px); }
.post-card__media img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-card__body { padding: 1.1rem 1.25rem 1.4rem; }
.post-card__title { font-size: 1.2rem; margin-bottom: .3rem; }
.post-card__title a { color: var(--rex-navy); text-decoration: none; }
.post-card__title a::after { content: ""; position: absolute; inset: 0; }
.post-card__title a:hover { color: var(--rex-brand-a); }
.post-card__date { color: var(--rex-muted); font-size: var(--step--1); margin-bottom: .5rem; }
.post-card__excerpt p { margin: 0; color: var(--rex-text); font-size: .95rem; }

.entry__header { margin: 1rem 0 1.5rem; }
.entry__title { font-size: var(--step-3); }
.post-meta { color: var(--rex-muted); font-size: var(--step--1); }
.entry__media { margin: 0 0 2rem; }
.entry__media img { border-radius: var(--rex-radius-lg); display: block; }
.prose { font-size: 1.0625rem; line-height: 1.75; }
.prose > * { max-width: 72ch; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose img { border-radius: var(--rex-radius); }
.prose blockquote { margin: 1.5em 0; padding: .6em 1.25em; border-left: 4px solid var(--rex-sun); background: #fff; border-radius: 0 var(--rex-radius) var(--rex-radius) 0; }
.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rex-line); padding: .6rem .75rem; text-align: left; }
.prose pre { overflow-x: auto; background: var(--rex-navy); color: #fff; padding: 1rem; border-radius: var(--rex-radius); }
.tag-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-list a { display: inline-flex; min-height: 2.25rem; align-items: center; padding: 0 .85rem; border-radius: 999px; background: #fff; border: 1.5px solid var(--rex-line); text-decoration: none; font-size: .9rem; font-weight: 600; }
.related { margin-top: 3rem; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2.5rem; }
.pagination .page-numbers { display: inline-grid; place-items: center; min-width: 2.75rem; height: 2.75rem; padding: 0 .75rem; border-radius: var(--rex-radius); background: #fff; border: 1.5px solid var(--rex-line); text-decoration: none; font-weight: 700; }
.pagination .page-numbers.current { background: var(--rex-navy); border-color: var(--rex-navy); color: #fff; }
.search-form { display: flex; gap: .5rem; margin: 1rem 0; max-width: 560px; }
.search-form .rex-input { flex: 1; min-height: 2.875rem; padding: .6rem .9rem; border: 1.5px solid var(--rex-line); border-radius: var(--rex-radius); background: #fff; }
.comments { margin-top: 3rem; }
.comment-list { padding-left: 0; list-style: none; }
.comment-form input:not([type=submit]):not([type=checkbox]), .comment-form textarea { width: 100%; padding: .6rem .8rem; border: 1.5px solid var(--rex-line); border-radius: var(--rex-radius); }
.error-404 { text-align: left; padding-top: 3rem; }

/* 9. Footer */
.site-footer { position: relative; background: var(--rex-navy); color: rgba(255,255,255,.75); margin-top: 3rem; font-size: .95rem; }
/* A row of crossword squares in the brand colors */
.site-footer__strip { height: 10px; background: linear-gradient(90deg, var(--rex-brand-a) 0 20%, var(--rex-sun) 20% 40%, var(--rex-coral) 40% 60%, var(--rex-mint) 60% 80%, var(--rex-brand-b) 80% 100%); }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-decoration-color: var(--rex-sun); }
.site-footer__grid { display: grid; gap: 2rem; padding-block: 3.25rem 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.site-footer__about p { margin-top: 1rem; max-width: 36ch; }
.site-footer__about .brand__link:hover { text-decoration: none; }
.site-footer__heading { color: var(--rex-sun); font-size: 1rem; letter-spacing: -.01em; margin-bottom: .75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
.site-footer__col a { display: inline-flex; min-height: 2.25rem; align-items: center; }
.social { display: flex !important; flex-wrap: wrap; gap: 1rem !important; margin-top: 1rem !important; }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding-block: 1.25rem; border-top: 1px solid rgba(255,255,255,.12); font-size: var(--step--1); }
.site-footer__bottom p { margin: 0; }

/* 10. Utilities */
.muted { color: var(--rex-muted); }
.small { font-size: var(--step--1); }
.eyebrow { font-size: .9rem; font-weight: 700; color: var(--rex-brand-a); margin: 0 0 .3rem; }
.rex-icon { width: 1.4rem; height: 1.4rem; }

/* Ad slots always reserve their height so layout never shifts */
.rex-ad { margin-block: 2rem; display: grid; place-items: center; overflow: hidden; }

@media print {
	.site-header, .site-footer, .nav, .rex-ad, .tool-page__aside, .rex-report, .hero__demo { display: none !important; }
	body { background: #fff; }
	.tool-page__header { background: none; color: #000; padding: 0; display: block; }
	.tool-page__icon { display: none; }
	.tool-page__header .page-title { color: #000; }
}


/* ---- Homepage v1.2: today's puzzles, word of the day, browse ---- */
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; }
.rex-btn--sun { background: var(--rex-sun); color: var(--rex-navy); min-height: 3.4rem; padding-inline: 1.6rem; font-size: 1.05rem; }
.rex-btn--sun:hover { background: #FFE07A; color: var(--rex-navy); transform: translateY(-1px); }
.rex-btn--glass { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); min-height: 3.4rem; padding-inline: 1.6rem; font-size: 1.05rem; }
.rex-btn--glass:hover { background: rgba(255,255,255,.24); color: #fff; }

.section--today { padding-top: clamp(2.5rem, 5vw, 4rem); }
.puzzle-cards { display: grid; gap: 1rem; }
@media (min-width: 820px) { .puzzle-cards { grid-template-columns: 1fr 1fr; } }
.puzzle-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem; align-items: center; padding: 1.5rem; border-radius: var(--rex-radius-xl); overflow: hidden; isolation: isolate; transition: transform .2s, box-shadow .2s; }
.puzzle-card:hover, .puzzle-card:focus-within { transform: translateY(-3px); box-shadow: var(--rex-shadow-lift); }
.puzzle-card--daily { background: var(--rex-navy); color: #fff; }
.puzzle-card--daily::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(26rem 16rem at 100% 0%, rgba(61,107,255,.55), transparent 70%); }
.puzzle-card--mini { background: var(--rex-sun); color: var(--rex-navy); }
.puzzle-card__grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); width: clamp(7rem, 16vw, 9.5rem); aspect-ratio: 1; gap: 1px; padding: 3px; border-radius: 8px; background: var(--rex-navy); box-shadow: 0 0 0 3px rgba(255,255,255,.9); transform: rotate(-3deg); }
.puzzle-card--mini .puzzle-card__grid { transform: rotate(3deg); box-shadow: 0 0 0 3px var(--rex-navy); }
.puzzle-card__grid span { background: #fff; border-radius: 1px; }
.puzzle-card__grid span.is-block { background: var(--rex-navy); }
.puzzle-card__grid span.is-active { background: var(--rex-sun); }
.puzzle-card--mini .puzzle-card__grid span.is-active { background: var(--rex-brand-a); }
.puzzle-card__kind { margin: 0 0 .2rem; font-weight: 700; font-size: .9rem; opacity: .85; }
.puzzle-card__title { font-size: var(--step-1); margin: 0 0 .5rem; color: inherit; }
.puzzle-card__title a { color: inherit; }
.puzzle-card__meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.puzzle-card__meta span { padding: .2rem .65rem; border-radius: 999px; font-size: .82rem; font-weight: 700; background: rgba(255,255,255,.14); }
.puzzle-card--mini .puzzle-card__meta span { background: rgba(23,43,77,.1); }
.puzzle-card--daily .puzzle-card__cta { background: var(--rex-sun); color: var(--rex-navy); box-shadow: none; }
.puzzle-card--mini .puzzle-card__cta { background: var(--rex-navy); color: #fff; box-shadow: none; }
@media (max-width: 460px) { .puzzle-card { grid-template-columns: 1fr; } }

.wotd { position: relative; display: grid; gap: 1.5rem 2.5rem; align-items: center; padding: clamp(1.5rem, 4vw, 2.75rem); border-radius: var(--rex-radius-xl); color: #fff; background: linear-gradient(135deg, #FF5A6E, #FF8A1F); overflow: hidden; isolation: isolate; }
.wotd::after { content: ""; position: absolute; right: -3rem; bottom: -3rem; width: 16rem; height: 16rem; z-index: -1; opacity: .16; background-image: linear-gradient(#fff 3px, transparent 3px), linear-gradient(90deg, #fff 3px, transparent 3px); background-size: 48px 48px; transform: rotate(-10deg); }
@media (min-width: 900px) { .wotd { grid-template-columns: auto minmax(0, 1fr); } }
.wotd__label { color: #fff; font-size: 1rem; margin: 0 0 .75rem; opacity: .95; }
.wotd__tiles { display: flex; gap: 6px; }
.wotd__tile { display: grid; place-items: center; flex: 1 1 0; min-width: 0; max-width: 3.6rem; width: 3.6rem; aspect-ratio: 1; border-radius: 10px; background: #fff; color: var(--rex-navy); font-family: var(--rex-display); font-weight: 900; font-size: clamp(1.4rem, 3.2vw, 2rem); box-shadow: 0 6px 0 rgba(23,43,77,.25); }
.wotd__tile:first-child { background: var(--rex-sun); }
.wotd__def { font-size: var(--step-1); line-height: 1.45; margin: 0 0 1.25rem; max-width: 48ch; }
.wotd__def em { font-style: normal; font-weight: 700; padding: .1rem .55rem; margin-right: .35rem; border-radius: 999px; background: rgba(255,255,255,.22); font-size: .8em; }
.wotd__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.wotd .rex-btn--primary { background: var(--rex-navy); color: #fff; box-shadow: none; }
.wotd .rex-btn--ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.wotd .rex-btn--ghost:hover { background: rgba(255,255,255,.15); color: #fff; }

.browse { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .browse { grid-template-columns: 1fr 1fr; } }
.browse .section__lead { margin-bottom: 1.25rem; }
.length-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.length-grid a { display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px; background: var(--rex-bg); border: 1.5px solid var(--rex-line); text-decoration: none; color: var(--rex-navy); transition: border-color .15s, background-color .15s, transform .15s; }
.length-grid a:hover, .length-grid a:focus-visible { border-color: var(--rex-orange); background: #FFF4EA; transform: translateY(-2px); }
.length-grid b { font-family: var(--rex-display); font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 900; line-height: 1; }
.length-grid span { font-size: .75rem; color: var(--rex-muted); font-weight: 600; }
.answer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.answer-links a { display: flex; align-items: center; gap: .75rem; min-height: 3.25rem; padding: .5rem 1rem; border-radius: 14px; background: var(--rex-bg); border: 1.5px solid var(--rex-line); text-decoration: none; color: var(--rex-navy); font-weight: 600; transition: border-color .15s; }
.answer-links a:hover { border-color: var(--rex-brand-a); }
.answer-links a .rex-icon { margin-left: auto; width: 1.1rem; height: 1.1rem; color: var(--rex-brand-a); }
.answer-links__tag { padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--rex-navy); color: #fff; }
.answer-links__tag--mini { background: var(--rex-sun); color: var(--rex-navy); }
