/* Jo Truong, LMSW — one-page practice site, installable.
 *
 * The five palettes below are the house set, unchanged. Every rule after them
 * reads only these variables, so a palette swap re-skins the whole page.
 * :root carries Royal, but the page ships with data-theme="paper" on <html>
 * (a practice site reads best light) — see DEFAULT_THEME in app.js.
 */

:root {                    /* Royal — royal blue & gold */
  --bg: #0d1322; --panel: #15203a; --panel2: #1d2b4e; --line: #2b3c66;
  --text: #e9ecf5; --muted: #96a2c4; --accent: #d9b45b;
  --up: #66c98a; --down: #e0716f;
}
html[data-theme="ember"] {
  --bg: #111318; --panel: #191c24; --panel2: #222633; --line: #2a2f3c;
  --text: #eae7e0; --muted: #9298a8; --accent: #e5a558;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="ice"] {
  --bg: #0d1418; --panel: #141d23; --panel2: #1c2830; --line: #263540;
  --text: #e4ebee; --muted: #8fa3ad; --accent: #56c3dc;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="nocturne"] {
  --bg: #141020; --panel: #1c1730; --panel2: #262040; --line: #322a52;
  --text: #eae6f2; --muted: #9d94b8; --accent: #a78bda;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="paper"] { /* light — this site's default */
  --bg: #f5f2ec; --panel: #fdfbf7; --panel2: #ece6d8; --line: #d8d1c0;
  --text: #29261f; --muted: #7a7468; --accent: #8a6d1d;
  --up: #1a8f4a; --down: #c04543;
}
:root {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --up-soft: color-mix(in srgb, var(--up) 14%, transparent);
  --down-soft: color-mix(in srgb, var(--down) 14%, transparent);
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* Site tokens, all derived from the palette above. --muted is too faint for
 * body-size copy on Paper (4.2:1), so running secondary text uses --ink2 and
 * small accent-coloured text uses --accent-ink; both clear 4.5:1 on every
 * surface in every palette. --edge is the 3:1 outline for form controls. */
:root {
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ink2: color-mix(in srgb, var(--text) 80%, var(--bg));
  --accent-ink: color-mix(in srgb, var(--accent) 78%, var(--text));
  --on-accent: var(--bg);
  --wash: color-mix(in srgb, var(--accent) 6%, var(--bg));
  --edge: color-mix(in srgb, var(--text) 55%, var(--bg));
  --gutter: clamp(20px, 5vw, 44px);
}
html[data-theme="paper"] { --on-accent: var(--panel); }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--on-accent); }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html:not(.js) .js-only { display: none !important; }
.i { width: 1.05em; height: 1.05em; flex: none; }
p > a > .i, li > a:not(.chip) > .i { display: inline-block; margin-left: 0.25em; vertical-align: -0.14em; color: var(--accent-ink); }

.skip {
  position: absolute; left: 12px; top: -80px; z-index: 50;
  padding: 10px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: calc(env(safe-area-inset-top) + 10px); }

/* -------------------------------------------------------------- preview */
.ribbon {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 7px) max(14px, env(safe-area-inset-right)) 7px max(14px, env(safe-area-inset-left));
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem; line-height: 1.4;
}
.ribbon p { text-wrap: balance; }
.ribbon button {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  font-size: 1.25rem; line-height: 1; color: var(--ink2);
}
.ribbon button:hover { background: var(--accent-soft); color: var(--text); }
.no-ribbon .ribbon { display: none; }

/* ------------------------------------------------------------------ bar */
.bar {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar-in { display: flex; align-items: center; gap: 14px; min-height: 58px; }
.mark { flex: none; display: inline-flex; align-items: baseline; gap: 8px; padding-block: 8px; text-decoration: none; }
.mark-name { font: 400 1.22rem/1 var(--serif); letter-spacing: 0.005em; }
.mark-cred { font: 600 0.66rem/1 var(--sans); letter-spacing: 0.18em; color: var(--accent-ink); }
.nav {
  position: relative;
  margin-left: auto;
  display: flex; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
  padding: 6px 22px 6px 16px;
  /* soft edges hint that the row scrolls sideways on a phone */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 26px), transparent);
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 9px 13px; border-radius: 999px;
  font-size: 0.92rem; line-height: 1.2; color: var(--ink2);
  text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="true"] { color: var(--text); background: var(--accent-soft); }

/* ----------------------------------------------------------------- hero */
.hero { position: relative; overflow: hidden; padding-block: clamp(34px, 7vw, 88px) clamp(46px, 8vw, 100px); }
/* Ripples: tucked into the corner on a phone, concentric with the portrait
 * once the hero goes two-column (.zone-rings, below). */
.hero-rings, .zone-rings {
  position: absolute;
  color: var(--accent); opacity: 0.3; pointer-events: none;
  animation: breathe 11s ease-in-out infinite;
}
.hero-rings { top: -190px; right: -210px; width: 560px; height: 560px; }
.zone-rings { display: none; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.hero-grid { position: relative; display: grid; gap: 22px; }
.hero-copy { position: relative; z-index: 1; }   /* copy stays above the ripples */

/* An oval, like the portrait on the current site. Deliberately not an arch:
 * with initials in it instead of a photo, an arch reads as a headstone. */
.portrait-zone { position: relative; width: 88px; }
.portrait {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 5;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: 0 22px 44px -30px color-mix(in srgb, var(--text) 55%, transparent);
}
.portrait .rings {
  position: absolute; left: 50%; top: 50%;
  width: 205%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  color: var(--accent); opacity: 0.55;
}
.monogram { position: relative; font: 400 2rem/1 var(--serif); letter-spacing: 0.04em; color: var(--accent-ink); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait.has-photo .rings, .portrait.has-photo .monogram { display: none; }

.eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px;
  font: 600 0.74rem/1.5 var(--sans);
  letter-spacing: 0.17em; text-transform: uppercase;
  color: var(--accent-ink);
}
.eyebrow .num { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); letter-spacing: 0.06em; }
.eyebrow .num::after { content: ""; width: 26px; height: 1px; background: currentColor; opacity: 0.7; }

.hero h1 {
  margin-top: 14px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.06em 0.2em;
  font: 400 clamp(3.2rem, 14.5vw, 6.4rem)/0.98 var(--serif);
  letter-spacing: -0.02em;
}
.hero h1 .name { white-space: nowrap; }
.hero h1 .cred { font: 600 max(0.82rem, 0.2em)/1 var(--sans); letter-spacing: 0.2em; color: var(--accent-ink); }
.hero-lead {
  margin-top: 22px; max-width: 31ch;
  font: italic 400 clamp(1.32rem, 1.05rem + 1.5vw, 1.95rem)/1.38 var(--serif);
  text-wrap: balance;
}
.hero-sub { margin-top: 14px; max-width: 46ch; color: var(--ink2); }
.actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; }
.supervision {
  margin-top: 28px; max-width: 54ch;
  padding-left: 14px; border-left: 2px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5; color: var(--ink2);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 22px;
  border: 1px solid transparent; border-radius: 999px;
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { border-color: var(--edge); color: var(--text); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------------------------------------------------------------- facts */
.facts { background: var(--panel); border-block: 1px solid var(--line); }
.facts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; padding-block: 24px; }
.facts dt { font: 600 0.7rem/1.4 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink2); }
.facts dd { margin-top: 4px; font: 400 1.08rem/1.3 var(--serif); }

/* ------------------------------------------------------------- sections */
.section { padding-block: clamp(60px, 9vw, 116px); }
.alt { background: var(--wash); border-block: 1px solid var(--line); }
.sec-head { max-width: 780px; margin-bottom: clamp(28px, 4vw, 46px); }
h2 {
  margin-top: 14px;
  font: 400 clamp(1.8rem, 1.2rem + 2.9vw, 2.9rem)/1.12 var(--serif);
  letter-spacing: -0.012em; text-wrap: balance;
}
.lead {
  margin-top: 18px; max-width: 60ch;
  font: 400 clamp(1.1rem, 1.02rem + 0.45vw, 1.3rem)/1.6 var(--serif);
  color: var(--ink2); text-wrap: pretty;
}

.cards { list-style: none; display: grid; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px 26px; }
.card h3 { font: 400 1.4rem/1.2 var(--serif); }
.card p { margin-top: 8px; font-size: 0.97rem; line-height: 1.6; color: var(--ink2); }
.glyph { display: block; width: 36px; height: 36px; margin-bottom: 18px; color: var(--accent); }
.card .card-kicker {
  margin: 0 0 12px;
  font: 600 0.7rem/1.4 var(--sans); letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--accent-ink);
}
.card .card-meta { margin-top: 6px; }
.card .card-link { margin-top: 16px; color: var(--text); }
.cred-sup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 32px; }

.focus {
  margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
}
.focus h3 { font: 600 0.72rem/1.4 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink2); }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li {
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent-soft);
  font: 400 1.06rem/1.25 var(--serif);
}

/* ---------------------------------------------------------------- about */
.split { display: grid; gap: 4px 64px; }
.prose p { max-width: 60ch; }
.prose p + p { margin-top: 1em; }
.prose .first { font: 400 clamp(1.2rem, 1.1rem + 0.5vw, 1.42rem)/1.5 var(--serif); }
.prose h3 { margin-top: 30px; font: 600 0.72rem/1.4 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink2); }
.lessons { list-style: none; counter-reset: lesson; margin: 12px 0 22px; border-top: 1px solid var(--line); }
.lessons li {
  counter-increment: lesson;
  display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.lessons li::before { content: counter(lesson, lower-roman) "."; font: italic 400 1.2rem/1 var(--serif); color: var(--accent-ink); }

/* ---------------------------------------------------------- credentials */
.cred-grid { display: grid; gap: 14px; }
.timeline { list-style: none; margin-top: 20px; border-top: 1px solid var(--line); }
.timeline li {
  display: grid; grid-template-columns: 4.9rem minmax(0, 1fr); gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
  font-size: 0.97rem; line-height: 1.5;
}
.timeline li:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline .when { padding-top: 0.14em; font-family: var(--mono); font-size: 0.84rem; color: var(--accent-ink); }
.kv { margin-top: 18px; border-top: 1px solid var(--line); }
.kv > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: 0.97rem;
}
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--ink2); }
.kv dd { text-align: right; }
.kv .mono { -webkit-user-select: all; user-select: all; }

/* ----------------------------------------------------------------- work */
.orgs { display: grid; gap: 14px; }
.org { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; }
.org-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.org-head h3 { font: 400 1.5rem/1.2 var(--serif); }
.place { font: 600 0.7rem/1.4 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent-ink); }
.project { padding: 18px 0; border-bottom: 1px solid var(--line); }
.project:last-child { border-bottom: 0; padding-bottom: 0; }
.project h4 { font: 600 1rem/1.4 var(--sans); }
.project .when { margin-left: 6px; font: 400 0.84rem var(--mono); color: var(--accent-ink); }
.project p { margin-top: 6px; font-size: 0.95rem; line-height: 1.6; color: var(--ink2); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--edge); border-radius: 999px;
  font-size: 0.9rem; line-height: 1.3;
  text-decoration: none;
}
.chip .i { color: var(--accent-ink); }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.reads { list-style: none; margin-top: 6px; }
.reads li { padding: 9px 0; font-size: 0.97rem; line-height: 1.45; }
.reads li + li { border-top: 1px dashed var(--line); }
.aside { margin-top: 24px; max-width: 62ch; font-size: 0.92rem; color: var(--ink2); }

/* -------------------------------------------------------------- contact */
.contact-grid { display: grid; gap: 30px; }
.contact-grid .sec-head { margin-bottom: 0; }
.email-line { margin-top: 26px; font: 400 clamp(1.15rem, 0.95rem + 1.2vw, 1.6rem)/1.3 var(--serif); overflow-wrap: anywhere; }
.contact-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.status { min-height: 1.5em; margin-top: 12px; font-size: 0.9rem; }
.composer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; }
.composer h3 { font: 400 1.4rem/1.2 var(--serif); }
.field { display: grid; gap: 6px; margin-top: 16px; }
.field label { font-size: 0.86rem; font-weight: 600; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px;
  font: inherit; font-size: 16px; line-height: 1.5; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--edge); border-radius: 10px;
}
.field textarea { min-height: 136px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline-offset: 1px; border-color: var(--accent); border-radius: 10px; }
.composer .btn { margin-top: 18px; }
.fine { margin-top: 12px; font-size: 0.84rem; line-height: 1.5; color: var(--ink2); }
.note {
  margin-top: 16px; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 0.9rem; line-height: 1.55; color: var(--ink2);
}
.note a { color: var(--text); font-weight: 600; }

/* --------------------------------------------------------------- footer */
.foot {
  padding-block: 40px calc(env(safe-area-inset-bottom) + 40px);
  background: var(--wash); border-top: 1px solid var(--line);
  font-size: 0.86rem; line-height: 1.6; color: var(--ink2);
  text-align: center;
}
.foot p { max-width: 62ch; margin-inline: auto; }
.foot p + p { margin-top: 6px; }
.foot-mark { font: 400 1.3rem/1.2 var(--serif); color: var(--text); }
.theme-row { margin-top: 26px; display: flex; align-items: center; gap: 12px; justify-content: center; }
.theme-label { color: var(--ink2); font-size: 0.75rem; }
.theme-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.theme-dot.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.foot .foot-note { margin-top: 14px; color: var(--ink2); font-size: 0.76rem; line-height: 1.5; }

/* --------------------------------------------------------------- reveal */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.js .cards .reveal:nth-child(2) { transition-delay: 0.07s; }
.js .cards .reveal:nth-child(3) { transition-delay: 0.14s; }
.js .cards .reveal:nth-child(4) { transition-delay: 0.21s; }

/* --------------------------------------------------------------- wider */
@media (min-width: 600px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* 1, 2 or 4 across: never an orphan */
}
@media (min-width: 760px) {
  .nav { overflow: visible; padding-inline: 0; -webkit-mask-image: none; mask-image: none; }
}
@media (min-width: 980px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); align-items: center; column-gap: clamp(32px, 6vw, 88px); }
  .hero-copy { grid-column: 1; grid-row: 1; }
  .portrait-zone { grid-column: 2; grid-row: 1; width: min(100%, 372px); justify-self: end; }
  .monogram { font-size: 6.6rem; }
  .hero-rings { display: none; }
  .zone-rings { display: block; left: 50%; top: 50%; width: 860px; height: 860px; margin: -430px 0 0 -430px; }
  .facts-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding-block: 0; }
  .facts-grid > div { padding: 26px 24px; border-left: 1px solid var(--line); }
  .facts-grid > div:first-child { padding-left: 0; border-left: 0; }
  .split { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; }
  .split .sec-head { position: sticky; top: 100px; margin-bottom: 0; }
  .cred-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .cred-sup { grid-column: 1 / -1; }
  .orgs { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: start; }
  .card, .org, .composer { padding: 28px 28px 30px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-rings, .zone-rings { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* A printed copy doubles as a one-page profile. */
@media print {
  :root, html[data-theme] {
    --bg: #fff; --panel: #fff; --panel2: #fff; --line: #bbb;
    --text: #111; --muted: #444; --accent: #555;
  }
  .ribbon, .bar, .skip, .actions, .contact-actions, .composer, .note, .theme-row, .foot-note, .hero-rings, .zone-rings, .portrait:not(.has-photo) { display: none !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .section, .hero { padding-block: 18px; }
  .card, .org { break-inside: avoid; }
  body { font-size: 11pt; }
}
