/*
Theme Name: JTC 21 — European AI Standardization
Theme URI: https://jtc21.eu/
Author: CEN-CENELEC JTC 21
Description: Custom WordPress theme for CEN-CENELEC JTC 21, in Dansk Standard's brand palette (navy, ice blue, green). Formal, EU-institutional tone with a modern, action-oriented layout.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: jtc21
*/

/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
	--navy:        #022747;
	--navy-deep:   #00203D;
	--ice:         #88BFE8;
	--ice-soft:    #E7F1FB;
	--green:       #009A44;
	--green-deep:  #00792F;
	--sand:        #D3CBC5;
	--sand-soft:   #F2EDE9;
	--white:       #FFFFFF;
	--paper:       #F7F9FB;
	--card-bg:     #F2F5F8;
	--ink:         #10202F;
	--slate:       #4C6076;
	--line:        #DCE4EC;

	--font-display: 'Inter', 'Segoe UI', Arial, sans-serif;
	--font-body:    'Inter', 'Segoe UI', Arial, sans-serif;

	--container: 1180px;
	--radius: 10px;
	--radius-lg: 18px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--font-body);
	color: var(--ink);
	background: var(--white);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 {
	font-family: var(--font-display);
	color: var(--navy);
	margin: 0 0 0.5em;
	line-height: 1.2;
	font-weight: 800;
	letter-spacing: -0.02em;
}
p { margin: 0 0 1em; max-width: 68ch; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

:focus-visible {
	outline: 3px solid var(--green);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 15px;
	padding: 13px 26px;
	border-radius: 999px;
	border: 2px solid transparent;
	cursor: pointer;
	transition: transform .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
	white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-deep); }
.btn-ghost-light { background: transparent; color: var(--white); border-color: rgba(255,255,255,.55); }
.btn-ghost-light:hover { border-color: var(--white); background: rgba(255,255,255,.08); }
.btn-outline-navy { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline-navy:hover { background: var(--navy); color: var(--white); }
.btn-sm { padding: 9px 18px; font-size: 13px; }

/* Header CTA — always the highest-contrast element on the bar */
.btn-header-cta {
	background: var(--green);
	color: var(--white);
	padding: 11px 22px;
	font-size: 14px;
}
.btn-header-cta:hover { background: var(--green-deep); }
.btn-header-cta span.short { display: none; }

/* ==========================================================================
   Block-editor buttons — forced to match the theme's own .btn system.
   Without this, a WordPress "Buttons" block falls back to WordPress
   core's own default styling (a dark grey/black pill) regardless of what
   colour was picked per-instance in the editor, which is what produced
   the unreadable black-pill-with-green-underlined-text buttons: core's
   default background clashing with this theme's link colour. Overriding
   with !important is deliberate here — the whole point is that every
   button reads the same site-wide no matter what an editor happened to
   set on an individual block.
   ========================================================================== */
.wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 14px !important;
	margin: 1.4em 0;
}
.wp-block-button__link {
	display: inline-flex !important;
	align-items: center;
	font-family: var(--font-display) !important;
	font-weight: 700 !important;
	font-size: 15px !important;
	padding: 13px 26px !important;
	border-radius: 999px !important;
	border: 2px solid transparent !important;
	background: var(--green) !important;
	color: var(--white) !important;
	text-decoration: none !important;
	transition: transform .15s ease, background-color .15s ease;
}
.wp-block-button__link:hover {
	background: var(--green-deep) !important;
	color: var(--white) !important;
	transform: translateY(-1px);
}
/* "Outline" style (available in the block editor's button-style picker)
   maps to the same outlined look as .btn-outline-navy on light
   backgrounds. Use this style for a secondary button next to a primary
   one, instead of picking a custom colour by hand. */
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent !important;
	color: var(--navy) !important;
	border-color: var(--navy) !important;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--navy) !important;
	color: var(--white) !important;
}
/* On a dark section (navy/green background), use the "outline" style too
   — it automatically renders in white so it stays readable there. */
.section-navy .wp-block-button.is-style-outline .wp-block-button__link,
.hero .wp-block-button.is-style-outline .wp-block-button__link,
.cta-band .wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--white) !important;
	border-color: rgba(255,255,255,.55) !important;
}
.section-navy .wp-block-button.is-style-outline .wp-block-button__link:hover,
.hero .wp-block-button.is-style-outline .wp-block-button__link:hover,
.cta-band .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: rgba(255,255,255,.08) !important;
	border-color: var(--white) !important;
}

/* ==========================================================================
   Site header
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--white);
	border-bottom: 1px solid var(--line);
}
.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 14px 0;
}
.site-branding {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}
.site-branding img { height: 40px; width: auto; }
.site-branding .brand-text {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 17px;
	color: var(--navy);
	line-height: 1.15;
}
.site-branding .brand-text small {
	display: block;
	font-family: var(--font-body);
	font-weight: 500;
	font-size: 11px;
	color: var(--slate);
	letter-spacing: .02em;
}

.primary-nav { flex: 1; display: flex; justify-content: center; }
.primary-nav > ul { display: flex; align-items: center; gap: 4px; }
.primary-nav > ul > li { position: relative; }
.primary-nav > ul > li > a {
	display: block;
	padding: 10px 14px;
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 14.5px;
	color: var(--navy);
	border-radius: 8px;
}
.primary-nav > ul > li > a:hover { background: var(--card-bg); }
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a { color: var(--green-deep); }

/* Dropdown */
.primary-nav li.menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	margin-left: 6px;
	width: 6px; height: 6px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
}
.primary-nav .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 320px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 16px 40px rgba(2,39,71,.14);
	padding: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.primary-nav li.menu-item-has-children:hover > .sub-menu,
.primary-nav li.menu-item-has-children:focus-within > .sub-menu {
	opacity: 1; visibility: visible; transform: translateY(0);
}
.primary-nav .sub-menu a {
	display: block;
	padding: 10px 12px;
	border-radius: 6px;
	font-family: var(--font-body);
	font-size: 14px;
	color: var(--ink);
}
.primary-nav .sub-menu a:hover { background: var(--card-bg); color: var(--navy); }

.header-cta { flex-shrink: 0; }

.nav-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
}
.nav-toggle span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--navy);
	margin: 5px 0;
	transition: transform .2s ease, opacity .2s ease;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
	background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
	color: var(--white);
	overflow: hidden;
	position: relative;
}
.hero-inner {
	display: grid;
	grid-template-columns: 1.1fr 0.9fr;
	gap: 40px;
	align-items: center;
	padding: 76px 0 84px;
}
.hero-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-size: 13px;
	font-weight: 600;
	color: var(--ice);
	background: rgba(136,191,232,.12);
	border: 1px solid rgba(136,191,232,.35);
	padding: 6px 14px;
	border-radius: 999px;
	margin-bottom: 22px;
}
.hero h1 {
	color: var(--white);
	font-size: clamp(32px, 4.2vw, 48px);
	max-width: 15ch;
	margin-bottom: 20px;
}
.hero-lede {
	color: rgba(255,255,255,.82);
	font-size: 17.5px;
	max-width: 46ch;
	margin-bottom: 32px;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-art { position: relative; width: 100%; aspect-ratio: 1 / 0.9; }
.hero-art svg { width: 100%; height: 100%; }

/* ==========================================================================
   Stat strip
   ========================================================================== */
.stat-strip {
	background: var(--white);
	border-bottom: 1px solid var(--line);
}
.stat-strip .container {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
	padding-top: 34px;
	padding-bottom: 34px;
}
.stat-item { text-align: left; border-left: 3px solid var(--green); padding-left: 16px; }
.stat-number {
	font-family: var(--font-display);
	font-size: 30px;
	font-weight: 700;
	color: var(--navy);
	line-height: 1;
	margin-bottom: 6px;
}
.stat-label { font-size: 13.5px; color: var(--slate); }

/* ==========================================================================
   Section scaffolding
   ========================================================================== */
.section { padding: 84px 0; }
.section-sand { background: var(--sand-soft); }
.section-card { background: var(--card-bg); }
.section-navy { background: var(--navy); color: var(--white); }
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-eyebrow {
	font-family: var(--font-display);
	font-size: 13px;
	font-weight: 700;
	color: var(--green-deep);
	margin-bottom: 10px;
}
.section-navy .section-eyebrow { color: var(--ice); }
.section-head h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 14px; }
.section-navy .section-head h2 { color: var(--white); }
.section-head p { color: var(--slate); font-size: 16.5px; }
.section-navy .section-head p { color: rgba(255,255,255,.78); }

/* ==========================================================================
   About / mission split
   ========================================================================== */
.split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 56px;
	align-items: start;
}
.split-copy p { color: var(--slate); font-size: 16px; }
.split-copy p:last-child { margin-bottom: 0; }
.mission-list { display: flex; flex-direction: column; gap: 18px; }
.mission-item { display: flex; gap: 14px; align-items: flex-start; }
.mission-icon {
	flex-shrink: 0;
	width: 40px; height: 40px;
	border-radius: 10px;
	background: var(--ice-soft);
	display: flex; align-items: center; justify-content: center;
	color: var(--navy);
}
.mission-item strong { display: block; font-family: var(--font-display); color: var(--navy); font-size: 15.5px; margin-bottom: 3px; }
.mission-item span { color: var(--slate); font-size: 14.5px; }

/* ==========================================================================
   Facts grid (the Q&A block)
   ========================================================================== */
.facts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.fact-card {
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 26px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.fact-card:hover { border-color: var(--ice); box-shadow: 0 12px 30px rgba(2,39,71,.08); }
.fact-card h3 { font-size: 16.5px; margin-bottom: 8px; }
.fact-card p { font-size: 14.5px; color: var(--slate); margin-bottom: 10px; }
.fact-card a.fact-link { font-size: 13.5px; font-weight: 700; color: var(--green-deep); }
.fact-card a.fact-link:hover { text-decoration: underline; }

/* ==========================================================================
   Working groups strip
   ========================================================================== */
.wg-strip { display: flex; flex-wrap: wrap; gap: 14px; }
.wg-pill {
	display: flex;
	align-items: baseline;
	gap: 10px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 12px 20px;
	font-size: 14px;
	color: var(--ink);
}
.wg-pill b { font-family: var(--font-display); color: var(--navy); }

/* ==========================================================================
   News / resources grid
   ========================================================================== */
.news-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 26px;
}
.news-card {
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.news-thumb {
	aspect-ratio: 16/10;
	background: var(--card-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ice);
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.news-date { font-size: 12.5px; color: var(--slate); font-weight: 600; letter-spacing: .02em; }
.news-card h3 { font-size: 17px; margin-bottom: 4px; }
.news-card h3 a { color: var(--navy); }
.news-card h3 a:hover { color: var(--green-deep); }
.news-excerpt { font-size: 14px; color: var(--slate); flex: 1; }
.news-readmore { font-size: 13.5px; font-weight: 700; color: var(--green-deep); margin-top: auto; }

/* ==========================================================================
   Video section
   ========================================================================== */
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.video-embed { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-lg); overflow: hidden; background: var(--navy-deep); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ==========================================================================
   Closing multi-CTA band
   ========================================================================== */
.cta-band { background: var(--navy); color: var(--white); }
.cta-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}
.cta-card {
	background: rgba(255,255,255,.05);
	border: 1px solid rgba(255,255,255,.14);
	border-radius: var(--radius-lg);
	padding: 30px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.cta-card.is-featured { background: var(--green); border-color: var(--green); }
.cta-card h3 { color: var(--white); font-size: 19px; }
.cta-card p { color: rgba(255,255,255,.78); font-size: 14.5px; margin-bottom: 4px; }
.cta-card.is-featured p { color: rgba(255,255,255,.92); }

/* ==========================================================================
   EU funding notice
   ========================================================================== */
.eu-notice {
	background: var(--paper);
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	padding: 26px 0;
}
.eu-notice .container { display: flex; align-items: flex-start; gap: 18px; }
.eu-flag {
	flex-shrink: 0;
	width: 44px; height: 30px;
	border-radius: 4px;
}
.eu-notice p { font-size: 12.5px; color: var(--slate); margin: 0; max-width: 90ch; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--navy-deep); color: rgba(255,255,255,.75); padding: 60px 0 28px; }
.footer-grid {
	display: grid;
	grid-template-columns: 1.4fr 1fr 1fr 1fr;
	gap: 40px;
	padding-bottom: 40px;
	border-bottom: 1px solid rgba(255,255,255,.12);
}
.footer-brand .brand-text { color: var(--white); font-family: var(--font-display); font-weight: 700; font-size: 17px; margin-bottom: 10px; }
.footer-brand p { color: rgba(255,255,255,.6); font-size: 13.5px; max-width: 34ch; }
.footer-col h4 { font-family: var(--font-display); color: var(--white); font-size: 13px; letter-spacing: .04em; margin-bottom: 14px; }
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
.footer-col a { color: rgba(255,255,255,.72); font-size: 14px; }
.footer-col a:hover { color: var(--ice); }
.footer-bottom {
	padding-top: 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	font-size: 13px;
	color: rgba(255,255,255,.55);
}
.footer-bottom a { color: rgba(255,255,255,.55); }
.footer-bottom a:hover { color: var(--ice); }

/* ==========================================================================
   Generic page content (About, Blog single, etc.)
   ========================================================================== */
.page-hero {
	background: var(--navy);
	color: var(--white);
	padding: 56px 0;
}
.page-hero h1 { color: var(--white); margin: 0; font-size: clamp(28px, 3.6vw, 38px); }
.entry-content { padding: 56px 0; }
.entry-content .container { max-width: 960px; }
.entry-content h2 { margin-top: 1.4em; }
.entry-content p, .entry-content li { color: var(--ink); font-size: 16.5px; }
.entry-content a { color: var(--green-deep); text-decoration: underline; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; margin-bottom: 1em; max-width: 68ch; }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content img { border-radius: var(--radius-lg); margin: 1.5em 0; }

/* Icons and small inline images should display at their natural
   proportions, never cropped. WordPress core applies object-fit:cover
   by default inside several block types (Media & Text, Cover, Columns
   with an image), which is right for photos filling a fixed frame but
   wrong for icons — it zooms/crops them. Restore natural display for
   anything icon-sized, and drop the border-radius/margin treatment
   meant for full photos. */
.entry-content .wp-block-media-text__media img,
.entry-content .wp-block-cover img,
.entry-content .wp-block-column img,
.entry-content .wp-block-image.size-thumbnail img,
.entry-content .wp-block-image.size-icon img {
	object-fit: contain;
	width: auto;
	height: auto;
	max-height: none;
}
/* Manual escape hatch: in the block editor, open an image's Advanced
   panel and add "icon-inline" under Additional CSS Class(es) for any
   icon that's still being cropped/stretched despite the rules above —
   guarantees it displays at its natural size with no cropping. */
.entry-content img.icon-inline {
	object-fit: contain;
	width: auto;
	height: auto;
	max-width: 64px;
	border-radius: 0;
	margin: 0;
}

/* Widget-style / navigational lists that sometimes end up inside page
   content (e.g. a copied-in "Recent Posts" block) are UI, not prose —
   no bullets, no prose max-width, so they don't get the "weird dots"
   the .entry-content ul rule above is meant for body copy. */
.entry-content .wp-block-latest-posts,
.entry-content .wp-block-page-list,
.entry-content .widget ul {
	list-style: none;
	padding-left: 0;
	max-width: none;
}

/* Tables — WordPress applies zero styling by default, which is what was
   making the Working Groups tables unreadable. Full-width, clear
   borders, comfortable padding, and horizontal scroll on small screens
   rather than letting a wide table blow out the layout. */
.entry-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5em 0;
	font-size: 15px;
}
.entry-content table caption {
	text-align: left;
	font-family: var(--font-display);
	color: var(--navy);
	margin-bottom: 8px;
}
.entry-content th, .entry-content td {
	border: 1px solid var(--line);
	padding: 12px 14px;
	text-align: left;
	vertical-align: top;
}
.entry-content thead th {
	background: var(--card-bg);
	font-family: var(--font-display);
	color: var(--navy);
	font-weight: 700;
}
.entry-content tbody tr:nth-child(even) { background: var(--paper); }
.entry-content .table-scroll { overflow-x: auto; }
@media (max-width: 700px) {
	.entry-content table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Inline CTA row utility — for pairing a heading/text (e.g. "Get started
   today!") directly beside a button and its supporting line (e.g. an
   "Online Training" button), instead of them stacking on separate rows.
   Apply in the block editor: wrap both pieces in a Group block, then add
   "cta-inline" under Advanced → Additional CSS Class(es) on that Group.
   Stacks vertically on narrow screens automatically. */
.entry-content .cta-inline {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 20px 32px;
	background: var(--card-bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 24px 28px;
	margin: 1.6em 0;
}
.entry-content .cta-inline > * { margin: 0; }
.entry-content .cta-inline .wp-block-buttons { margin: 0; }
@media (max-width: 560px) {
	.entry-content .cta-inline { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px) {
	.hero-inner { grid-template-columns: 1fr; padding: 48px 0 56px; }
	.hero-art { max-width: 380px; margin: 0 auto; order: -1; }
	.stat-strip .container { grid-template-columns: repeat(2, 1fr); }
	.split { grid-template-columns: 1fr; }
	.facts-grid { grid-template-columns: repeat(2, 1fr); }
	.news-grid { grid-template-columns: repeat(2, 1fr); }
	.cta-grid { grid-template-columns: 1fr; }
	.video-grid { grid-template-columns: 1fr; }
	.footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
	.primary-nav { display: none; }
	.nav-toggle { display: block; }
	.header-cta .btn-header-cta span.long { display: none; }
	.header-cta .btn-header-cta span.short { display: inline; }

	.site-header.is-open .primary-nav {
		display: block;
		position: absolute;
		top: 100%; left: 0; right: 0;
		background: var(--white);
		border-bottom: 1px solid var(--line);
		box-shadow: 0 16px 30px rgba(2,39,71,.12);
		padding: 10px;
	}
	.site-header.is-open .primary-nav > ul { flex-direction: column; align-items: stretch; gap: 2px; }
	.site-header.is-open .primary-nav .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; padding-left: 14px; display: none; }
	.site-header.is-open .primary-nav li.menu-item-has-children.is-open .sub-menu { display: block; }

	.stat-strip .container { grid-template-columns: 1fr 1fr; }
	.facts-grid { grid-template-columns: 1fr; }
	.news-grid { grid-template-columns: 1fr; }
	.footer-grid { grid-template-columns: 1fr 1fr; }
	.section { padding: 56px 0; }
}

@media (max-width: 480px) {
	.footer-grid { grid-template-columns: 1fr; }
	.hero-ctas .btn { width: 100%; justify-content: center; }
}
