/* ==========================================================================
   Terry Chern — personal site
   Single stylesheet, no build step, no external dependencies.
   Design tokens live in :root; change those first before touching anything else.
   ========================================================================== */

:root {
  /* Palette — light */
  --bg:            #fbfaf8;
  --bg-alt:        #f2efea;
  --surface:       #ffffff;
  --text:          #1c1b19;
  --text-muted:    #5f5c56;
  --border:        #e2ded7;
  --accent:        #0f6f6c;
  --accent-hover:  #0d5b58;
  --accent-soft:   #e2f0ef;
  --shadow:        0 1px 2px rgba(28,27,25,.05), 0 8px 24px rgba(28,27,25,.06);

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;

  /* Rhythm */
  --wrap: 1080px;
  --wrap-narrow: 680px;
  --gap: 1.5rem;
  --section-y: clamp(4rem, 9vw, 7rem);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #14161a;
    --bg-alt:       #1a1d22;
    --surface:      #1f2329;
    --text:         #e8e6e3;
    --text-muted:   #a4a29d;
    --border:       #2e333a;
    --accent:       #4fd1c5;
    --accent-hover: #7ee0d7;
    --accent-soft:  #16302e;
    --shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}

:root[data-theme="dark"] {
  --bg:           #14161a;
  --bg-alt:       #1a1d22;
  --surface:      #1f2329;
  --text:         #e8e6e3;
  --text-muted:   #a4a29d;
  --border:       #2e333a;
  --accent:       #4fd1c5;
  --accent-hover: #7ee0d7;
  --accent-soft:  #16302e;
  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

/* --------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* -------------------------------------------------------------- layout -- */
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, var(--wrap-narrow)); }
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1.25rem;
  position: relative; padding-bottom: .6rem;
}
.section__title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 2.5rem; height: 3px; background: var(--accent); border-radius: 2px;
}
.section__lede { color: var(--text-muted); max-width: 60ch; font-size: 1.05rem; margin-bottom: 2.5rem; }
.section__more { margin-top: 2rem; }
.subhead { margin-top: 3rem; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.prose { max-width: 65ch; }
.prose p { margin-bottom: 1.15rem; }

/* --------------------------------------------------------------- nav -- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  display: flex; align-items: center; gap: 1rem;
  min-height: 4rem;
}
.nav__brand { font-weight: 680; letter-spacing: -.02em; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.nav__menu {
  list-style: none; display: flex; align-items: center; gap: 1.4rem;
  margin: 0 0 0 auto; padding: 0;
}
.nav__menu a { color: var(--text-muted); text-decoration: none; font-size: .93rem; }
.nav__menu a:hover { color: var(--text); }
.nav__cta {
  background: var(--accent); color: #fff !important; padding: .45rem .9rem;
  border-radius: 999px; font-weight: 550;
}
.nav__cta:hover { background: var(--accent-hover); }
.nav__toggle { display: none; }

.theme-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }

@media (max-width: 860px) {
  .nav__menu { display: none; }
  .nav__menu.is-open {
    display: flex; flex-direction: column; align-items: flex-start; gap: .9rem;
    position: absolute; top: 4rem; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.25rem 1.75rem;
  }
  .nav__toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    margin-left: auto; width: 2.2rem; height: 2.2rem;
    background: transparent; border: 0; cursor: pointer; padding: 0;
  }
  .nav__toggle span { display: block; height: 2px; width: 20px; background: var(--text); border-radius: 2px; }
}

/* --------------------------------------------------------------- hero -- */
.hero { padding-block: clamp(3rem, 8vw, 6rem) var(--section-y); }
.hero__inner { display: grid; grid-template-columns: 1.35fr .9fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 800px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; max-width: 260px; }
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .78rem;
  font-weight: 600; color: var(--accent); margin-bottom: .9rem;
}
.accent { color: var(--accent); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--text-muted); max-width: 54ch; margin-bottom: 1.75rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.75rem; }
.hero__links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .92rem; }
.hero__portrait img {
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; object-fit: cover; aspect-ratio: 4 / 5;
  background: var(--bg-alt);
}

/* ------------------------------------------------------------ buttons -- */
.btn {
  display: inline-block; padding: .7rem 1.4rem; border-radius: 999px;
  font-size: .95rem; font-weight: 550; text-decoration: none;
  border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost { border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* -------------------------------------------------------------- cards -- */
.cards { display: grid; gap: var(--gap); }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .6rem; }
.card p { color: var(--text-muted); font-size: .96rem; }
.card__links { margin-top: auto; font-size: .92rem; }
.card--project { display: flex; flex-direction: column; }

.pill {
  display: inline-block; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .09em; font-weight: 650; padding: .2rem .6rem;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  margin-bottom: .8rem;
}
.pill--muted { background: var(--bg-alt); color: var(--text-muted); }

.ticks { list-style: none; padding: 0; margin: 1rem 0 0; }
.ticks li {
  position: relative; padding-left: 1.5rem; margin-bottom: .5rem;
  font-size: .95rem; color: var(--text);
}
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent);
}

/* ----------------------------------------------------- entries (list) -- */
.stack { display: flex; flex-direction: column; gap: 2rem; }
.entry {
  display: grid; grid-template-columns: 8.5rem 1fr; gap: 1.5rem;
  padding-bottom: 2rem; border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
@media (max-width: 700px) { .entry { grid-template-columns: 1fr; gap: .5rem; } }
.entry__body h3 { margin-bottom: .35rem; }
.entry__org { color: var(--accent); font-weight: 550; margin-bottom: .5rem; font-size: .96rem; }
.entry__body p { color: var(--text-muted); font-size: .97rem; }
.entry__sowhat { color: var(--text) !important; }
.entry__sowhat strong { color: var(--accent); }
.entry__links { display: flex; gap: 1.1rem; font-size: .92rem; margin-top: .6rem; }
/* publication venue line — quieter than the body copy, sits under "So what" */
.entry__venue { font-size: .88rem !important; margin-top: .6rem; opacity: .8; }
.tag {
  display: inline-block; font-size: .82rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums; padding-top: .25rem;
}

/* -------------------------------------------------------- engagements -- */
.engage {
  margin-top: 3rem; padding: 2rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.engage__title { margin-bottom: 1rem; }
.steps { margin: 0 0 1.5rem; padding-left: 1.2rem; }
.steps li { margin-bottom: .6rem; color: var(--text-muted); }
.steps strong { color: var(--text); }
.engage__cta { margin: 0; }

/* -------------------------------------------------------------- chips -- */
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.chips li {
  font-size: .87rem; padding: .3rem .8rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}

/* ------------------------------------------------------------ gallery -- */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); }
.gallery figure { margin: 0; }
.gallery img {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow); background: var(--bg);
}
.gallery figcaption { font-size: .87rem; color: var(--text-muted); margin-top: .6rem; }

/* ------------------------------------------------------------ contact -- */
.section--contact { text-align: center; }
.section--contact .section__title::after { left: 50%; transform: translateX(-50%); }
.section--contact .section__lede { margin-inline: auto; }
.contact__email { font-size: clamp(1.15rem, 3vw, 1.6rem); font-weight: 600; margin-bottom: 1.5rem; }
.contact__links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; font-size: .95rem; }

/* ------------------------------------------------------------- footer -- */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; font-size: .9rem; color: var(--text-muted); }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.site-footer p { margin: 0; }
