/*
 * Trucking guides: Truck Accident Investigations, Truck Type Identifier, and
 * Possible Defendants. Markup: pattern-source/06-truck-accident-investigations.html,
 * 07-truck-type-identifier.html, and 09-possible-defendants.html.
 * Behavior: js/ha-truck-guides.js.
 * Loaded on singular pages, the front page included, whose content carries data-ha-tg
 * (ha_law_enqueue_truck_guides in functions.php).
 *
 * Black band, charcoal cards with white hairlines, white copy at full opacity,
 * terracotta for the on state, lifted rust for hover and selection borders.
 * Truck names are Barlow 700 uppercase vehicle heads. No eyebrows, no icons,
 * no one-sided borders, no gray body copy.
 */

.ha-tg { box-sizing: border-box; margin: 0; padding: var(--ha-band) var(--ha-gutter); background: var(--ha-pure-black); color: var(--ha-white); font-family: var(--font-body); hyphens: manual; overflow-wrap: normal; word-break: normal; }
.ha-tg *, .ha-tg *::before, .ha-tg *::after { box-sizing: border-box; }
.ha-tg__frame { width: 100%; max-width: var(--ha-frame); margin-inline: auto; }
.ha-tg h1, .ha-tg h2, .ha-tg h3 { margin: 0; color: var(--ha-white); text-wrap: balance; }
.ha-tg p { margin: 0; color: var(--ha-white); font-size: 1.0625rem; }
.ha-tg__title { font: 600 clamp(1.85rem, 3.2vw, 2.75rem)/1.18 var(--font-heading); }
.ha-tg__lede { margin-top: 1rem !important; line-height: 1.7; }
.ha-tg button { font-family: var(--font-body); }
.ha-tg button:focus-visible { outline: 3px solid var(--ha-white); outline-offset: 4px; }

/* Before the script runs, and without it: a readable list of articles. */
.ha-tg__layers { display: grid; gap: .6rem; margin-top: 2rem; }
.ha-tg__layer { line-height: 1.6; }
.ha-tg__evidence-name { font-family: var(--ha-font-display, inherit); font-size: 1.05rem; }
.ha-tg__layer-name { display: block; font-family: var(--ha-font-display, inherit); font-size: 1.05rem; }
.ha-tg__items { display: grid; gap: 1.25rem; margin-top: 2rem; }
.ha-tg__item { padding: clamp(1.25rem, 2.4vw, 2rem); background: var(--ha-charcoal); border: 1px solid var(--ha-line-on-dark); border-radius: var(--ha-radius-card); }
.ha-tg__item img { display: block; width: 100%; max-width: 32rem; height: auto; margin-bottom: 1rem; border-radius: var(--ha-radius-control); }
.ha-tg__name { font: 600 1.5rem/1.25 var(--font-heading); }
.ha-tg__sub { margin-top: .35rem !important; }
.ha-tg__evidence { margin: 1rem 0 0; }
.ha-tg__evidence dt { margin-top: .75rem; font-weight: 600; }
.ha-tg__evidence dd { margin: .2rem 0 0; line-height: 1.6; }

/* Shared lists: questions, features, topics. */
.ha-tg__questions, .ha-tg__list { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: .1rem; }
.ha-tg__questions li, .ha-tg__list li { position: relative; margin: 0; padding: .65rem 0 .65rem 1.4rem; border-top: 1px solid var(--ha-hairline); font-size: 1.0625rem; line-height: 1.6; }
.ha-tg__questions li:first-child, .ha-tg__list li:first-child { border-top: 0; }
.ha-tg__questions li::before, .ha-tg__list li::before { content: ""; position: absolute; left: .15rem; top: 1.2rem; width: .45rem; height: .45rem; border-radius: 2px; background: var(--ha-rust-card); }
.ha-tg__label { margin-top: 1.25rem !important; font-weight: 600; font-size: 1.0625rem; }

/* Enhanced: the articles become the data source and the grid takes over. */
.ha-tg.is-ready .ha-tg__layers,
.ha-tg.is-ready .ha-tg__items { display: none; }

.ha-tg__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.75rem, 1.6vw, 1.25rem); margin-top: clamp(2rem, 4vw, 3rem); }
.ha-tg__card { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; min-width: 0; min-height: 44px; padding: .75rem .75rem 1rem; background: var(--ha-charcoal); border: 1px solid var(--ha-line-on-dark); border-radius: var(--ha-radius-card); color: var(--ha-white); text-align: center; cursor: pointer; transition: transform .45s var(--ha-ease), border-color .45s var(--ha-ease), box-shadow .45s var(--ha-ease); }
.ha-tg__card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: .4rem; border-radius: var(--ha-radius-control); }
.ha-tg__card-name { font-weight: 600; font-size: 1.0625rem; line-height: 1.3; }
.ha-tg__card-sub { font-size: .9375rem; line-height: 1.45; }
.ha-tg__card-name, .ha-tg__card-sub { text-wrap: balance; }
.ha-tg__card:hover { transform: translateY(-6px); border-color: var(--ha-rust-lift); box-shadow: 0 30px 60px rgba(0, 0, 0, .6); }
.ha-tg__card[aria-pressed="true"] { border-color: var(--ha-rust-lift); box-shadow: inset 0 0 0 1px var(--ha-rust-lift); }
.ha-tg--truck-types .ha-tg__card-name { font: 700 clamp(.8125rem, 4.2vw, 1.05rem)/1.15 var(--font-block); letter-spacing: .02em; text-transform: uppercase; }

/* The panel opens below the grid on first selection. */
.ha-tg__drop { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .4s var(--ha-ease), opacity .4s var(--ha-ease); }
.ha-tg__drop.is-open { grid-template-rows: 1fr; opacity: 1; }
.ha-tg__drop-in { min-height: 0; overflow: hidden; }
.ha-tg__panel { margin-top: clamp(1.25rem, 2.4vw, 2rem); padding: clamp(1.25rem, 2.6vw, 2.5rem); background: var(--ha-charcoal); border: 1px solid var(--ha-line-on-dark); border-radius: var(--ha-radius-card); }
.ha-tg__panel--split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(1.5rem, 3vw, 3rem); }
.ha-tg__panel-title { margin-top: 1.25rem !important; font: 600 1.5rem/1.25 var(--font-heading); }
.ha-tg__evidence-panel .ha-tg__panel-title { margin-top: 0 !important; }
.ha-tg__media img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--ha-radius-control); }

.ha-tg__toggles { display: grid; gap: .6rem; margin-top: 1rem; }
.ha-tg__toggle { display: flex; align-items: flex-start; gap: .85rem; width: 100%; min-height: 44px; padding: .75rem .9rem; background: transparent; border: 1px solid var(--ha-line-on-dark); border-radius: var(--ha-radius-control); color: var(--ha-white); text-align: left; cursor: pointer; transition: border-color .4s var(--ha-ease); }
.ha-tg__toggle:hover { border-color: var(--ha-rust-lift); }
.ha-tg__switch { position: relative; flex: none; width: 2.4rem; height: 1.4rem; margin-top: .1rem; border-radius: 100px; background: rgba(255, 255, 255, .24); transition: background-color .3s var(--ha-ease); }
.ha-tg__switch::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--ha-white); transition: transform .3s var(--ha-ease); }
.ha-tg__toggle[aria-pressed="true"] .ha-tg__switch { background: var(--ha-terracotta); }
.ha-tg__toggle[aria-pressed="true"] .ha-tg__switch::after { transform: translateX(1rem); }
.ha-tg__toggle-copy { display: grid; gap: .15rem; }
.ha-tg__toggle-name { font-weight: 600; font-size: 1rem; line-height: 1.35; }
.ha-tg__toggle-desc { font-size: .9375rem; line-height: 1.5; }
.ha-tg__evidence-out { display: grid; gap: .75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--ha-hairline); }
.ha-tg__evidence-out p { font-size: 1.0625rem; line-height: 1.6; }

.ha-tg__vehicle { font: 700 clamp(1.6rem, 2.6vw, 2.2rem)/1.05 var(--font-block); letter-spacing: .02em; text-transform: uppercase; }
.ha-tg__columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.25rem, 3vw, 3rem); }

/* Possible Defendants (pattern-source/09): a scene with role hotspots, pills on phones. */
.ha-tg__scene { position: relative; margin: clamp(2rem, 4vw, 3rem) 0 0; }
.ha-tg__scene img { display: block; width: 100%; height: auto; border: 1px solid var(--ha-line-on-dark); border-radius: var(--ha-radius-card); }
.ha-tg__spots { position: absolute; inset: 0; }
.ha-tg__spot,
.ha-tg__pill { min-height: 44px; padding: .55rem 1rem; background: rgba(0, 0, 0, .78); border: 1px solid var(--ha-white); border-radius: 100px; color: var(--ha-white); font-weight: 600; font-size: .9375rem; line-height: 1.2; cursor: pointer; transition: background-color .35s var(--ha-ease), border-color .35s var(--ha-ease); }
.ha-tg__spot { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, .55); }
.ha-tg__spot:hover,
.ha-tg__pill:hover { border-color: var(--ha-rust-lift); }
.ha-tg__spot[aria-pressed="true"],
.ha-tg__pill[aria-pressed="true"] { background: var(--ha-terracotta); border-color: var(--ha-terracotta); }
.ha-tg__pills { display: none; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.ha-tg__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; margin-top: 1.25rem; }
.ha-tg__count { font-size: 1.0625rem; }
.ha-tg__reset { min-height: 44px; padding: .7rem 1.2rem; background: transparent; border: 1px solid var(--ha-white); border-radius: var(--ha-radius-control); color: var(--ha-white); font-weight: 600; font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background-color .35s var(--ha-ease), border-color .35s var(--ha-ease); }
.ha-tg__reset:hover:not(:disabled) { background: var(--ha-terracotta); border-color: var(--ha-terracotta); }
.ha-tg__reset:disabled { cursor: default; border-color: var(--ha-line-on-dark); }
.ha-tg__party + .ha-tg__party { margin-top: clamp(1.5rem, 3vw, 2.25rem); padding-top: clamp(1.5rem, 3vw, 2.25rem); border-top: 1px solid var(--ha-hairline); }
.ha-tg__party .ha-tg__panel-title { margin-top: 0 !important; }
.ha-tg__unknown { margin-top: clamp(1.5rem, 3vw, 2.5rem); padding: clamp(1.25rem, 2.6vw, 2.5rem); background: var(--ha-charcoal); border: 1px solid var(--ha-line-on-dark); border-radius: var(--ha-radius-card); }
.ha-tg__unknown .ha-tg__sub { font-size: 1.0625rem; line-height: 1.6; }

/* Astra styles button:hover and button:focus (0,1,1); hold every guide control
   to white copy on its own surface in each state. */
.ha-tg .ha-tg__card,
.ha-tg .ha-tg__card:hover,
.ha-tg .ha-tg__card:focus { background: var(--ha-charcoal); color: var(--ha-white); }
.ha-tg .ha-tg__toggle,
.ha-tg .ha-tg__toggle:hover,
.ha-tg .ha-tg__toggle:focus,
.ha-tg .ha-tg__reset,
.ha-tg .ha-tg__reset:focus { background: transparent; color: var(--ha-white); }
.ha-tg .ha-tg__spot,
.ha-tg .ha-tg__pill,
.ha-tg .ha-tg__spot:hover,
.ha-tg .ha-tg__pill:hover,
.ha-tg .ha-tg__spot:focus,
.ha-tg .ha-tg__pill:focus { background: rgba(0, 0, 0, .78); color: var(--ha-white); }
.ha-tg .ha-tg__spot[aria-pressed="true"],
.ha-tg .ha-tg__pill[aria-pressed="true"] { background: var(--ha-terracotta); border-color: var(--ha-terracotta); }
.ha-tg .ha-tg__reset:hover:not(:disabled) { background: var(--ha-terracotta); border-color: var(--ha-terracotta); color: var(--ha-white); }

@media (max-width: 1024px) {
	.ha-tg__panel--split { grid-template-columns: minmax(0, 1fr); }
	.ha-tg__spot { padding: .45rem .8rem; font-size: .85rem; }
}
@media (max-width: 767px) {
	.ha-tg__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ha-tg__columns { grid-template-columns: minmax(0, 1fr); gap: 0; }
	.ha-tg__spots { display: none; }
	.ha-tg__pills { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
	.ha-tg__card, .ha-tg__drop, .ha-tg__toggle, .ha-tg__switch, .ha-tg__switch::after, .ha-tg__spot, .ha-tg__pill, .ha-tg__reset { transition: none; }
	.ha-tg__card:hover { transform: none; }
}

/*
 * Row layout (Investigations, Truck Type Identifier): the cards fill one full-width
 * grid. When a card is picked the grid narrows to two columns and the panel opens
 * beside it as a black card with a rust border, top-aligned with the cards and no
 * taller than them; a longer panel scrolls inside. Under 900px it opens below.
 */
.ha-tg__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1rem, 2vw, 1.5rem); align-items: stretch; margin-top: clamp(2rem, 4vw, 3rem); }
.ha-tg__row .ha-tg__grid { margin-top: 0; align-content: start; }
.ha-tg__row .ha-tg__drop { display: block; min-width: 0; opacity: 1; }
.ha-tg__row .ha-tg__drop:not(.is-open) { display: none; }
.ha-tg__row .ha-tg__drop-in { height: 100%; overflow: visible; }
.ha-tg__row .ha-tg__panel { height: 100%; margin-top: 0; background: var(--ha-pure-black); border: 1px solid var(--ha-rust-lift); grid-template-columns: minmax(0, 1fr); animation: ha-tg-card-in .4s var(--ha-ease); }
.ha-tg__row .ha-tg__panel-title { margin-top: 1rem !important; }
.ha-tg__row .ha-tg__evidence-panel { padding-top: clamp(1.25rem, 2.4vw, 2rem); border-top: 1px solid var(--ha-hairline); }
.ha-tg__row .ha-tg__evidence-panel .ha-tg__panel-title { margin-top: 0 !important; }
.ha-tg--investigations .ha-tg__card-sub,
.ha-tg--investigations .ha-tg__toggle-desc { text-transform: none; }
@media (min-width: 900px) {
	.ha-tg__row.is-open { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
	.ha-tg__row.is-open .ha-tg__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ha-tg__row .ha-tg__drop { position: relative; }
	.ha-tg__row .ha-tg__drop-in { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; border-radius: var(--ha-radius-card); }
	.ha-tg__row .ha-tg__panel { min-height: 100%; height: auto; }
}
@keyframes ha-tg-card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
	.ha-tg__row .ha-tg__panel { animation: none; }
}

/* Draft page H1 band (content/pages/trucking-guides.html). */
.ha-tg--intro { padding-bottom: 0; }
.ha-tg__h1 { font: 700 clamp(2.4rem, 5vw, 4.5rem)/1.08 var(--font-heading); letter-spacing: -.02em; }
.ha-tg--intro + .ha-tg { padding-top: clamp(2.5rem, 5vw, 4rem); }
.ha-tg--investigations + .ha-tg--truck-types { border-top: 1px solid var(--ha-hairline); }

/* Guides-only page: let the black bands run full bleed (mirrors the .ha-home reset). */
body.ha-tg-page,
body.ha-tg-page #page,
body.ha-tg-page .site-content { background: var(--ha-black); color: var(--ha-white); }
body.ha-tg-page .site-content .ast-container,
body.ha-tg-page #primary,
body.ha-tg-page .site-main,
body.ha-tg-page article.page,
body.ha-tg-page .entry-content { width: 100%; max-width: none; margin: 0; padding: 0; }
body.ha-tg-page .entry-content .ha-tg { max-width: none; width: 100%; margin: 0; }
