/**
 * base.css — site-wide reset, type utilities, layout primitives and shared
 * components (buttons, chips, eyebrow, meta, icon, embed). Loads after
 * tokens.css (see inc/enqueue.php cascade order) and before every other
 * theme stylesheet, so nothing here may depend on chrome/listing/article/
 * content selectors — only on --ds-* / --lc-* tokens.
 *
 * Rules this file obeys throughout (spec §0):
 *   - No !important, anywhere.
 *   - No literal colours/spacing/radii/shadows/fonts — everything traces to
 *     a --ds-* or --lc-* custom property. The one exception (documented at
 *     the point of use) is the `currentColor`/`transparent` CSS keywords,
 *     which are not colours in the token sense.
 *
 * Assumptions made where the spec names a component but not every value
 * (recorded here once, not repeated per rule):
 *   - Caps letter-spacing pairing: display.* uses --ds-font-letter-spacing-
 *     display; title.*--uppercase and the two button styles use -title;
 *     utility.2--uppercase (and everything built on it — chip, eyebrow) uses
 *     -wide, per the spec's own eyebrow/chip rules, generalised to the type
 *     utility of the same name.
 *   - `.lc-button--on-dark` (white bg / navy text) has no dedicated
 *     "button-on-dark" token pair upstream, so it reuses the secondary
 *     button's white background token and the badge/headline navy text
 *     token — both already #ffffff / #092340, the values the spec asks for.
 *
 * Contents:
 *   1. Reset
 *   2. Focus
 *   3. Visually hidden / skip link
 *   4. Type utilities (.ds-*)
 *   5. Layout (.lc-container, .lc-section, .lc-grid)
 *   6. Buttons (.lc-button)
 *   7. Chips (.lc-chip)
 *   8. Eyebrow / meta / icon
 *   9. Embed (.lc-embed)
 *  10. Reduced motion
 */

/* -------------------------------------------------------------------------
 * 1. Reset
 * ---------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
	margin: 0;
}

img,
svg,
video,
iframe {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	min-height: 100dvh;
	font: var(--ds-font-body-default);
	color: var(--ds-color-text-default);
	background: var(--ds-color-background-default);
	-webkit-font-smoothing: antialiased;
}

/* Headings carry no default size/weight of their own — every heading's
   actual type comes from one of the .ds-* utility classes below. This
   just keeps an un-classed heading from falling back to the UA stylesheet. */
h1,
h2,
h3,
h4,
h5,
h6 {
	font: inherit;
	font-weight: inherit;
}

a {
	color: var(--ds-color-text-link-default);
	text-underline-offset: 0.15em;
	transition: color var(--lc-speed) var(--lc-ease);
}

/* Only UNCLASSED anchors — i.e. links in running copy — take the generic hover
   colour. `a:hover` has specificity (0,1,1), which outranks every single-class
   component rule (`.lc-button`, `.lc-drawer__link`, `.lc-footer__links a`…),
   so an unscoped version recoloured anchor buttons and nav links on hover:
   header CTA text turned the same blue as its hover background, and white
   nav/drawer/footer links dropped to #006695 on navy (2.5:1, fails AA).
   Components set their own hover colours; article copy is covered by
   `.lc-prose a:hover` in article.css. */
a:not([class]):hover {
	color: var(--ds-color-text-link-hover);
}

/* -------------------------------------------------------------------------
 * 2. Focus
 * ---------------------------------------------------------------------- */

:focus-visible {
	outline: 2px solid var(--ds-color-border-focused-default);
	outline-offset: 2px;
}

/* Chrome/article components mark a dark-ground container with either class
   so descendant focus rings stay visible against navy (spec §3, §6). */
.lc-on-dark :focus-visible,
[data-on-dark] :focus-visible {
	outline-color: var(--ds-color-border-focused-on-dark);
}

:focus:not(:focus-visible) {
	outline: none;
}

/* -------------------------------------------------------------------------
 * 3. Visually hidden / skip link
 * ---------------------------------------------------------------------- */

.lc-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.lc-skip-link {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.lc-skip-link:focus {
	position: fixed;
	top: var(--ds-space-050);
	left: var(--ds-space-050);
	width: auto;
	height: auto;
	margin: 0;
	padding: var(--ds-space-075) var(--ds-space-150);
	overflow: visible;
	clip: auto;
	white-space: normal;
	z-index: var(--lc-z-overlay);
	font: var(--ds-font-button-2);
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-title);
	background: var(--ds-color-background-accent);
	color: var(--ds-color-text-button-accent);
	border-radius: var(--ds-radius-button-default);
}

/* -------------------------------------------------------------------------
 * 4. Type utilities — one class per Corduroy type style (spec §4).
 *    These ARE Corduroy's styles, so they intentionally keep the ds- prefix
 *    rather than lc-.
 * ---------------------------------------------------------------------- */

/* display.1/2/3 — responsive, always caps */
.ds-display-1,
.ds-display-2,
.ds-display-3 {
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-display);
	text-wrap: balance;
}

.ds-display-1 { font: var(--ds-font-display-1-mobile); }
.ds-display-2 { font: var(--ds-font-display-2-mobile); }
.ds-display-3 { font: var(--ds-font-display-3-mobile); }

@media (min-width: 768px) {
	.ds-display-1 { font: var(--ds-font-display-1-tablet); }
	.ds-display-2 { font: var(--ds-font-display-2-tablet); }
	.ds-display-3 { font: var(--ds-font-display-3-tablet); }
}

@media (min-width: 1024px) {
	.ds-display-1 { font: var(--ds-font-display-1-desktop); }
	.ds-display-2 { font: var(--ds-font-display-2-desktop); }
	.ds-display-3 { font: var(--ds-font-display-3-desktop); }
}

/* title.1/2/3 — sentence case default, caps --uppercase variant */
.ds-title-1,
.ds-title-2,
.ds-title-3,
.ds-title-1--uppercase,
.ds-title-2--uppercase,
.ds-title-3--uppercase {
	text-wrap: balance;
}

.ds-title-1 { font: var(--ds-font-title-1-default); }
.ds-title-1--uppercase {
	font: var(--ds-font-title-1-uppercase);
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-title);
}
.ds-title-2 { font: var(--ds-font-title-2-default); }
.ds-title-2--uppercase {
	font: var(--ds-font-title-2-uppercase);
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-title);
}
.ds-title-3 { font: var(--ds-font-title-3-default); }
.ds-title-3--uppercase {
	font: var(--ds-font-title-3-uppercase);
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-title);
}

/* subtitle */
.ds-subtitle { font: var(--ds-font-subtitle-default); }
.ds-subtitle--link { font: var(--ds-font-subtitle-link); }

/* body */
.ds-body { font: var(--ds-font-body-default); }
.ds-body--bold { font: var(--ds-font-body-bold); }
.ds-body--link { font: var(--ds-font-body-link); }

/* body.compact */
.ds-body-compact { font: var(--ds-font-body-compact-default); }
.ds-body-compact--bold { font: var(--ds-font-body-compact-bold); }
.ds-body-compact--link { font: var(--ds-font-body-compact-link); }

/* button.1/2 — always caps */
.ds-button-1,
.ds-button-2 {
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-title);
}
.ds-button-1 { font: var(--ds-font-button-1); }
.ds-button-2 { font: var(--ds-font-button-2); }

/* utility.1/2 — caps only on the --uppercase variant */
.ds-utility-1 { font: var(--ds-font-utility-1-default); }
.ds-utility-2 { font: var(--ds-font-utility-2-default); }
.ds-utility-2--uppercase {
	font: var(--ds-font-utility-2-uppercase);
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-wide);
}

/* -------------------------------------------------------------------------
 * 5. Layout
 * ---------------------------------------------------------------------- */

.lc-container {
	max-width: var(--lc-container);
	margin-inline: auto;
	padding-inline: var(--lc-gutter);
}

/* Modifiers — combine with .lc-container, e.g. class="lc-container lc-container--wide" */
.lc-container--wide {
	max-width: 87.5rem; /* 1400px, spec §5 — no Corduroy token covers the home grid width */
}
.lc-container--measure {
	max-width: var(--lc-measure);
}

/* Vertical rhythm is two tokens (tokens.css theme layer): --lc-space-section
   between page sections, --lc-space-block between the parts of one section.
   Every top-level gap on every template is one of the two. */
.lc-section {
	padding-block: var(--lc-space-section);
}

.lc-section--band {
	background: var(--ds-color-background-secondary);
}

.lc-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--ds-space-100);
	margin-bottom: var(--ds-space-200);
}

.lc-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--ds-space-150);
}
@media (min-width: 768px) {
	.lc-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (min-width: 1024px) {
	.lc-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: var(--ds-space-200);
	}
}

/* Capped at 2 columns regardless of viewport. Combine with .lc-grid; same
   specificity as .lc-grid's own rules, so this must stay declared after
   them (it is) to win the cascade without !important. */
@media (min-width: 768px) {
	.lc-grid--2 {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (min-width: 1024px) {
	.lc-grid--2 {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* -------------------------------------------------------------------------
 * 6. Buttons (spec §6)
 * ---------------------------------------------------------------------- */

.lc-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ds-space-050);
	min-height: 3rem;
	padding: var(--ds-space-100) var(--ds-space-150);
	border: 1px solid transparent;
	border-radius: var(--ds-radius-button-default);
	font: var(--ds-font-button-1);
	text-transform: uppercase;
	letter-spacing: var(--ds-font-letter-spacing-title);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--lc-speed) var(--lc-ease), color var(--lc-speed) var(--lc-ease),
		border-color var(--lc-speed) var(--lc-ease);
	/* Hover wipe (below) needs a clipped, isolated box. */
	position: relative;
	overflow: hidden;
	isolation: isolate;
	/* overflow clips the wipe at the padding edge, so it can never cover the
	   1px border. Filled variants' borders are transparent, and with the
	   default border-box clip the resting fill showed through them as a 1px
	   rim around the finished wipe. Clipping the fill to the padding box
	   leaves the border showing the surface behind it, at rest and on hover. */
	background-clip: padding-box;
}

/* Hover wipe — reproduces ikonpass.com's button mouseover: a skewed panel in
   the hover colour grows from the left edge across the face over 0.5s, the
   label riding above it. Each variant sets --lc-wipe to its Corduroy hover
   token; the button's own background does NOT change on hover any more (a
   200ms background fade would finish before the wipe and hide it). z-index -1
   inside the isolated stacking context paints the panel above the button's
   background but beneath bare text nodes, so buttons without an inner <span>
   still read. Pressed (:active) keeps the instant background change. */
.lc-button::before {
	content: '';
	position: absolute;
	inset: 0 auto 0 -0.5rem;
	z-index: -1;
	width: 0;
	background: var(--lc-wipe, var(--ds-color-background-button-hover));
	transform: skewX(-14deg);
	transition: width var(--lc-speed-slow) var(--lc-ease);
	pointer-events: none;
}
.lc-button:hover::before,
.lc-button:focus-visible::before {
	width: calc(100% + 1.5rem);
}
@media (prefers-reduced-motion: reduce) {
	.lc-button::before {
		transition: none;
	}
}

.lc-button > .lc-icon {
	width: 1.25rem;
	height: 1.25rem;
	flex-shrink: 0;
}

/* --primary (default look; no modifier class required on its own, but the
   explicit modifier is supported for clarity in markup) */
.lc-button,
.lc-button--primary {
	background-color: var(--ds-color-background-button-default);
	color: var(--ds-color-text-button-default);
}
.lc-button,
.lc-button--primary {
	--lc-wipe: var(--ds-color-background-button-hover);
}
.lc-button:active,
.lc-button--primary:active {
	background-color: var(--ds-color-background-button-pressed);
}

.lc-button--secondary {
	background-color: var(--ds-color-background-button-secondary-default);
	color: var(--ds-color-text-button-secondary);
	border-color: var(--ds-color-border-button-secondary);
}
.lc-button--secondary {
	--lc-wipe: var(--ds-color-background-button-secondary-hover);
}
/* Corduroy's own pair here — text.button.secondary #007DB7 on
   background.button.secondary.hover #EDEDED — is 3.84:1 and FAILS AA for
   16px bold. Shift text and border to text.link.hover (#006695, 5.3:1) while
   the wipe is showing. Deliberate deviation for accessibility. */
.lc-button--secondary:hover,
.lc-button--secondary:focus-visible {
	color: var(--ds-color-text-link-hover);
	border-color: var(--ds-color-text-link-hover);
}
.lc-button--secondary:active {
	background-color: var(--ds-color-background-button-secondary-pressed);
}

.lc-button--accent {
	background-color: var(--ds-color-background-button-accent-default);
	color: var(--ds-color-text-button-accent);
}
.lc-button--accent {
	/* Only one non-default accent-button token exists upstream (pressed);
	   used for both the hover wipe and active. */
	--lc-wipe: var(--ds-color-background-button-accent-pressed);
}
.lc-button--accent:active {
	background-color: var(--ds-color-background-button-accent-pressed);
}

/* White background / navy text, for use on a navy ground (header, drawer
   foot). See file header note on the token choice. */
.lc-button--on-dark {
	background-color: var(--ds-color-background-button-secondary-default);
	color: var(--ds-color-text-badge-default);
}
.lc-button--on-dark {
	--lc-wipe: var(--ds-color-background-button-secondary-hover);
}

/* Header CTA button */
.lc-button--nav {
	background-color: var(--ds-color-background-header-nav-button-default);
	color: var(--ds-color-text-header-nav-button);
	border-radius: var(--ds-radius-button-header-nav);
}
.lc-button--nav {
	--lc-wipe: var(--ds-color-background-header-nav-button-hover);
}

.lc-button--small {
	min-height: 2.25rem;
	padding: var(--ds-space-050) var(--ds-space-100);
	font: var(--ds-font-button-2);
}

/* Icon-only: square, transparent, decorative chrome supplied by whatever
   sits behind it (header bar, card). Needs an aria-label at the call site. */
.lc-button--icon {
	width: 2.75rem;
	height: 2.75rem;
	min-height: 0;
	padding: 0;
	background-color: transparent;
	color: inherit;
	border-color: transparent;
}
/* Icon buttons keep a plain background change — a wipe on a 44px square
   reads as flicker. */
.lc-button--icon::before {
	display: none;
}
.lc-button--icon:hover {
	background-color: var(--ds-color-background-action-secondary-hover);
}

.lc-button:disabled,
.lc-button[aria-disabled='true'] {
	background-color: var(--ds-color-background-disabled);
	color: var(--ds-color-text-disabled);
	border-color: transparent;
	cursor: not-allowed;
}

/* -------------------------------------------------------------------------
 * 7. Chips / badges (spec §6)
 * ---------------------------------------------------------------------- */

.lc-chip {
	display: inline-flex;
	align-items: center;
	padding: var(--ds-space-025) var(--ds-space-075);
	background: var(--ds-color-background-badge-default);
	color: var(--ds-color-text-badge-default);
	border: 1px solid transparent;
	border-radius: var(--ds-radius-rounded);
	font: var(--ds-font-utility-2-uppercase);
	text-transform: uppercase;
	text-decoration: none;
	letter-spacing: var(--ds-font-letter-spacing-wide);
	transition: background-color var(--lc-speed) var(--lc-ease);
}

.lc-chip--outline {
	background: transparent;
	color: var(--ds-color-text-default);
	border-color: var(--ds-color-border-default);
}

a.lc-chip:hover {
	background: var(--ds-color-background-button-accent-pressed);
}

.lc-chip-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ds-space-050);
}

/* -------------------------------------------------------------------------
 * 8. Eyebrow / meta / icon (spec §6)
 * ---------------------------------------------------------------------- */

.lc-eyebrow {
	font: var(--ds-font-utility-2-uppercase);
	text-transform: uppercase;
	color: var(--ds-color-text-subdued);
	letter-spacing: var(--ds-font-letter-spacing-wide);
}

.lc-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	font: var(--ds-font-utility-2-default);
	color: var(--ds-color-text-subdued);
}

.lc-meta__sep {
	margin-inline: var(--ds-space-050);
}

.lc-icon {
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
}

/* -------------------------------------------------------------------------
 * 9. Embed (spec §6, §7 — content.css wraps oEmbed iframes in this)
 * ---------------------------------------------------------------------- */

.lc-embed {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
}

.lc-embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Spotify track/episode embeds render at a fixed 152px height, not 16:9. */
.lc-embed--spotify {
	aspect-ratio: unset;
	height: 152px;
}

.lc-embed--square {
	aspect-ratio: 1;
}

/* -------------------------------------------------------------------------
 * 10. Reduced motion — placed last so equal-specificity rules above lose the
 *     cascade to these, with no !important anywhere.
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	a,
	.lc-button,
	.lc-chip {
		transition: none;
	}
}
