/*
 * Carl and Katie: design system
 * --------------------------------
 * Tokens, base typography, components, header and footer. Loaded after the
 * inherited Monochrome Pro style.css, so these rules override that look.
 *
 * Direction: "the Suffolk folklore almanac", aligned to the brand logo.
 * Deep navy is the dominant brand surface (header, footer, punctuation bands),
 * antique gold is the accent and primary button colour, warm parchment cream is the
 * reading background. Claret and teal are kept as minor folklore accents.
 * Abril Fatface for display, Lora for body. The signature device is the rule
 * of three: an almanac-style divider ornament (.cak-rule) that echoes the
 * fleur-de-lis divider used on the original fork.
 *
 * Design source of truth: the That History Guy repo,
 * design-system/the-history-guy/MASTER.md (this theme is a fork of it).
 *
 * Contents
 *   1. Tokens
 *   2. Base + typography
 *   3. Links
 *   4. Layout overrides (Genesis / Monochrome)
 *   5. Header + primary nav
 *   6. Buttons
 *   7. Divider ornament (signature)
 *   8. Cards + sections
 *   9. Footer
 *  10. Accessibility + responsive
 */

/* 1. Tokens
   ------------------------------------------------------------------------- */
:root {
	/* Primary brand: navy + gold, taken from the logo. */
	--cak-navy: #1b2b4d;
	--cak-navy-dark: #132038;
	--cak-gold: #b6913c;
	--cak-gold-dark: #98782e;

	/* Folklore accents (secondary). */
	--cak-claret: #901730;
	--cak-teal: #009cbd;
	--cak-teal-dark: #007a94;
	--cak-green: #2c5234;   /* demoted to a minor accent */
	--cak-brown: #7d6155;
	--cak-olive: #47432b;

	--cak-bg: #f7f1e6;      /* warm cream, matched to the logo background */
	--cak-surface: #ffffff;
	--cak-surface-tint: #efe7d6;
	--cak-text: #232021;
	--cak-text-muted: #6a5f52;
	--cak-border: #ded3c0;

	/* on navy bands */
	--cak-on-dark: #f4eedf;
	--cak-on-dark-muted: #b9c0cf;

	--cak-display: 'Abril Fatface', Georgia, 'Times New Roman', serif;
	--cak-body: 'Lora', Georgia, 'Times New Roman', serif;

	--cak-space-xs: 0.25rem;
	--cak-space-sm: 0.5rem;
	--cak-space-md: 1rem;
	--cak-space-lg: 1.5rem;
	--cak-space-xl: 2rem;
	--cak-space-2xl: 3rem;
	--cak-space-3xl: 5rem;
	--cak-space-4xl: 7rem;

	--cak-radius-sm: 4px;
	--cak-radius-md: 8px;
	--cak-radius-lg: 14px;

	--cak-shadow-sm: 0 1px 2px rgba(27, 43, 77, 0.08);
	--cak-shadow-md: 0 8px 20px rgba(27, 43, 77, 0.12);

	--cak-measure: 42rem; /* comfortable reading column */
	--cak-wrap: 1140px;   /* max content width */
	--cak-gutter: clamp(1rem, 4vw, 2rem);
}

/* 2. Base + typography
   ------------------------------------------------------------------------- */
body {
	font-family: var(--cak-body);
	font-size: 1.125rem;
	font-weight: 400;
	line-height: 1.65;
	color: var(--cak-text);
	background-color: var(--cak-bg);
}

h1, h2, h3, h4, h5, h6 {
	color: var(--cak-navy);
	font-weight: 700;
	line-height: 1.2;
}

h1, h2 {
	font-family: var(--cak-display);
	font-weight: 400; /* Abril Fatface ships a single weight */
	letter-spacing: 0.01em;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); line-height: 1.05; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); line-height: 1.15; }
h3 { font-family: var(--cak-body); font-size: 1.375rem; }
h4 { font-family: var(--cak-body); font-size: 1.0625rem; text-transform: uppercase; letter-spacing: 0.08em; }

p { margin: 0 0 var(--cak-space-lg); }

/* Do not cap paragraph/list width separately from headings: the reading
   measure is controlled by each section's constrained content width, so
   headings and body text share the same left edge and width. Capping
   paragraphs narrower than headings is what made them look misaligned. */

.lead,
.entry-content > .lead {
	font-size: 1.3125rem;
	line-height: 1.6;
	color: var(--cak-text);
}

blockquote,
.wp-block-quote {
	font-style: italic;
	font-size: 1.5rem;
	line-height: 1.4;
	color: var(--cak-navy);
	border-left: 3px solid var(--cak-gold);
	padding-left: var(--cak-space-lg);
	margin-inline: 0;
}

/* 3. Links
   ------------------------------------------------------------------------- */
a {
	color: var(--cak-teal-dark);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
	transition: color 160ms ease;
}
a:hover,
a:focus {
	color: var(--cak-gold-dark);
}

.entry-content a {
	text-decoration: underline;
}

/* 4. Layout overrides (Genesis / Monochrome)
   -------------------------------------------------------------------------
   Monochrome ships a "white card on a coloured body" look with a top margin
   and a fixed footer. We flatten those so sections can run full width on a
   warm background, the same fixes the Battery Benefits fork documented. */
.site-inner {
	background: transparent;
	margin-top: 0;
	max-width: var(--cak-wrap);
	padding-inline: var(--cak-gutter);
}

.site-header > .wrap,
.site-footer > .wrap {
	padding-inline: var(--cak-gutter);
}

/* Free the inherited fixed prose width on the home page so full-bleed
   sections built from Gutenberg blocks have room. */
.cak-home .site-inner,
.cak-home .content,
.cak-home .entry,
.cak-home .entry-content {
	width: 100%;
	max-width: none;
}

/* 5. Header + primary nav
   ------------------------------------------------------------------------- */
/* Social utility bar at the very top, above the cream header. Navy to bookend
   with the navy footer; cream icons that warm to gold on hover. */
.cak-social-bar {
	background: var(--cak-navy);
}
.cak-social-bar-inner {
	max-width: var(--cak-wrap);
	margin-inline: auto;
	padding: 0.3rem var(--cak-gutter);
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: var(--cak-space-xs);
}
.cak-social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.45rem;
	color: var(--cak-on-dark);
	line-height: 0;
	border-radius: 50%;
	transition: color 160ms ease, background-color 160ms ease;
}
.cak-social-link svg {
	width: 20px;
	height: 20px;
}
.cak-social-link:hover,
.cak-social-link:focus {
	color: var(--cak-gold);
	background-color: rgba(255, 255, 255, 0.08);
}
@media (max-width: 880px) {
	.cak-social-bar-inner {
		justify-content: center;
	}
}

/* Cream "letterhead" header, matched to the logo's background so the navy +
   gold crest sits legibly. Navy is still the brand primary (footer, bands,
   headings); the header is light only because the logo requires it. */
.site-header {
	background-color: #f6efe6;
	border-bottom: 3px solid var(--cak-gold);
}
.site-header .wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--cak-space-md);
	padding-block: var(--cak-space-md);
}

.site-title {
	font-family: var(--cak-display);
	font-weight: 400;
	font-size: clamp(1.875rem, 4vw, 2.875rem);
	line-height: 1.05;
	margin: 0;
}
.site-title a,
.site-title a:hover {
	color: var(--cak-navy);
	text-decoration: none;
}
.site-description {
	color: var(--cak-text-muted);
	font-style: italic;
	font-size: 0.9375rem;
	margin: 0;
}

/* The custom logo (navy + gold crest on cream). Large, since it is the
   stacked crest + wordmark lockup; the cream header blends its background.
   The Genesis-output width/height attributes are overridden here. */
.site-header .custom-logo,
.site-header img.custom-logo {
	height: auto;
	max-height: 190px;
	width: auto;
	max-width: 100%;
	display: block;
}

/* Primary nav links on the navy header */
.nav-primary .genesis-nav-menu,
.nav-primary .menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--cak-space-xs) var(--cak-space-md);
}
.nav-primary .genesis-nav-menu a,
.nav-primary .menu a {
	color: var(--cak-navy);
	font-family: var(--cak-body);
	font-weight: 600;
	font-size: 1rem;
	text-decoration: none;
	padding: var(--cak-space-xs) 0;
}
.nav-primary .genesis-nav-menu a:hover,
.nav-primary .genesis-nav-menu .current-menu-item > a {
	color: var(--cak-gold-dark);
}

/* The booking CTA appended to the primary nav */
.nav-primary .cak-nav-cta a,
.genesis-nav-menu .cak-nav-cta a {
	background: var(--cak-gold);
	color: var(--cak-navy);
	font-weight: 700;
	border-radius: var(--cak-radius-md);
	padding: 0.5rem 1rem;
}
.nav-primary .cak-nav-cta a:hover,
.genesis-nav-menu .cak-nav-cta a:hover {
	background: #fff;
	color: var(--cak-navy);
}

/* 6. Buttons
   ------------------------------------------------------------------------- */
.cak-btn,
.entry-content .wp-block-button__link,
.entry-content .button,
button.cak-btn {
	font-family: var(--cak-body);
	font-weight: 600;
	font-size: 1.0625rem;
	line-height: 1;
	display: inline-block;
	padding: 0.875rem 1.75rem;
	border: 0;
	border-radius: var(--cak-radius-md);
	cursor: pointer;
	text-decoration: none;
	transition: background-color 180ms ease, color 180ms ease;
}
/* Primary button: navy text on gold. */
.cak-btn-primary,
.entry-content .wp-block-button__link {
	background: var(--cak-gold);
	color: var(--cak-navy);
}
.cak-btn-primary:hover,
.entry-content .wp-block-button__link:hover {
	background: var(--cak-gold-dark);
	color: #fff;
}
/* Secondary: outline in navy, used for media enquiry / watch. */
.cak-btn-secondary,
.entry-content .is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--cak-navy);
	border: 2px solid var(--cak-navy);
	padding: calc(0.875rem - 2px) calc(1.75rem - 2px);
}
.cak-btn-secondary:hover,
.entry-content .is-style-outline .wp-block-button__link:hover {
	background: var(--cak-navy);
	color: #fff;
}

/* 7. Divider ornament (signature)
   -------------------------------------------------------------------------
   An almanac-style section divider echoing the logo's fleur-de-lis rule:
   a centre mark flanked by hairlines, the rule of three made literal. Markup:
     <div class="cak-rule"><span class="cak-rule-mark">&#9670; &#9670; &#9670;</span></div>
   A bare <hr class="cak-rule"> also works and shows just the hairlines. */
.cak-rule {
	border: 0;
	height: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--cak-space-md);
	color: var(--cak-gold);
	margin-block: var(--cak-space-2xl);
}
.cak-rule::before,
.cak-rule::after {
	content: "";
	flex: 0 1 5rem;
	height: 1px;
	background: currentColor;
	opacity: 0.6;
}
.cak-rule-mark {
	color: var(--cak-gold);
	font-size: 0.75rem;
	letter-spacing: 0.4em;
	line-height: 1;
}

/* 8. Cards + sections
   ------------------------------------------------------------------------- */
.cak-card {
	background: var(--cak-surface);
	border: 1px solid var(--cak-border);
	border-radius: var(--cak-radius-lg);
	padding: var(--cak-space-lg);
	box-shadow: var(--cak-shadow-sm);
}

.cak-section {
	padding-block: var(--cak-space-xl);
	/* Inline gutter so the constrained content inside these full-bleed
	   (alignfull) groups never runs to the screen edge on mobile. The section
	   background still bleeds edge to edge; only the content is inset. */
	padding-inline: var(--cak-gutter);
}
.cak-section--tint { background: var(--cak-surface-tint); }
.cak-section--navy {
	background: var(--cak-navy);
	color: var(--cak-on-dark);
}
.cak-section--navy h1,
.cak-section--navy h2,
.cak-section--navy h3 { color: var(--cak-on-dark); }

@media (min-width: 768px) {
	.cak-section { padding-block: var(--cak-space-2xl); }
}
@media (min-width: 1024px) {
	.cak-section { padding-block: var(--cak-space-3xl); }
}

/* 8a. Video embeds
   -------------------------------------------------------------------------
   YouTube Shorts (and any portrait 9:16 clip) embed as responsive blocks.
   Left uncapped, a 9:16 video stretches to the full content width and renders
   close to 1,800px tall, swamping the whole page. Cap portrait embeds to a
   phone-sized frame and centre them. Landscape embeds keep their full width.
   The aspect ratio is declared here rather than relying on WP core's embed
   stylesheet, so a short stays correctly proportioned even if that core CSS
   is not enqueued on this Genesis build. */
.entry-content .wp-block-embed.wp-embed-aspect-9-16 {
	max-width: 360px;
	margin-inline: auto;
}
.entry-content .wp-block-embed.wp-embed-aspect-9-16 .wp-block-embed__wrapper {
	position: relative;
	width: 100%;
	aspect-ratio: 9 / 16;
}
.entry-content .wp-block-embed.wp-embed-aspect-9-16 .wp-block-embed__wrapper iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

/* 8b. Single-post featured-image header
   -------------------------------------------------------------------------
   On a single post with a featured image, the inherited Monochrome layout
   lays the photo full width (.entry-background) and pulls the entry header
   (avatar + title) up over its lower third. The brand title is navy, which
   vanishes against a dark photo. We darken the foot of the photo with a navy
   scrim and set the title in cream so it reads over any image. Scoped to
   .featured-image so ordinary headers are untouched. */
.featured-image .entry-background {
	position: relative;
}
.featured-image .entry-background::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(19, 32, 56, 0) 0%,
		rgba(19, 32, 56, 0.45) 40%,
		rgba(19, 32, 56, 0.82) 70%,
		rgba(19, 32, 56, 0.94) 100%
	);
	pointer-events: none;
}
.featured-image .entry-title {
	color: var(--cak-on-dark);
	text-shadow: 0 1px 16px rgba(19, 32, 56, 0.6), 0 1px 3px rgba(19, 32, 56, 0.5);
}
/* The inherited header rule (the short divider under the title) is a black
   hairline; recolour it gold so it shows against the scrim. */
.featured-image .entry-header::after {
	border-bottom-color: var(--cak-gold);
}

/* 9. Footer
   -------------------------------------------------------------------------
   Monochrome sets the footer to fixed/hidden as a scroll gimmick. Force it
   back to normal flow (per the Battery Benefits fork notes) and dress it as a
   deep-navy closing band with the wordmark and copyright line. */
.site-footer {
	position: static;
	z-index: auto;
	background: var(--cak-navy);
	color: var(--cak-on-dark);
	text-align: center;
	padding-block: var(--cak-space-2xl);
	font-size: 1rem;
}
.site-footer a {
	color: var(--cak-gold);
}
.site-footer a:hover {
	color: #fff;
}
.footer-wordmark {
	font-family: var(--cak-display);
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	margin: 0 0 var(--cak-space-sm);
}
.footer-wordmark a,
.footer-wordmark a:hover {
	color: var(--cak-on-dark);
	text-decoration: none;
}
.footer-credit {
	color: var(--cak-on-dark-muted);
	margin: 0 0 var(--cak-space-xs);
}
.footer-signoff-wrap {
	margin: 0;
	font-size: 1.125rem;
}
.footer-signoff a {
	font-weight: 700;
}

/* Before-footer CTA widget band */
.before-footer-cta {
	background: var(--cak-surface-tint);
	padding-block: var(--cak-space-2xl);
	text-align: center;
}


/* 10. Accessibility + responsive
   ------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.wp-block-button__link:focus-visible {
	outline: 3px solid var(--cak-teal);
	outline-offset: 2px;
}

@media (max-width: 880px) {
	.site-header .wrap {
		flex-direction: column;
		align-items: flex-start;
	}
	.site-header .custom-logo,
	.site-header img.custom-logo {
		max-height: 120px;
	}
}

/* Mobile primary navigation (the responsive "Menu" toggle).
   The desktop nav is a horizontal flex row; the Genesis responsive script
   reuses the same markup for the toggle menu. Below the 1023px breakpoint
   (where the parent theme activates the toggle) we undo the flex row so the
   items stack as full-width tappable rows instead of wrapping into a broken
   two-column grid. */
@media (max-width: 1023px) {
	.nav-primary .genesis-nav-menu,
	.nav-primary .menu {
		display: block;
		gap: 0;
	}
	.nav-primary .genesis-nav-menu .menu-item,
	.nav-primary .menu .menu-item {
		display: block;
		width: 100%;
		margin: 0;
		text-align: center;
	}
	.nav-primary .genesis-nav-menu a,
	.nav-primary .menu a {
		display: block;
		width: 100%;
		padding: 0.9rem var(--cak-gutter);
		font-size: 1.0625rem;
	}
	.nav-primary .genesis-nav-menu .menu-item:not(.cak-nav-cta) a {
		border-top: 1px solid var(--cak-border);
	}
	/* Booking CTA keeps its gold button, set apart at the foot of the menu. */
	.nav-primary .cak-nav-cta a,
	.genesis-nav-menu .cak-nav-cta a {
		width: auto;
		margin: var(--cak-space-md) var(--cak-gutter) var(--cak-space-sm);
		border-radius: var(--cak-radius-md);
	}
	/* Brand the toggle button (the parent theme leaves it default blue). */
	.menu-toggle,
	.menu-toggle:focus,
	.menu-toggle:hover {
		color: var(--cak-navy);
	}
}

/* Stories listing: Genesis Blocks post grid. Give the card text a little
   inline breathing room so titles and excerpts don't sit flush against the
   card edge inside the tinted section. */
.gb-block-post-grid-text {
	padding-inline: var(--cak-space-md);
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}
}
