/* ==========================================================================
   trungtruong.com: drawing-sheet theme
   ========================================================================== */

:root {
	--paper: #f4f1ea;
	--paper-2: #ebe6db;
	--card: #fbfaf6;
	--ink: #14213d;
	--ink-2: #36435e;
	--muted: #5d6679;
	--line: rgba(20, 33, 61, 0.14);
	--grid: rgba(20, 33, 61, 0.05);
	--accent: #c2410c;          /* redline markup */
	--accent-ink: #fff;
	--shadow: 0 1px 0 rgba(20, 33, 61, .06), 0 12px 32px -16px rgba(20, 33, 61, .25);

	--font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	--radius: 6px;
	--wrap: 1120px;
	--gutter: clamp(16px, 4vw, 40px);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--paper: #0d1625;
		--paper-2: #13203a;
		--card: #111d33;
		--ink: #e7ecf4;
		--ink-2: #c3ccdb;
		--muted: #93a0b5;
		--line: rgba(200, 215, 240, 0.16);
		--grid: rgba(140, 175, 230, 0.06);
		--accent: #ff8a4c;
		--accent-ink: #1a0d05;
		--shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -18px rgba(0, 0, 0, .7);
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--paper: #0d1625;
	--paper-2: #13203a;
	--card: #111d33;
	--ink: #e7ecf4;
	--ink-2: #c3ccdb;
	--muted: #93a0b5;
	--line: rgba(200, 215, 240, 0.16);
	--grid: rgba(140, 175, 230, 0.06);
	--accent: #ff8a4c;
	--accent-ink: #1a0d05;
	--shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -18px rgba(0, 0, 0, .7);
	color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 1.0625rem;
	line-height: 1.65;
	color: var(--ink-2);
	background-color: var(--paper);
	background-image:
		linear-gradient(var(--grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--grid) 1px, transparent 1px);
	background-size: 24px 24px;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

h1, h2, h3 { color: var(--ink); line-height: 1.15; margin: 0; font-stretch: 85%; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--radius); }
.skip:focus { top: 12px; }

.eyebrow, .section__num, .titleblock dt, .project__tag, .specs dt, .titleblock__foot, .form label {
	font-family: var(--mono);
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
}

/* ---------- Top bar ---------- */
.topbar {
	position: sticky; top: 0; z-index: 20;
	background: color-mix(in srgb, var(--paper) 85%, transparent);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-stretch: 85%; }
.brand__mark {
	display: grid; place-items: center; width: 32px; height: 32px;
	border: 1.5px solid var(--ink); border-radius: 4px;
	font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
}
.brand__pe { color: var(--muted); font-weight: 500; }
nav { margin-left: auto; }
.nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 8px 12px; border-radius: var(--radius); text-decoration: none; font-size: 0.95rem; color: var(--ink-2); }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav .nav__cta { color: var(--accent); font-weight: 600; }
.theme-toggle {
	display: grid; place-items: center; width: 40px; height: 40px; flex: none;
	border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { background: var(--paper-2); }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
	:root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}

@media (max-width: 720px) {
	.nav li:not(:last-child) { display: none; }
	.brand__pe { display: none; }
}

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; padding: 0 22px;
	border: 1.5px solid var(--ink); border-radius: var(--radius);
	background: transparent; color: var(--ink);
	font: 600 0.95rem/1 var(--font); text-decoration: none; cursor: pointer;
	transition: transform .15s ease, background-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Hero ---------- */
.hero {
	display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
	gap: clamp(32px, 6vw, 80px); align-items: center;
	padding-block: clamp(48px, 9vw, 112px) clamp(40px, 7vw, 88px);
}
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 750; margin: 14px 0 22px; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); max-width: 56ch; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); }
.eyebrow::before { content: ""; width: 24px; height: 1.5px; background: currentColor; }

/* Title block: a nod to the corner of a drawing sheet */
.titleblock {
	margin: 0; background: var(--card); border: 1.5px solid var(--ink);
	box-shadow: var(--shadow); border-radius: 2px;
	transform: rotate(1deg);
	max-width: 420px; justify-self: end; width: 100%;
}
.titleblock img { aspect-ratio: 1; object-fit: cover; width: 100%; border-bottom: 1.5px solid var(--ink); filter: saturate(.92); }
.titleblock__grid { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.titleblock__grid > div { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.titleblock__grid > div:nth-child(odd):not(.span2) { border-right: 1px solid var(--line); }
.titleblock__grid .span2 { grid-column: span 2; }
.titleblock dt { font-size: 0.65rem; }
.titleblock dd { margin: 2px 0 0; color: var(--ink); font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.titleblock__foot { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 0.65rem; }

@media (max-width: 820px) {
	.hero { grid-template-columns: 1fr; }
	.titleblock { justify-self: start; transform: none; max-width: 360px; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(48px, 8vw, 96px); }
.section__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: clamp(28px, 4vw, 48px); }
.section__num { color: var(--accent); font-size: 0.85rem; }
.section__head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 750; white-space: nowrap; }
/* Dimension line with tick marks at each end */
.dimline { position: relative; flex: 1; height: 1px; background: var(--line); align-self: center; min-width: 24px; }
.dimline::before, .dimline::after { content: ""; position: absolute; top: -6px; width: 1px; height: 13px; background: var(--muted); transform: rotate(45deg); }
.dimline::before { left: 0; }
.dimline::after { right: 0; }

/* ---------- Journey: scroll timeline ----------
   A dot travels down the line as you scroll; each year lights up when the
   dot reaches it. Without JS everything is simply shown. */
.story { --rail-x: 132px; position: relative; }
.story__list { list-style: none; margin: 0; padding: 0; }
.story__rail { position: absolute; left: var(--rail-x); top: 19px; bottom: 0; width: 2px; margin-left: -1px; background: var(--line); }
.story__fill { position: absolute; left: 0; top: 0; width: 100%; height: var(--progress, 0px); background: var(--accent); }
.story__dot {
	display: none; position: absolute; left: 50%; top: var(--progress, 0px); width: 18px; height: 18px; margin: -9px 0 0 -9px;
	border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
}
.js .story__dot { display: block; }
.story__stop { position: relative; display: grid; grid-template-columns: 100px 64px minmax(0, 1fr); padding-bottom: clamp(44px, 7vw, 80px); }
.story__stop:last-child { padding-bottom: 0; }
.story__stop::before {
	content: ""; position: absolute; left: var(--rail-x); top: 12px; width: 14px; height: 14px; margin-left: -7px;
	border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); transition: background-color .3s, border-color .3s;
}
.story__year { grid-column: 1; text-align: right; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 750; font-stretch: 85%; line-height: 1; color: var(--ink); padding-top: 4px; transition: color .3s; }
.story__body { grid-column: 3; max-width: 680px; }
.story__body h3 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 750; margin-bottom: 10px; }
.story__meta { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.story__meta li { font-family: var(--mono); font-size: 0.75rem; line-height: 1.35; color: var(--ink-2); padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); }
.story__body p:last-child { margin-bottom: 0; }

.js .story__year { color: var(--muted); }
.js .story__body { opacity: .28; transform: translateY(10px); transition: opacity .45s ease, transform .45s ease; }
.js .story__stop.is-reached::before { background: var(--accent); border-color: var(--accent); }
.js .story__stop.is-reached .story__year { color: var(--accent); }
.js .story__stop.is-reached .story__body { opacity: 1; transform: none; }

@media (max-width: 720px) {
	.story { --rail-x: 9px; }
	.story__stop { grid-template-columns: 36px minmax(0, 1fr); }
	.story__year { grid-column: 2; text-align: left; font-size: 1.35rem; margin-bottom: 8px; padding-top: 2px; }
	.story__body { grid-column: 2; }
}

/* ---------- Projects ---------- */
.projects { display: grid; gap: clamp(28px, 4vw, 48px); }
.project {
	display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	overflow: hidden; box-shadow: var(--shadow);
}
.project:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.project:nth-child(even) .project__media { order: 2; }
.project__media {
	position: relative; display: block; padding: 0; margin: 0; border: 0; background: var(--paper-2);
	cursor: zoom-in; overflow: hidden; min-height: 260px;
}
.project__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.project__media:hover img { transform: scale(1.03); }
.project__zoom {
	position: absolute; right: 12px; bottom: 12px; padding: 6px 10px;
	background: rgba(13, 22, 37, .78); color: #fff; border-radius: 4px;
	font: 500 0.7rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em;
	opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.project__media:hover .project__zoom, .project__media:focus-visible .project__zoom { opacity: 1; transform: none; }
.project__body { padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; justify-content: center; }
.project__tag { color: var(--accent); margin-bottom: 8px; }
.project h3 { font-size: clamp(1.35rem, 2.4vw, 1.7rem); font-weight: 700; margin-bottom: 12px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 8px 0 0; background: var(--line); border: 1px solid var(--line); }
.specs > div { background: var(--card); padding: 10px 12px; }
.specs dt { font-size: 0.65rem; }
.specs dd { margin: 2px 0 0; color: var(--ink); font-weight: 600; font-size: 0.95rem; line-height: 1.35; }
@media (max-width: 820px) {
	.project, .project:nth-child(even) { grid-template-columns: 1fr; }
	.project:nth-child(even) .project__media { order: 0; }
	.project__media { min-height: 0; aspect-ratio: 16 / 9; }
	.project__zoom { opacity: 1; transform: none; }
}

/* ---------- More projects + toolbox ---------- */
.subhead { font-size: 1.15rem; font-weight: 700; margin: clamp(40px, 6vw, 64px) 0 16px; }
.minis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mini {
	display: flex; flex-direction: column;
	background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--ink);
	border-radius: var(--radius); padding: 20px 22px;
}
.mini h4 { color: var(--ink); font-size: 1.15rem; font-weight: 700; font-stretch: 85%; line-height: 1.2; margin: 0 0 8px; }
.mini p { font-size: 0.97rem; }
.mini .project__tag { margin-bottom: 6px; }
.mini__stat { margin: auto 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.mini__stat strong { display: block; font-family: var(--font); font-size: 1.5rem; font-stretch: 85%; color: var(--accent); line-height: 1.1; }
.toolbox { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(24px, 4vw, 48px); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-family: var(--mono); font-size: 0.8rem; color: var(--ink); padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); }
@media (max-width: 900px) { .minis { grid-template-columns: 1fr; } .toolbox { grid-template-columns: 1fr; } }

/* ---------- Real estate ---------- */
.realestate { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); align-items: start; }
.realestate__note { font-size: 0.9rem; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 12px; }
.titleblock--flat { transform: none; justify-self: stretch; max-width: none; }
@media (max-width: 820px) { .realestate { grid-template-columns: 1fr; } }

/* ---------- Hobbies ---------- */
.hobbies { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.hobby {
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 22px; transition: border-color .2s, transform .2s;
}
.hobby:hover { border-color: var(--accent); transform: translateY(-2px); }
.hobby svg { width: 28px; height: 28px; color: var(--accent); margin-bottom: 14px; }
.hobby h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.hobby p { margin: 0; font-size: 0.97rem; }
@media (max-width: 900px) { .hobbies { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .hobbies { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: clamp(32px, 6vw, 72px); }
.contact__list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 14px; }
.contact__list li { display: flex; align-items: center; gap: 12px; }
.contact__list svg { color: var(--accent); }
.form {
	display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow);
}
.field { display: grid; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.form input, .form textarea {
	width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
	background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
.form textarea { resize: vertical; min-height: 140px; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.form__foot { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.form__status { margin: 0; font-size: 0.95rem; }
.form__status.is-ok { color: #15803d; }
.form__status.is-err { color: #b91c1c; }
:root[data-theme="dark"] .form__status.is-ok { color: #4ade80; }
:root[data-theme="dark"] .form__status.is-err { color: #f87171; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .form__status.is-ok { color: #4ade80; }
	:root:not([data-theme="light"]) .form__status.is-err { color: #f87171; }
}
@media (max-width: 820px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .form { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 32px; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 28px; font-size: 0.9rem; color: var(--muted); }
.footer p { margin: 0; }
.footer__legal { display: grid; gap: 4px; }
.footer__legal a:hover { color: var(--accent); }
.social { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.social a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); color: var(--ink-2); }
.social a:hover { background: var(--paper-2); color: var(--accent); }

/* ---------- Lightbox ---------- */
.lightbox {
	padding: 0; border: 0; background: transparent; max-width: min(1200px, 94vw); max-height: 92vh; overflow: visible;
}
.lightbox::backdrop { background: rgba(6, 10, 18, .86); backdrop-filter: blur(4px); }
.lightbox img { max-height: 88vh; width: auto; margin: auto; border-radius: 4px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox__close {
	position: absolute; top: -48px; right: 0; width: 40px; height: 40px;
	border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff;
	font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.lightbox__close:hover { background: rgba(255,255,255,.24); }

/* ---------- Scroll reveal (only when JS is on) ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-in { opacity: 1; transform: none; }
.titleblock dd.broker { font-size: 1.15rem; }
.titleblock dd a { color: inherit; }
.titleblock dd a.email { overflow-wrap: anywhere; }

/* TREC-required links: full "Texas Real Estate Commission" wording, kept at
   15px (about 11pt), above TREC's 10-point minimum. Don't shrink these. */
.trec-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.trec-links a { font-family: var(--font); font-size: 0.9375rem; line-height: 1.4; text-transform: none; letter-spacing: 0; color: var(--ink); }
.trec-links a:hover { color: var(--accent); }
.titleblock--flat .trec-links { padding: 12px 14px; }
.footer__legal { gap: 10px; }

/* ---------- Language toggle ---------- */
.lang-toggle { display: flex; flex: none; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lang-toggle button {
	min-width: 40px; height: 38px; padding: 0 8px; border: 0; background: transparent; cursor: pointer;
	font: 500 0.78rem/1 var(--mono); letter-spacing: 0.04em; color: var(--muted);
}
.lang-toggle button + button { border-left: 1px solid var(--line); }
.lang-toggle button:hover { color: var(--ink); background: var(--paper-2); }
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media (max-width: 720px) { nav { margin-left: auto; } .topbar__inner { gap: 10px; } }
@media (max-width: 400px) { .brand__name { display: none; } }
