/* Tracy Lin portfolio. Tokens first, two themes, no dashes in any rendered copy. */

:root {
  --ink: #16222c;
  --ink-soft: #47586a;
  --ink-faint: #7b8a99;
  --paper: #f6f8f9;
  --card: #ffffff;
  --line: #dfe6ea;
  --accent: #297197;
  --accent-deep: #1d5674;
  --accent-soft: #e3eef4;
  --amber: #d9a441;
  --amber-soft: #f9f0dc;
  --rose: #c25e6a;
  --shadow: 0 1px 2px rgba(22, 34, 44, .06), 0 12px 32px rgba(22, 34, 44, .08);
  --shadow-lift: 0 2px 4px rgba(22, 34, 44, .08), 0 18px 44px rgba(22, 34, 44, .14);
  --radius: 18px;
  --radius-lg: 26px;
  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Sora", -apple-system, "Segoe UI", sans-serif;
  --dur: 240ms;
  --ease: cubic-bezier(.22, .8, .3, 1);
}

:root[data-theme="dark"] {
  --ink: #e8eef2;
  --ink-soft: #a8b8c4;
  --ink-faint: #6d7f8d;
  --paper: #101a21;
  --card: #182631;
  --line: #263844;
  --accent: #5ba3c9;
  --accent-deep: #7fbcdc;
  --accent-soft: #1c313f;
  --amber: #d9a441;
  --amber-soft: #33290f;
  --rose: #d98793;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 44px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; background: var(--paper); }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

img { max-width: 100%; display: block; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 99;
  background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 8px;
}
.skip-link:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(20px, 5vw, 56px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--line); }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .02em;
}
.brand-name { font-weight: 600; font-size: 15px; }

.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none; color: var(--ink-soft);
  font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.topnav a:hover { color: var(--ink); background: var(--accent-soft); }

.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.theme-toggle:hover { transform: translateY(-1px); color: var(--accent); }
:root[data-theme="dark"] .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: none; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(64px, 12vh, 130px) clamp(20px, 5vw, 56px) 72px; }
.hero-inner { max-width: 880px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }

.hero-glow {
  position: absolute; inset: auto 0 -40% 0; height: 90%;
  background:
    radial-gradient(48% 58% at 28% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(40% 52% at 76% 100%, color-mix(in srgb, var(--amber) 14%, transparent), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 500; line-height: 1.04; letter-spacing: -.015em;
  margin: 18px 0 26px;
}
.hero-title em { font-style: italic; color: var(--accent); }

.hero-line { max-width: 560px; margin: 0 auto 34px; color: var(--ink-soft); font-size: 17px; }

.ph-chip {
  display: inline-block;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #7a5b12; background: var(--amber-soft);
  border: 1px dashed var(--amber);
  padding: 3px 10px; border-radius: 999px;
  margin-bottom: 10px;
}
:root[data-theme="dark"] .ph-chip { color: #e8c884; }
.placeholder-copy { border-radius: var(--radius); }

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 999px;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-deep); box-shadow: var(--shadow-lift); }
:root[data-theme="dark"] .btn-primary { color: #0d1920; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.stat-pills {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
}
.stat-pills li {
  min-width: 132px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px 12px;
  box-shadow: var(--shadow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat-pills li:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat-pills strong {
  display: block;
  font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-pills span { font-size: 12.5px; color: var(--ink-faint); }

.stat-note { margin-top: 18px; font-size: 12.5px; color: var(--ink-faint); }

/* the one Selected writing card (decision: single entry point to /writing) */
.writing-cta {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas:
    "eyebrow arrow"
    "title arrow"
    "meta arrow";
  column-gap: 18px; align-items: center;
  margin-top: 26px; padding: 22px 26px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.writing-cta:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.writing-cta:hover .writing-cta-arrow { transform: translateX(4px); color: var(--accent); }
.writing-cta-eyebrow {
  grid-area: eyebrow;
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}
.writing-cta-title {
  grid-area: title;
  font-family: var(--font-display); font-size: clamp(21px, 3.4vw, 26px); font-weight: 500; line-height: 1.2;
}
.writing-cta-meta { grid-area: meta; margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.writing-cta-arrow { grid-area: arrow; color: var(--ink-faint); transition: transform var(--dur) var(--ease), color var(--dur) var(--ease); }

/* ---------- sections ---------- */
.section { padding: clamp(56px, 9vh, 110px) clamp(20px, 5vw, 56px); max-width: 1120px; margin: 0 auto; }
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head h2, .about-col h2, .contact-card h2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 44px); font-weight: 500; line-height: 1.12; letter-spacing: -.01em;
  margin: 12px 0 14px;
}
.section-sub { color: var(--ink-soft); }

/* ---------- dashboard ---------- */
.dash {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.4vw, 36px);
}

.dash-tabs { display: flex; gap: 6px; margin-bottom: 26px; flex-wrap: wrap; }
.dash-tab {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  padding: 9px 20px; border-radius: 999px; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.dash-tab:hover { color: var(--accent); border-color: var(--accent); }
.dash-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .dash-tab.is-active { color: #0d1920; }

.dash-panel { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(20px, 4vw, 44px); align-items: start; }
.dash-panel[hidden] { display: none; }

.chart { display: flex; flex-direction: column; gap: 13px; }

.bar-row { display: grid; grid-template-columns: 148px 1fr; gap: 14px; align-items: center; }
.bar-label { font-size: 13.5px; font-weight: 500; color: var(--ink-soft); text-align: right; line-height: 1.25; }
.bar-track { position: relative; height: 30px; background: var(--accent-soft); border-radius: 8px; overflow: hidden; }
.bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 72%, var(--amber)));
  border-radius: 8px;
  transition: width 900ms var(--ease);
  cursor: default;
}
.bar-row:nth-child(odd) .bar-fill { background: linear-gradient(90deg, var(--accent-deep), var(--accent)); }
.bar-value {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.dash-insight h3 { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin-bottom: 10px; }
.dash-insight p { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 18px; }

.mini-stats { display: flex; flex-direction: column; gap: 10px; }
.mini-stats div {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 10px 14px; background: var(--accent-soft); border-radius: 10px;
}
.mini-stats dt { font-size: 12.5px; color: var(--ink-soft); }
.mini-stats dt { flex-shrink: 0; }
.mini-stats dd { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }

.dash-proof {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--ink-faint);
}
.proof-link {
  border: 1px solid var(--line); background: transparent; color: var(--accent);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.proof-link:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- case studies ---------- */
.case-list { display: flex; flex-direction: column; gap: 18px; }

.case {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow var(--dur) var(--ease);
}
.case:hover { box-shadow: var(--shadow-lift); }

.case-head {
  display: grid; grid-template-columns: 1fr auto auto; gap: clamp(14px, 3vw, 36px); align-items: center;
  width: 100%; text-align: left;
  padding: clamp(20px, 3vw, 30px) clamp(20px, 3.4vw, 36px);
  background: none; border: 0; cursor: pointer; color: inherit; font-family: inherit;
}
.case-tag { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.case-title h3 {
  font-family: var(--font-display); font-size: clamp(20px, 2.6vw, 27px); font-weight: 500; line-height: 1.2;
  margin-top: 6px;
}

.case-kpis { list-style: none; display: flex; gap: clamp(14px, 2.4vw, 32px); }
.case-kpis li { text-align: right; }
.case-kpis strong {
  display: block; font-family: var(--font-display); font-size: clamp(20px, 2.4vw, 26px); font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--accent);
}
.case-kpis span { font-size: 11.5px; color: var(--ink-faint); }

.case-chevron {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  position: relative; flex-shrink: 0;
  transition: transform 320ms var(--ease), border-color var(--dur) var(--ease);
}
.case-chevron::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft);
  transform: translate(-50%, -66%) rotate(45deg);
}
.case.is-open .case-chevron { transform: rotate(180deg); border-color: var(--accent); }

.case-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 420ms var(--ease);
}
.case.is-open .case-body { grid-template-rows: 1fr; }
.case-body > .case-grid { overflow: hidden; }

.case-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  padding: 0 clamp(20px, 3.4vw, 36px);
}
.case.is-open .case-grid { padding-bottom: clamp(22px, 3vw, 34px); }

.case-fig img {
  border-radius: 14px; border: 1px solid var(--line);
  aspect-ratio: 16 / 10.5; object-fit: cover; object-position: top;
  transition: transform var(--dur) var(--ease);
}
.case-fig:hover img { transform: scale(1.02); }
.case-fig figcaption { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; line-height: 1.45; }

.case-notes { grid-column: 1 / -1; max-width: 760px; }
.case-notes p { color: var(--ink-soft); font-size: 15px; margin-bottom: 12px; }
.case-notes ul { padding-left: 20px; color: var(--ink-soft); font-size: 14.5px; display: flex; flex-direction: column; gap: 6px; }
.case-notes li::marker { color: var(--accent); }

/* labelled fact blocks (de-voiced case cards) */
.facts { display: flex; flex-direction: column; }
.facts > div {
  display: grid; grid-template-columns: 84px 1fr; gap: 14px;
  padding: 9px 0; border-top: 1px solid var(--line); align-items: baseline;
}
.facts > div:first-child { border-top: 0; }
.facts dt {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
}
.facts dd { font-size: 14.5px; color: var(--ink-soft); }
.facts dd strong { color: var(--ink); }

/* ---------- writing ---------- */
.writing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.w-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(22px, 3vw, 32px);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.w-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }

.w-card h3 { font-family: var(--font-display); font-size: 22px; font-weight: 500; line-height: 1.25; }
.w-card p { font-size: 14.5px; color: var(--ink-soft); flex-grow: 1; }
.w-meta { font-size: 12.5px; color: var(--ink-faint); }

.w-badge {
  align-self: flex-start;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px;
}

.w-card-todo { border-style: dashed; background: color-mix(in srgb, var(--card) 55%, var(--paper)); box-shadow: none; }
.w-card-todo:hover { transform: none; box-shadow: none; }

.w-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none;
  margin-top: 4px;
}
.w-link svg { transition: transform var(--dur) var(--ease); }
.w-link:hover svg { transform: translate(2px, -2px); }

/* ---------- about ---------- */
.section-about { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); max-width: none; }
.about-grid { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(28px, 5vw, 72px); }
.about-facts dl { display: flex; flex-direction: column; gap: 0; }
.about-facts div { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.about-facts div:last-child { border-bottom: 0; }
.about-facts dt { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.about-facts dd { font-size: 14.5px; color: var(--ink-soft); }

/* ---------- contact ---------- */
.contact-card {
  text-align: center;
  background:
    radial-gradient(120% 160% at 50% 0%, color-mix(in srgb, var(--accent) 10%, var(--card)), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(40px, 7vw, 72px) clamp(24px, 5vw, 64px);
}
.contact-card p { color: var(--ink-soft); margin: 10px 0 28px; }
.contact-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- footer ---------- */
.footer { text-align: center; padding: 34px 20px 44px; font-size: 12.5px; color: var(--ink-faint); }

/* ---------- lightbox ---------- */
.lightbox[hidden], .tooltip[hidden] { display: none; }

.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 16, 22, .82);
  display: grid; place-items: center; padding: 4vmin;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox figure { max-width: min(1100px, 94vw); }
.lightbox img { max-height: 78vh; width: auto; max-width: 100%; margin: 0 auto; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lightbox figcaption { color: #cfdbe4; text-align: center; font-size: 13.5px; margin-top: 14px; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 7px 12px; border-radius: 8px;
  box-shadow: var(--shadow-lift);
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 640ms var(--ease), transform 640ms var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- focus ---------- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .dash-panel { grid-template-columns: 1fr; }
  .case-head { grid-template-columns: 1fr auto; }
  .case-kpis { grid-column: 1 / -1; order: 3; justify-content: flex-start; }
  .case-kpis li { text-align: left; }
  .case-grid { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topnav { display: none; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .bar-label { text-align: left; }
  .writing-grid { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; }
  .about-facts div { grid-template-columns: 1fr; gap: 4px; }
  .stat-pills li { min-width: calc(50% - 8px); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar-fill { transition: none; }
  * { animation: none !important; }
}
