/*
  Section panels: a rounded card with a title, small summary labels on the right and a chevron, that opens and
  closes with Bootstrap's collapse. Written by the {% panel_open %} / {% panel_close %} tags (core/templatetags/
  panel_extras.py); link this file on any page that uses them. Nothing here is specific to one page.
  The round sub-headings (Round 1, Round 2 ...) inside the Tournament page's panels are in round_table.css.

  Titles use Lora (bold), a serif loaded from Google Fonts in chrome/head.html next to the Oswald wordmark font.
  Georgia is the fallback if it has not loaded. It is not a skin setting (that can be added later).
  The accent bar uses the skin's primary color (--c-primary, from the skin color roles) with a fallback.
  A panel opens and closes with Bootstrap's collapse; the whole header row is the click target (stretched-link).
*/

:root {
	--gt-font-title: 'Lora', Georgia, 'Times New Roman', serif;   /* title font for panels and round headings */
}

.gt-sec {
	--gts-accent: var(--c-primary, #bfa85e);
	--gts-line: var(--bs-border-color, #dee2e6);
	margin-bottom: 1rem;
	border: 1px solid var(--gts-line);
	border-radius: 18px;
	background: var(--bs-tertiary-bg);
}
[data-bs-theme=light] .gt-sec { --gts-accent: var(--c-primary, #9b843a); }

.gt-sec-head {
	position: relative;
	display: flex;
	align-items: center;
	gap: .5rem .9rem;
	padding: .9rem 3rem .9rem 1.25rem;
}

/* base.html gives every h2 a centered, margined look; this one is a left-aligned title. */
.gt-sec .gt-sec-title {
	flex: 1 1 auto;
	margin: .3rem 0 0;          /* the serif's letters sit a little high in their line box; this centers them with the labels and chevron */
	text-align: left;
	font-family: var(--gt-font-title);
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .01em;
}
.gt-sec .gt-sec-toggle {
	display: inline-flex;
	align-items: center;
	gap: .65rem;
	min-width: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}
.gt-sec .gt-sec-toggle::before {
	content: "";
	flex: 0 0 auto;
	width: 5px;
	height: 1.1em;
	border-radius: 99px;
	background: var(--gts-accent);
}
/* stretched-link makes the ::after cover the whole header row */
.gt-sec .gt-sec-toggle:focus-visible { outline: 0; }
.gt-sec .gt-sec-toggle:focus-visible::after {
	outline: 2px solid var(--gts-accent);
	outline-offset: -2px;
	border-radius: 18px;
}

.gt-sec-chev {
	position: absolute;
	right: 1.35rem;
	top: 50%;
	width: .6rem;
	height: .6rem;
	border-right: 2px solid var(--bs-secondary-color);
	border-bottom: 2px solid var(--bs-secondary-color);
	transform: translateY(-30%) rotate(-135deg);
	transition: transform .15s ease;
}
.gt-sec-toggle.collapsed .gt-sec-chev { transform: translateY(-70%) rotate(45deg); }

.gt-sec-slot {
	display: flex;
	flex-wrap: nowrap;          /* the search box and the labels stay on one line (the search box gives way first) */
	align-items: center;
	justify-content: flex-end;
	gap: .4rem;
	margin-left: auto;
}
/* Anything interactive in the slot (later: search, toggles) sits above the clickable header. */
.gt-sec-slot .gt-sec-ctl { position: relative; z-index: 2; }

.gt-sec-label {
	flex: 0 0 auto;
	padding: .2rem .7rem;
	border: 1px solid var(--gts-line);
	border-radius: 999px;
	color: var(--bs-secondary-color);
	font-size: .8rem;
	font-weight: 600;
	white-space: nowrap;
}
.gt-sec-label:empty { display: none; }

/* A label that is also a switch (see the Maps panel: "8 Unique" / "32 Maps"). Pressed = the view in use. */
.gt-sec-label.gt-sec-pick { cursor: pointer; user-select: none; }
.gt-sec-label.gt-sec-pick:hover { border-color: var(--gts-accent); color: var(--bs-body-color); }
.gt-sec-label.gt-sec-pick[aria-pressed="true"] {
	border-color: var(--gts-accent);
	background: color-mix(in srgb, var(--gts-accent) 22%, transparent);
	color: var(--bs-body-color);
}
.gt-sec-label.gt-sec-pick:focus-visible { outline: 2px solid var(--gts-accent); outline-offset: 2px; }

/* Search box in the header's right-hand side (see the `search` argument of {% panel_open %}) */
.gt-search { position: relative; flex: 0 1 17rem; min-width: 6rem; }
.gt-search .gt-search-input {
	width: 100%;
	padding: .3rem .8rem .3rem 2.1rem;
	border: 1px solid var(--gts-line);
	border-radius: 999px;
	background: var(--bs-body-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a9099' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5'/%3E%3Cpath d='M10 10l4.5 4.5'/%3E%3C/svg%3E") no-repeat .7rem center / 1rem;
	color: var(--bs-body-color);
	font-size: .85rem;
	line-height: 1.4;
}
.gt-search .gt-search-input::placeholder { color: var(--bs-secondary-color); opacity: 1; }
.gt-search .gt-search-input:focus { border-color: var(--gts-accent); box-shadow: 0 0 0 .15rem color-mix(in srgb, var(--gts-accent) 30%, transparent); outline: 0; }

/* A panel that a link can point at (#standings): leave room under the site's top bar */
.gt-sec[id] { scroll-margin-top: 70px; }

/* Search in a panel that filters its own rows (see `filter` in {% panel_open %} and static/js/panel.js) */
.gt-sec .gt-nomatch { display: none !important; }
.gt-sec .gt-searchmsg { margin: 0 0 .75rem; color: var(--bs-secondary-color); font-size: .9rem; }
/* While searching, a row keeps its place number: the site numbers sortable tables with a CSS counter (styles.css:
   "Rankings Table Row Numbers") that counts only the rows shown, so panel.js fixes each number in data-n. */
.gt-sec table[data-sortable="true"] tr:not(.fble_htr) td[data-n]:first-child::before { content: attr(data-n); }
/* A standings table wider than a phone scrolls sideways inside its panel instead of being cut off */
.gt-sec .standingsBox { overflow-x: auto; }
/* While searching, a list that shows only its first rows ("Show all") is searched in full */
.gt-sec.gt-searching .standingsLimited .standingsExtra { display: table-row; }
.gt-sec.gt-searching .standingsShowAll { display: none; }

.gt-sec-body {
	padding: 1rem 1.25rem 1.25rem;
	border-top: 1px solid var(--gts-line);
}

/* Phone: the labels drop under the title, and the panel gets tighter. */
@media (max-width: 575.98px) {
	.gt-sec { border-radius: 14px; }
	.gt-sec-head { flex-wrap: wrap; padding: .8rem 2.6rem .8rem 1rem; }
	.gt-sec .gt-sec-title { font-size: 1.15rem; }
	.gt-sec-chev { right: 1.1rem; }
	.gt-sec-slot { flex: 1 0 100%; justify-content: flex-start; margin-left: calc(5px + .65rem); min-width: 0; }
	.gt-search { flex: 1 1 6rem; }
	.gt-sec-body { padding: .85rem .8rem 1rem; }
}

/* The site gives every <button> a blue (or, on hover, gold) fill with !important (base.html and styles.css).
   The panel toggle is a plain text control, so it undoes that in every state. */
html[data-bs-theme] .gt-sec .gt-sec-toggle,
html[data-bs-theme] .gt-sec .gt-sec-toggle:hover,
html[data-bs-theme] .gt-sec .gt-sec-toggle:focus,
html[data-bs-theme] .gt-sec .gt-sec-toggle:active {
	background: none !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0 !important;
	color: inherit !important;
	box-shadow: none !important;
}
