/* AO Pass main stylesheet */

/* Fonts (self-hosted, no Google requests: GDPR-safe for IT/ES/DE visitors) */
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/barlow-condensed-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/barlow-condensed-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
	--court: #1c4e9e;
	--court-deep: #0f2f66;
	--sky: #5baeea;
	--heat: #f5b32a;
	--live: #d62839;
	--ink: #16233b;
	--muted: #56657e;
	--rule: #d6e0ec;
	--mist: #eef3f9;
	--paper: #ffffff;

	--font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;

	--text-col: 46rem;
	--data-col: 76rem;
	--gutter: clamp(1rem, 4vw, 2rem);

	/* Tennis API Hub widgets follow the theme */
	--tah-dark: var(--court-deep);
	--tah-dark-2: var(--court);
	--tah-primary: var(--court);
	--tah-accent: var(--heat);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
html:has(body.admin-bar) { scroll-padding-top: calc(5rem + 32px); }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	line-height: 1.6;
	text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--court); text-underline-offset: 0.15em; }
a:hover { color: var(--court-deep); }
:focus-visible { outline: 3px solid var(--heat); outline-offset: 2px; }

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: 0.005em;
	color: var(--ink);
	margin: 2rem 0 0.75rem;
}
h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.4rem; font-weight: 600; }
p, ul, ol { margin: 0 0 1.1rem; }

.wrap { width: 100%; max-width: calc(var(--data-col) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-text { max-width: calc(var(--text-col) + 2 * var(--gutter)); }
.wrap-data { max-width: calc(var(--data-col) + 2 * var(--gutter)); }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 0.6rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* Header */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: var(--paper);
	border-bottom: 3px solid var(--court);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.wordmark {
	display: inline-flex; align-items: center; gap: 0.5rem;
	font-family: var(--font-display); font-weight: 700; font-size: 1.6rem;
	color: var(--court-deep); text-decoration: none; white-space: nowrap;
}
.wordmark-ball { width: 1.5rem; height: 1.5rem; }
.wordmark-ball circle { fill: var(--heat); }
.wordmark-ball path { fill: none; stroke: #fff; stroke-width: 1.6; }
.custom-logo-link img { max-height: 2.75rem; width: auto; display: block; }

.header-nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.primary-nav ul, .lang-switch { list-style: none; margin: 0; padding: 0; }
.primary-nav > ul { display: flex; gap: 0.25rem; }
.primary-nav li { position: relative; }
.primary-nav a {
	display: block; padding: 0.5rem 0.65rem;
	font-family: var(--font-display); font-weight: 600; font-size: 1.1rem;
	color: var(--ink); text-decoration: none;
}
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current-menu-ancestor > a { color: var(--court); }
.primary-nav .current-menu-item > a { box-shadow: inset 0 -3px 0 var(--heat); }
.primary-nav .sub-menu {
	position: absolute; left: 0; top: 100%; min-width: 12rem;
	background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--court);
	padding: 0.35rem 0; display: none;
}
.primary-nav li:hover > .sub-menu, .primary-nav li:focus-within > .sub-menu { display: block; }

.lang-switch { display: flex; gap: 0.15rem; border-left: 1px solid var(--rule); padding-left: 1rem; }
.lang-switch a {
	display: block; padding: 0.3rem 0.45rem;
	font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; text-transform: uppercase;
	color: var(--muted); text-decoration: none; border-radius: 3px;
}
.lang-switch .current-lang a { background: var(--court); color: #fff; }

.nav-toggle {
	display: none; margin-left: auto; align-items: center; gap: 0.5rem;
	background: none; border: 1px solid var(--rule); border-radius: 4px; padding: 0.45rem 0.75rem;
	font: 600 1rem var(--font-display); color: var(--ink); cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
	display: block; width: 1.1rem; height: 2px; background: currentColor; position: relative;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }

@media (max-width: 960px) {
	.nav-toggle { display: inline-flex; }
	.header-inner { flex-wrap: wrap; }
	.header-nav {
		display: none; width: 100%; margin: 0; padding: 0.5rem 0 1rem;
		flex-direction: column; align-items: stretch; gap: 0.75rem;
	}
	.header-nav.is-open { display: flex; }
	.primary-nav > ul { flex-direction: column; gap: 0; }
	.primary-nav a { padding: 0.65rem 0; border-bottom: 1px solid var(--rule); font-size: 1.2rem; }
	.primary-nav .sub-menu { position: static; display: block; border: 0; padding: 0 0 0 1rem; }
	.primary-nav .current-menu-item > a { box-shadow: none; color: var(--court); }
	.lang-switch { border-left: 0; padding-left: 0; }
}

/* Hero */
.hero {
	position: relative; overflow: hidden;
	background: var(--court); color: #fff;
	padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
}
.hero-court {
	position: absolute; right: -4rem; top: 50%; width: min(34rem, 70vw);
	transform: translateY(-50%) rotate(-62deg);
	pointer-events: none;
}
.hero-court rect, .hero-court line { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 3; }
.hero-court .net { stroke: rgba(255, 255, 255, 0.5); stroke-dasharray: 2 6; }
.hero-inner { position: relative; }
.hero-title { color: #fff; margin: 0 0 0.35rem; font-size: clamp(2.6rem, 7vw, 4.5rem); }
.hero-venue { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--sky); margin: 0 0 0.75rem; }
.hero-lede { max-width: 34rem; font-size: 1.15rem; margin: 0 0 2rem; color: rgba(255, 255, 255, 0.92); }

/* Scoreboard: the one bold element */
.scoreboard {
	display: inline-block; max-width: 100%;
	background: var(--court-deep);
	border-top: 4px solid var(--heat);
	padding: 1.1rem 1.4rem 1rem;
}
.sb-cells { display: flex; }
.sb-cell { display: flex; flex-direction: column; align-items: center; min-width: 5.5rem; padding: 0 1.1rem; }
.sb-cell + .sb-cell { border-left: 2px solid rgba(255, 255, 255, 0.85); }
.sb-cell:first-child { padding-left: 0.2rem; }
.sb-num {
	font-family: var(--font-display); font-weight: 700;
	font-size: clamp(3rem, 9vw, 5.25rem); line-height: 1;
	font-variant-numeric: tabular-nums; color: #fff;
}
.sb-label { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--sky); margin-top: 0.25rem; }
.sb-caption { margin: 0.85rem 0 0; font-size: 1rem; color: rgba(255, 255, 255, 0.85); }
.sb-day { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; margin: 0 0 0.9rem; }
.scoreboard[data-phase="during"] { border-top-color: var(--live); }
.sb-status .button { margin-top: 0.1rem; }

@media (max-width: 720px) {
	.hero-court rect, .hero-court line { stroke: rgba(255, 255, 255, 0.14); }
}

@media (max-width: 480px) {
	.scoreboard { display: block; padding: 1rem; }
	.sb-cell { min-width: 0; flex: 1; padding: 0 0.6rem; }
}

/* Buttons */
.button, .wp-block-button__link {
	display: inline-block; padding: 0.7rem 1.2rem;
	background: var(--court); color: #fff; border-radius: 4px;
	font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; text-decoration: none;
}
.button:hover, .wp-block-button__link:hover { background: var(--court-deep); color: #fff; }
.hero .button { background: #fff; color: var(--court-deep); }
.hero .button:hover { background: var(--heat); color: var(--ink); }
.hero .button-live { background: var(--live); color: #fff; }

/* Guide list (home) */
.guide { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: 1rem; }
.guide-title { margin-top: 0; }
.guide-list {
	list-style: none; margin: 0; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); column-gap: 2.5rem;
}
.guide-list li { border-bottom: 2px solid var(--rule); }
.guide-list a { display: block; padding: 1rem 0; text-decoration: none; color: var(--ink); }
.guide-name { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1.15; }
.guide-desc { display: block; color: var(--muted); font-size: 1rem; margin-top: 0.2rem; }
.guide-list a:hover .guide-name { color: var(--court); }
.guide-list li:has(a:hover) { border-bottom-color: var(--court); }

/* Entries */
.entry { padding-top: 1.5rem; padding-bottom: 3rem; }
.front-content { padding-top: 1rem; }
.front-content .entry-content { max-width: var(--text-col); }
.crumbs { font-size: 0.95rem; color: var(--muted); margin-bottom: 0.5rem; }
.crumbs a { color: var(--muted); }
.entry-head { margin-bottom: 1.5rem; border-bottom: 2px solid var(--rule); padding-bottom: 1rem; }
.entry-title { margin: 0 0 0.5rem; }
.updated, .byline { margin: 0; font-size: 0.95rem; color: var(--muted); }
.entry-media { margin: 0 0 1.5rem; }
.entry-media img { display: block; width: 100%; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content li { margin-bottom: 0.35rem; }
.entry-content blockquote { margin: 1.5rem 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 4px solid var(--court); color: var(--muted); }

/* Tables (API data and editor tables) */
.table-scroll { overflow-x: auto; margin: 1.5rem 0; -webkit-overflow-scrolling: touch; }
.table-scroll table, .wp-block-table table { margin: 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; font-variant-numeric: tabular-nums; }
.entry-content th {
	background: var(--court-deep); color: #fff; text-align: left;
	font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
	padding: 0.6rem 0.75rem; white-space: nowrap;
}
.entry-content td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.entry-content tbody tr:nth-child(even) td { background: var(--mist); }
.wp-block-table { margin: 1.5rem 0; }
.wp-block-table thead { border-bottom: 0; }

/* Rank Math FAQ block */
.rank-math-faq-item { border-bottom: 1px solid var(--rule); padding: 0.5rem 0 0.75rem; }
.rank-math-question { font-size: 1.3rem; margin: 0.75rem 0 0.35rem; }

/* Post list */
.post-list { list-style: none; padding: 0; }
.post-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.post-list time { color: var(--muted); white-space: nowrap; font-size: 0.95rem; }
.nav-links { display: flex; gap: 0.5rem; margin-top: 1.5rem; }

.not-found { padding-top: 4rem; padding-bottom: 5rem; }

/* Footer */
.site-footer { background: var(--court-deep); color: rgba(255, 255, 255, 0.85); padding: 2.5rem 0; margin-top: 3rem; font-size: 0.95rem; }
.footer-nav ul { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.footer-nav a { color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.footer-nav a:hover { color: var(--heat); }
.disclaimer { max-width: 40rem; }
.copy { margin: 0; color: rgba(255, 255, 255, 0.6); }

/* WordPress core helpers */
.alignwide { max-width: var(--data-col); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

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

/* ==================================================================
 * Reading components (v1.1)
 * ================================================================ */

/* Layout: content + sidebar */
.layout-sidebar { display: grid; grid-template-columns: minmax(0, var(--text-col)) 19rem; gap: 3rem; justify-content: center; align-items: start; }
.layout-sidebar > .entry { padding-left: 0; padding-right: 0; }
.sidebar { padding-top: 1.5rem; }
.sidebar-inner { position: sticky; top: 5.5rem; display: grid; gap: 1.5rem; }
@media (max-width: 1100px) {
	.layout-sidebar { grid-template-columns: minmax(0, 1fr); max-width: calc(var(--text-col) + 2 * var(--gutter)); gap: 0; }
	.sidebar { padding-top: 0; padding-bottom: 1rem; }
	.sidebar-inner { position: static; }
	.sidebar .latest { display: none; } /* Keep Reading covers this on small screens */
}

/* Section titles with the two-tone bar */
.side-title, .section-title {
	position: relative; display: flex; align-items: center; gap: 0.7rem;
	margin: 0; font-family: var(--font-display); font-weight: 700; color: var(--ink);
}
.side-title::before, .section-title::before {
	content: ""; flex: none; width: 5px; height: 1.15em; border-radius: 3px;
	background: linear-gradient(var(--heat) 0 45%, var(--court-deep) 45% 100%);
}
.side-title { font-size: 1.45rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--rule); }
.section-title { font-size: clamp(1.7rem, 3vw, 2.1rem); padding-bottom: 0.75rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.5rem; }

/* Table of contents */
.toc {
	position: relative; margin: 1.75rem 0 2rem;
	background: var(--paper); border: 1px solid var(--rule); border-radius: 16px;
	box-shadow: 0 1px 2px rgba(15, 47, 102, 0.05); overflow: hidden;
}
.toc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--court) , var(--court-deep)); }
.toc summary {
	display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1rem 0.9rem 1.4rem;
	cursor: pointer; list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc-icon { flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 12px; background: #e6eef9; }
.toc-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: var(--court); stroke-width: 2.2; stroke-linecap: round; }
.toc-title { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--ink); }
.toc-meta { margin-left: auto; color: var(--muted); font-size: 0.95rem; white-space: nowrap; }
.toc-chev { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--mist); }
.toc-chev svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.toc[open] .toc-chev svg { transform: rotate(180deg); }
.toc summary:hover .toc-chev { background: #dfe8f4; }
.toc-list { list-style: none; margin: 0; padding: 0.25rem 1.25rem 1rem 1.4rem; border-top: 1px solid var(--rule); }
.toc-list li { margin: 0; }
.toc-list a { display: flex; gap: 0.9rem; align-items: baseline; padding: 0.55rem 0; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--mist); }
.toc-list li:last-child a { border-bottom: 0; }
.toc-list a:hover { color: var(--court); }
.toc-num { font-family: var(--font-display); font-weight: 700; color: var(--court); min-width: 1.6rem; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
	.toc-meta { display: none; }
	.toc-chev { margin-left: auto; }
	.toc-title { font-size: 1.25rem; }
}

/* Sidebar card: Latest */
.side-card { background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; padding: 1.25rem 1.4rem 0.5rem; }
.latest-list { list-style: none; margin: 0; padding: 0; }
.latest-list li { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.latest-list li:last-child { border-bottom: 0; }
.latest-num { flex: none; min-width: 2rem; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1.2; color: var(--court); font-variant-numeric: tabular-nums; }
.latest-list a { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.25; color: var(--ink); text-decoration: none; }
.latest-list a:hover { color: var(--court); }
.latest-date { display: block; margin-top: 0.35rem; font-size: 0.9rem; color: var(--muted); }

/* Keep Reading cards */
.keep-reading { padding-top: 1rem; padding-bottom: 3.5rem; }
.kr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 900px) { .kr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kr-grid { grid-template-columns: minmax(0, 1fr); } }
.kr-card { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; }
.kr-media { display: block; position: relative; aspect-ratio: 1200 / 630; background: var(--court-deep); border-bottom: 4px solid var(--heat); overflow: hidden; }
.kr-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kr-placeholder { position: absolute; inset: 0; display: grid; place-items: center; background: var(--court); }
.kr-placeholder svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.kr-placeholder rect, .kr-placeholder line { fill: none; stroke: rgba(255, 255, 255, 0.3); stroke-width: 2; }
.kr-placeholder .net { stroke: rgba(255, 255, 255, 0.55); stroke-dasharray: 2 5; }
.kr-ph-label { position: relative; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: #fff; background: var(--court-deep); padding: 0.2rem 0.8rem; border-radius: 6px; }
.kr-body { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.1rem 1.25rem 1.3rem; flex: 1; }
.kr-label { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--court); }
.kr-title { margin: 0; font-size: 1.35rem; line-height: 1.2; }
.kr-title a { color: var(--ink); text-decoration: none; }
.kr-card:hover .kr-title a { color: var(--court); }
.kr-date { margin-top: auto; font-size: 0.92rem; font-weight: 600; color: var(--muted); }

/* Logged-in admin bar: keep the sticky header and anchors clear of it */
.admin-bar .site-header { top: 32px; }
.admin-bar { scroll-padding-top: calc(5rem + 32px); }
@media (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}
@media (max-width: 600px) {
	.admin-bar .site-header { top: 0; } /* WP admin bar scrolls away on small phones */
}
