/*
Theme Name: Legalsgram
Theme URI: https://legalsgram.com
Author: Texodus
Author URI: https://texodus.tech
Description: Editorial theme for Legalsgram: free legal notices, templates and plain guides. Black, white and off-white with one green accent for buttons, a Fraunces and Source Sans 3 type pair, a centered reading column, and styles for pages built with TWP Builder.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
License: MIT
License URI: https://opensource.org/licenses/MIT
Tags: blog, one-column, custom-menu, featured-images, accessibility-ready, translation-ready
Text Domain: legalsgram
*/

/* Fonts: self-hosted Latin subsets (variable woff2), Google Fonts files served from this theme. */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(assets/fonts/fraunces-latin.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400 600; font-display: swap; src: url(assets/fonts/fraunces-italic-latin.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(assets/fonts/sourcesans3-latin.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: italic; font-weight: 400 600; font-display: swap; src: url(assets/fonts/sourcesans3-italic-latin.woff2) format("woff2"); }

/* Tokens (from local/mockup/tokens.json) */
:root {
	--lg-paper: #F6F5F1; --lg-surface: #FFFFFF; --lg-ink: #141414; --lg-muted: #5A5A55; --lg-line: #D9D7D0;
	--lg-black: #000000; --lg-on-black: #F6F5F1; --lg-on-black-muted: #B5B5AE;
	--lg-accent: #1A6B3F; --lg-accent-hover: #14532D; --lg-accent-hover-dark: #1E7A46; --lg-accent-text: #FFFFFF;
	--lg-focus: #141414; --lg-ad-ground: #ECEBE6;
	--lg-font-display: "Fraunces", Georgia, "Times New Roman", serif;
	--lg-font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--lg-text-base: 18px; --lg-text-ui: 16px; --lg-text-sm: 14px; --lg-text-h4: 20px;
	--lg-text-h3: clamp(22px, 2.2vw, 26px); --lg-text-h2: clamp(28px, 3.6vw, 40px); --lg-text-h1: clamp(34px, 4.6vw, 52px);
	--lg-s-1: 4px; --lg-s-2: 8px; --lg-s-3: 12px; --lg-s-4: 16px; --lg-s-5: 24px; --lg-s-6: 32px; --lg-s-7: 48px; --lg-s-8: 64px; --lg-s-9: 96px; --lg-s-10: 128px;
	--lg-pad: 16px;
	--lg-r-sm: 4px; --lg-r-md: 6px; --lg-r-lg: 14px;
	--lg-read: 720px; --lg-wide: 1240px; --lg-max: 1440px;
	--lg-ad-gutter: 160px; --lg-ad-gutter-h: 600px; --lg-ad-gap: 56px; --lg-ad-top: 32px; --lg-ad-inline-h: 280px;
	--lg-ease: cubic-bezier(.2, .7, .2, 1); --lg-t-fast: 160ms; --lg-t-base: 320ms;
	/* TWP Builder widgets and the editor canvas inherit the same palette */
	--twp-accent: var(--lg-accent); --twp-ink: var(--lg-ink); --twp-paper: var(--lg-paper); --twp-line: var(--lg-line);
	--twp-muted: var(--lg-muted); --twp-soft: var(--lg-surface); --twp-radius: var(--lg-r-md); --twp-radius-lg: var(--lg-r-lg);
	--twp-f-body: var(--lg-font-body);
}
@media (min-width: 640px) { :root { --lg-pad: 32px; } }
@media (min-width: 1024px) { :root { --lg-pad: 48px; } }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body { margin: 0; background: var(--lg-paper); color: var(--lg-ink); font: var(--lg-text-base)/1.6 var(--lg-font-body); overflow-x: hidden; }
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--lg-focus); outline-offset: 2px; border-radius: 2px; }
.dark :focus-visible { outline-color: var(--lg-on-black); }
.skip-link, .screen-reader-text { position: absolute; }
.skip-link { left: 16px; top: -60px; z-index: 100; background: var(--lg-ink); color: var(--lg-paper); padding: 10px 14px; border-radius: var(--lg-r-md); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }
.screen-reader-text { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap, .read { margin-inline: auto; padding-inline: var(--lg-pad); }
.wrap { max-width: calc(var(--lg-wide) + 2 * var(--lg-pad)); }
.read { max-width: calc(var(--lg-read) + 2 * var(--lg-pad)); }
h1, h2, h3, h4 { font-family: var(--lg-font-display); font-weight: 600; margin: 0; text-wrap: balance; font-optical-sizing: auto; }
h1 { font-size: var(--lg-text-h1); line-height: 1.06; letter-spacing: -.025em; }
h2 { font-size: var(--lg-text-h2); line-height: 1.12; letter-spacing: -.02em; }
h3 { font-size: var(--lg-text-h3); line-height: 1.25; letter-spacing: -.01em; }
h4 { font-size: var(--lg-text-h4); line-height: 1.3; }
p { margin: 0; }
.muted { color: var(--lg-muted); }
.dark { background: var(--lg-black); color: var(--lg-on-black); }
.dark .muted { color: var(--lg-on-black-muted); }
.lead { font-size: 19px; line-height: 1.5; color: var(--lg-muted); max-width: 60ch; margin-top: var(--lg-s-4); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--lg-text-sm); color: var(--lg-muted); }
.meta .cat { color: var(--lg-ink); font-weight: 600; text-decoration: none; }
.crumbs { font-size: var(--lg-text-sm); color: var(--lg-muted); margin-bottom: 18px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--lg-muted); }
.crumbs a { color: var(--lg-muted); }

/* Buttons and fields: accent green lives on buttons only */
.btn, .search-submit { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--lg-r-md); font-weight: 600; font-size: var(--lg-text-ui); text-decoration: none; cursor: pointer; background: var(--lg-accent); color: var(--lg-accent-text); transition: background-color var(--lg-t-fast) var(--lg-ease), transform var(--lg-t-fast) var(--lg-ease); }
.btn:hover, .search-submit:hover { background: var(--lg-accent-hover); }
.dark .btn:hover { background: var(--lg-accent-hover-dark); }
.btn:active, .search-submit:active { transform: translateY(1px); }
input[type=search], input[type=email], input[type=text] { width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--lg-ink); border-radius: var(--lg-r-sm); background: var(--lg-surface); font-size: 17px; }
input::placeholder { color: var(--lg-muted); opacity: 1; }
.search-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--lg-s-5); max-width: 520px; }
.search-form label { flex: 1 1 240px; }

/* Header */
.hdr { position: relative; border-bottom: 1px solid var(--lg-line); }
.hdr-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.logo { display: inline-flex; color: var(--lg-ink); --logo-cut: var(--lg-paper); text-decoration: none; }
.logo svg { height: 58px; width: 134px; aspect-ratio: 579.56 / 250; }
.dark .logo { color: var(--lg-on-black); --logo-cut: var(--lg-black); }
.menu { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav a { text-decoration: none; font-weight: 600; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat; padding-bottom: 2px; transition: background-size var(--lg-t-base) var(--lg-ease); }
.nav a:hover, .nav a:focus-visible, .nav .current-menu-item > a { background-size: 100% 1.5px; }
.hdr-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 0; background: none; border-radius: var(--lg-r-md); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: #ECEBE6; }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
/* Primary menu dropdown (Topics): opens on hover and while focus is inside, so keyboard users tab straight through it */
.nav .menu-item-has-children { position: relative; }
.nav .menu-item-has-children.current-menu-item > a { background-size: 0 1.5px; } /* Topics links to a home section, never "the current page" */
.nav .menu-item-has-children > a::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 2px 3px 8px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.nav .sub-menu { list-style: none; margin: 0; padding: 8px; }
@media (min-width: 1024px) {
	.nav .sub-menu { display: none; position: absolute; left: -20px; top: 100%; z-index: 20; width: 520px; grid-template-columns: 1fr 1fr; gap: 0 8px; margin-top: 10px; background: var(--lg-surface); border: 1px solid var(--lg-line); border-radius: var(--lg-r-md); box-shadow: 0 12px 32px -16px rgba(20, 20, 20, .35); }
	.nav .sub-menu::before { content: ""; position: absolute; inset: -12px 0 auto; height: 12px; } /* hover bridge */
	.nav li:hover > .sub-menu, .nav li:focus-within > .sub-menu { display: grid; }
	.nav .sub-menu a { display: block; padding: 10px 12px; border-radius: var(--lg-r-sm); background: none; font-weight: 500; }
	.nav .sub-menu a:hover, .nav .sub-menu a:focus-visible { background: var(--lg-paper); }
}
@media (max-width: 1023px) {
	.js .menu-btn { display: inline-flex; }
	.js .nav { display: none; position: absolute; right: var(--lg-pad); top: 64px; z-index: 5; width: min(280px, calc(100vw - 2 * var(--lg-pad))); padding: 8px; background: var(--lg-surface); border: 1px solid var(--lg-line); border-radius: var(--lg-r-md); }
	.js .nav.is-open { display: block; }
	.nav .menu { flex-direction: column; gap: 0; }
	.nav a { display: block; padding: 12px; background: none; border-radius: var(--lg-r-sm); }
	.nav a:hover { background: var(--lg-paper); }
	.nav { order: 3; flex-basis: 100%; padding-bottom: 12px; } /* no script: the menu stays open under the logo */
	.js .nav { max-height: calc(100vh - 88px); overflow-y: auto; }
	.nav .sub-menu { padding: 0 0 4px 12px; border-left: 1px solid var(--lg-line); margin-left: 12px; }
	.nav .sub-menu a { padding: 8px 12px; font-weight: 500; }
}

/* Footer */
.ftr { padding-block: 56px 28px; }
.ftr-grid { display: grid; gap: 36px; }
@media (min-width: 900px) { .ftr-grid { grid-template-columns: 1.4fr repeat(3, 1fr); gap: 48px; } }
.ftr .logo + p { margin-top: 16px; max-width: 36ch; font-size: var(--lg-text-ui); }
.ftr h2 { font-family: var(--lg-font-body); font-size: 15px; font-weight: 700; letter-spacing: 0; margin-bottom: 12px; }
.ftr .menu { flex-direction: column; gap: 4px; }
.ftr .menu a { display: inline-block; padding: 6px 0; text-decoration: none; }
.ftr .menu a:hover { text-decoration: underline; text-underline-offset: 3px; }
.disclaimer { margin-top: 44px; padding-top: 24px; border-top: 1px solid #333; display: grid; gap: 10px; }
.disclaimer strong { font-family: var(--lg-font-display); font-size: 22px; font-weight: 600; }
.disclaimer p { max-width: 80ch; color: var(--lg-on-black-muted); font-size: 15px; line-height: 1.55; }
.colophon { margin-top: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--lg-on-black-muted); }
.colophon a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: #55554F; }
.colophon a:hover { color: var(--lg-on-black); }

/* Lists: posts page, archives, search */
.page-head { padding-block: 48px 32px; }
.plist { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--lg-ink); }
.plist li { border-bottom: 1px solid var(--lg-line); }
.plist a { display: grid; gap: 6px; padding: 22px 0; text-decoration: none; max-width: calc(var(--lg-read) + 120px); }
.plist h2 { font-size: var(--lg-text-h3); }
.plist a:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.plist p { color: var(--lg-muted); font-size: var(--lg-text-ui); }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 32px 72px; }
.nav-links a, .nav-links span { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 14px; border: 1px solid var(--lg-line); border-radius: var(--lg-r-sm); text-decoration: none; }
.nav-links .current { background: var(--lg-ink); color: var(--lg-paper); border-color: var(--lg-ink); }
.nav-links a:hover { border-color: var(--lg-ink); }
.empty { padding-block: 24px 72px; }

/* Single, pages and builder-less content */
.post-head, .entry-title { padding-top: 40px; }
.post-head .entry-title { padding-top: 12px; }
.post-head .dek { font-size: 20px; line-height: 1.5; color: var(--lg-muted); margin-top: 16px; }
.post-head > .meta:last-child { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--lg-line); }
.prose { font-size: var(--lg-text-base); line-height: 1.6; padding-block: 28px 72px; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(26px, 3vw, 32px); margin-top: 2em; }
.prose h3 { font-size: 22px; margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: .4em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose blockquote { margin-inline: 0; padding-left: 18px; border-left: 3px double var(--lg-ink); }
.prose figure { margin-inline: 0; }
.prose figcaption { font-size: var(--lg-text-sm); color: var(--lg-muted); margin-top: 8px; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: var(--lg-text-ui); line-height: 1.45; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--lg-line); }
.prose thead th { border-bottom: 1.5px solid var(--lg-ink); }
.prose cite { font-style: italic; }
.notfound { padding-block: 72px 96px; }
.notfound .btn { margin-top: var(--lg-s-5); }

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

/* Featured images: fixed 16:9 box so lists and articles never shift (CLS) */
.plist a.has-thumb { grid-template-columns: 200px 1fr; grid-template-areas: "t m" "t h" "t p"; column-gap: 20px; align-items: start; }
.plist a.has-thumb .thumb { grid-area: t; width: 200px; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 6px; background: var(--lg-line); }
.plist a.has-thumb .meta { grid-area: m; } .plist a.has-thumb h2 { grid-area: h; } .plist a.has-thumb .ex { grid-area: p; }
@media (max-width: 600px) { .plist a.has-thumb { grid-template-columns: 1fr; grid-template-areas: "t" "m" "h" "p"; } .plist a.has-thumb .thumb { width: 100%; } }
.post-hero { margin: 0 auto 28px; }
.post-hero img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--lg-line); }
.tpl-note { margin: 0 auto 20px; }
.tpl-note p { margin: 0; padding: 14px 16px; border-left: 3px solid var(--lg-ink); background: var(--lg-line); font-size: var(--lg-text-ui); }
