/*
Theme Name:   ASG
Theme URI:    https://ssria.ca
Description:  Lean documentation theme for the SSRIA Alternative Solutions Guide. Three-column content pages, a persistent guide index, and an on-page section list.
Author:       Sticks & Stones
Version:      0.1.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain:  asg
*/

/* ===============================================================
   Fonts
   =============================================================== */
@font-face {
	font-family: "Neue Haas Unica";
	src: url("assets/fonts/neue-haas-unica/NeueHaasUnica-Light.woff2") format("woff2");
	font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
	font-family: "Neue Haas Unica";
	src: url("assets/fonts/neue-haas-unica/NeueHaasUnica-Regular.woff2") format("woff2");
	font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
	font-family: "Neue Haas Unica";
	src: url("assets/fonts/neue-haas-unica/NeueHaasUnica-Medium.woff2") format("woff2");
	font-weight: 500; font-style: normal; font-display: swap;
}

/* ===============================================================
   Tokens — SSRIA brand palette
   =============================================================== */
:root {
	--asg-primary:          #264164;
	--asg-primary-light:    #38517B;
	--asg-secondary:        #6C8255;
	--asg-secondary-light:  #92C062;
	--asg-secondary-lighter:#DFE7D8;
	--asg-grey:             #9F9F9F;
	--asg-grey-light:       #F7F7F7;

	--asg-ink:              #1d2733;
	--asg-ink-soft:         #475569;
	--asg-rule:             #e4e9ef;
	--asg-gap-bg:           #f8fafc;
	--asg-gap-border:       #c2ccd8;

	--asg-font: "Neue Haas Unica", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

	--asg-index-w:  260px;
	--asg-toc-w:    220px;
	--asg-gutter:   2.5rem;
	--asg-header-h: 64px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--asg-header-h) + 1rem); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
	margin: 0;
	font-family: var(--asg-font);
	font-size: 17px;
	line-height: 1.65;
	color: var(--asg-ink);
	background: #fff;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--asg-primary); }
a:hover { color: var(--asg-primary-light); }

img, svg, iframe { max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 { font-weight: 500; line-height: 1.25; color: var(--asg-primary); margin: 2.25rem 0 .75rem; }
h1 { font-size: clamp(2rem, 1.4rem + 1.6vw, 2.6rem); margin-top: 0; letter-spacing: -.015em; }
h2 { font-size: clamp(1.4rem, 1.15rem + .7vw, 1.7rem); padding-top: .5rem; }
h3 { font-size: 1.175rem; }
p, ul, ol, table { margin: 0 0 1.15rem; }
ul, ol { padding-left: 1.35rem; }
li { margin-bottom: .35rem; }

.asg-skip {
	position: absolute; left: -9999px; top: 0; z-index: 100;
	background: var(--asg-primary); color: #fff; padding: .7rem 1.1rem;
}
.asg-skip:focus { left: .5rem; top: .5rem; }

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

/* ===============================================================
   Header
   =============================================================== */
.asg-header {
	position: sticky; top: 0; z-index: 50;
	display: flex; align-items: center; gap: 1.25rem;
	height: var(--asg-header-h);
	padding: 0 1.5rem;
	background: #fff;
	border-bottom: 1px solid var(--asg-rule);
}

.asg-header__brand { display: flex; align-items: center; gap: .85rem; text-decoration: none; color: inherit; }
.asg-header__logo { height: 30px; width: auto; }
.asg-header__divider { width: 1px; height: 24px; background: var(--asg-rule); }
.asg-header__title { font-size: .9375rem; font-weight: 500; color: var(--asg-primary); line-height: 1.2; }
.asg-header__title span { display: block; font-size: .75rem; font-weight: 400; color: var(--asg-grey); }

.asg-header__spacer { flex: 1; }

.asg-header__search { display: flex; align-items: center; }
.asg-search {
	display: flex; align-items: center; gap: .4rem;
	border: 1px solid var(--asg-rule); border-radius: 999px;
	padding: .3rem .4rem .3rem .85rem; background: var(--asg-grey-light);
}
.asg-search input {
	border: 0; background: transparent; font: inherit; font-size: .875rem;
	width: 170px; padding: .15rem 0; color: var(--asg-ink);
}
.asg-search input:focus { outline: none; }
.asg-search button {
	border: 0; background: var(--asg-primary); color: #fff; cursor: pointer;
	border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .8125rem;
}
.asg-search button:hover { background: var(--asg-primary-light); }

.asg-index-toggle {
	display: none; align-items: center; gap: .5rem;
	border: 1px solid var(--asg-rule); border-radius: 4px; background: #fff;
	padding: .4rem .7rem; font: inherit; font-size: .875rem; cursor: pointer; color: var(--asg-primary);
}

/* ===============================================================
   Three-column shell
   =============================================================== */
.asg-shell {
	display: grid;
	grid-template-columns: var(--asg-index-w) minmax(0, 1fr) var(--asg-toc-w);
	gap: var(--asg-gutter);
	max-width: 1440px;
	margin: 0 auto;
	padding: 2.5rem 1.5rem 5rem;
	align-items: start;
}
.asg-shell--wide { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }
.asg-shell--no-toc { grid-template-columns: var(--asg-index-w) minmax(0, 1fr); }

.asg-col--index, .asg-col--toc {
	position: sticky;
	top: calc(var(--asg-header-h) + 1.5rem);
	max-height: calc(100vh - var(--asg-header-h) - 3rem);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.asg-content { min-width: 0; }
.asg-content > *:first-child { margin-top: 0; }

/* ===============================================================
   Left column — guide index
   =============================================================== */
.asg-index { font-size: .9375rem; }
.asg-index__title {
	margin: 0 0 .8rem; font-size: .75rem; font-weight: 600;
	letter-spacing: .08em; text-transform: uppercase; color: #64748b;
}
.asg-index ul { list-style: none; margin: 0; padding: 0; }
.asg-index li { margin: 0; }

/* Top-level items are section headings, not links */
.asg-index > ul > li { margin-bottom: 1.4rem; }
.asg-index > ul > li > a,
.asg-index > ul > li > span {
	display: block; font-size: .75rem; font-weight: 600; letter-spacing: .06em;
	text-transform: uppercase; color: var(--asg-primary); text-decoration: none;
	padding-bottom: .4rem; margin-bottom: .35rem; border-bottom: 1px solid var(--asg-rule);
}
.asg-index .sub-menu { margin-top: .2rem; }
.asg-index .sub-menu a {
	display: block; padding: .32rem .7rem; margin-left: -.7rem;
	border-radius: 4px; color: var(--asg-ink-soft); text-decoration: none; line-height: 1.4;
}
.asg-index .sub-menu a:hover { background: var(--asg-grey-light); color: var(--asg-primary); }
.asg-index .current-menu-item > a,
.asg-index .current_page_item > a {
	background: var(--asg-secondary-lighter); color: var(--asg-primary); font-weight: 500;
}
.asg-index__gap {
	display: inline-block; margin-left: .35rem; width: 6px; height: 6px;
	border-radius: 50%; background: #d9822b; vertical-align: middle;
}

/* ===============================================================
   Content bits
   =============================================================== */
.asg-eyebrow {
	margin: 0 0 .4rem; font-size: .75rem; font-weight: 600;
	letter-spacing: .08em; text-transform: uppercase; color: var(--asg-secondary);
}
.asg-lede { font-size: 1.1rem; line-height: 1.6; color: var(--asg-ink-soft); margin-bottom: 2rem; }

.asg-page-footer {
	margin-top: 3.5rem; padding-top: 1.25rem; border-top: 1px solid var(--asg-rule);
	display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
	font-size: .875rem; color: var(--asg-grey);
}

table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
th, td { text-align: left; vertical-align: top; padding: .65rem .8rem; border-bottom: 1px solid var(--asg-rule); }
thead th { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: #64748b; border-bottom: 2px solid #dde3ea; }

blockquote {
	margin: 1.5rem 0; padding: .3rem 0 .3rem 1.2rem;
	border-left: 3px solid var(--asg-secondary-light); color: var(--asg-ink-soft);
}

/* ===============================================================
   Home
   =============================================================== */
.asg-hero {
	padding: 4rem 1.5rem 3rem;
	background: linear-gradient(180deg, var(--asg-grey-light) 0%, #fff 100%);
	border-bottom: 1px solid var(--asg-rule);
}
.asg-hero__inner { max-width: 1100px; margin: 0 auto; }
.asg-hero h1 { max-width: 20ch; }
.asg-hero p { max-width: 62ch; font-size: 1.1rem; color: var(--asg-ink-soft); }

/* ===============================================================
   Case studies
   =============================================================== */
.asg-case-list { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 2rem 0; list-style: none; padding: 0; }
.asg-case {
	display: flex; flex-direction: column; gap: .5rem; padding: 1.35rem;
	border: 1px solid var(--asg-rule); border-radius: 8px; background: #fff; margin: 0;
}
.asg-case__meta { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--asg-secondary); }
.asg-case__title { margin: 0; font-size: 1.125rem; }
.asg-case__title a { text-decoration: none; }
.asg-case__excerpt { font-size: .9375rem; color: var(--asg-ink-soft); margin: 0; flex: 1; }

.asg-dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .9375rem; margin: 0 0 1.75rem; }
.asg-dl dt { font-weight: 600; color: var(--asg-ink-soft); }
.asg-dl dd { margin: 0; }

/* ===============================================================
   Footer
   =============================================================== */
.asg-footer {
	border-top: 1px solid var(--asg-rule); background: var(--asg-grey-light);
	padding: 2.5rem 1.5rem; font-size: .875rem; color: var(--asg-ink-soft);
}
.asg-footer__inner {
	max-width: 1440px; margin: 0 auto; display: flex; flex-wrap: wrap;
	gap: 1.5rem; justify-content: space-between; align-items: flex-start;
}
.asg-footer a { color: var(--asg-primary); }
.asg-footer__note { max-width: 46ch; margin: 0; }

.asg-staging-flag {
	background: #7a2626; color: #fff; text-align: center;
	font-size: .8125rem; padding: .4rem 1rem; letter-spacing: .02em;
}
.asg-staging-flag a { color: #ffd7d7; }

/* ===============================================================
   Responsive
   =============================================================== */
@media (max-width: 1180px) {
	.asg-shell { grid-template-columns: var(--asg-index-w) minmax(0, 1fr); }
	.asg-col--toc { display: none; }
}

@media (max-width: 860px) {
	.asg-shell, .asg-shell--no-toc { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: 1.5rem; }
	.asg-index-toggle { display: inline-flex; }
	.asg-header__search { display: none; }
	.asg-col--index {
		position: static; max-height: none; overflow: visible;
		order: -1;
	}
	#asg-index { display: none; }
	#asg-index.is-open { display: block; padding-bottom: 1rem; border-bottom: 1px solid var(--asg-rule); }
	.asg-header__title span { display: none; }
}
