/* ---------------------------------------------------------------------------
   Daewon Chae — personal site
   San Francisco (Inter fallback), white ground, vivid emerald accent.
   Light theme only.
--------------------------------------------------------------------------- */

:root {
  color-scheme: light only;

  --bg: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #484850;
  --muted: #86868b;
  --rule: #e5e5e7;
  --accent: #00875a;
  --accent-soft: #00a86b;
  --tag-bg: #e6f6ef;
  --tag-ink: #00684a;
  --select: #cff3e1;

  /* photo width drives the contact icon row below it, so one number rescales
     the whole left column */
  --photo: 205px;

  /* San Francisco on Apple platforms; Inter is the closest stand-in elsewhere.
     SF Pro Display is optically tuned for large sizes, SF Pro Text for body. */
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro",
    "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Inter",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* An author-level `display` (e.g. .year-group's grid) outranks the UA
   stylesheet's [hidden] rule, so the attribute needs to win explicitly. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -0.003em;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--select);
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 72px 28px 96px;
}

/* --- links ---------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration: none;
  /* hairline underline; the color-mix line is a progressive upgrade */
  border-bottom: 1px solid var(--rule);
  border-bottom-color: color-mix(in srgb, var(--accent) 28%, transparent);
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-soft);
  border-bottom-color: var(--accent-soft);
}

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

/* --- intro ---------------------------------------------------------------- */

.intro {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 40px;
}

.intro-text {
  flex: 1 1 auto;
  min-width: 0;
}

.intro-photo {
  order: -1;
  flex: 0 0 var(--photo);
  margin-top: 10px;
}

.intro-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  filter: saturate(0.92);
}

h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.032em;
  line-height: 1.1;
}

.tagline {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.bio {
  margin: 0 0 15px;
  color: var(--ink-soft);
}

.bio:last-of-type {
  margin-bottom: 0;
}

/* --- contact icons (under the photo) -------------------------------------- */

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: calc(var(--photo) * 0.073);
  margin-top: calc(var(--photo) * 0.068);
}

.contact a {
  display: inline-flex;
  /* no hairline underline on an icon */
  border-bottom: 0;
  /* padding pulled back by margin: a finger-sized hit area, same visual size */
  padding: 5px;
  margin: -5px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.contact a:hover,
.contact a:focus-visible {
  color: var(--accent);
}

.contact svg {
  display: block;
  /* width follows each icon's own aspect ratio so none is squashed */
  height: max(14px, calc(var(--photo) * 0.078));
  width: auto;
  fill: currentColor;
}

/* --- sections ------------------------------------------------------------- */

section {
  margin-top: 64px;
}

h2 {
  margin: 0 0 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.022em;
}

.legend {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- publication view tabs ------------------------------------------------ */

.pub-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 24px;
  margin: 0 0 2px;
  border-bottom: 1px solid var(--rule);
}

.pub-tab {
  /* sit the active underline on top of the row's hairline */
  margin-bottom: -1px;
  padding: 0 0 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--display);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.022em;
  line-height: 1.25;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pub-tab:hover {
  color: var(--ink-soft);
}

.pub-tab[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

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

/* Selected view: only the curated entries, and no year rail — the year
   chronology is what the full view is for. */
#pub-list[data-mode="selected"] .pubs > li:not([data-selected]) {
  display: none;
}

#pub-list[data-mode="selected"] .year-group {
  grid-template-columns: 1fr;
  /* match .pubs li + li so entries read as one evenly spaced list even when
     they come from different year groups */
  margin-top: 26px;
}

#pub-list[data-mode="selected"] .year {
  display: none;
}

/* --- news ----------------------------------------------------------------- */

.news {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.news li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0 8px;
  padding: 7px 0;
}

.news time {
  color: var(--muted);
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 450;
  letter-spacing: 0.005em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.news span {
  color: var(--ink-soft);
}

/* --- publications --------------------------------------------------------- */

.year-group {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0 8px;
  margin-top: 34px;
}

.year {
  color: var(--muted);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
}

.pubs {
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.pubs li + li {
  margin-top: 26px;
}

.pub-title {
  margin: 0 0 3px;
  font-family: var(--display);
  font-size: 17.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.016em;
}

.authors {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.authors .me {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.venue {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.006em;
  line-height: 1.6;
}

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 2px;
  background: var(--tag-bg);
  color: var(--tag-ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1.5px;
  white-space: nowrap;
}

.pub-links {
  margin: 7px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 9px;
  font-size: 14px;
}

.pub-links .sep {
  color: var(--rule);
  user-select: none;
}

/* author list expansion */
.authors-rest {
  display: none;
}

.authors.open .authors-rest {
  display: inline;
}

.authors.open .authors-dots {
  display: none;
}

.authors-toggle {
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.authors-toggle:hover {
  color: var(--accent);
}

.authors-toggle .less {
  display: none;
}

.authors.open .authors-toggle .more {
  display: none;
}

.authors.open .authors-toggle .less {
  display: inline;
}

/* --- footer --------------------------------------------------------------- */

footer {
  margin-top: 72px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 13px;
}

/* --- narrow screens ------------------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --photo: 165px;
  }

  .page {
    padding: 44px 20px 72px;
  }

  .intro {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  .intro-photo {
    flex: 0 0 auto;
    width: var(--photo);
    margin-top: 0;
  }

  /* align-items:center would otherwise shrink this block to its content
     width; the bio itself stays left-aligned, which reads better */
  .intro-text {
    width: 100%;
  }

  h1,
  .tagline {
    text-align: center;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 22px;
  }

  .pub-tabs {
    gap: 0 18px;
  }

  .pub-tab {
    font-size: 18px;
  }

  section {
    margin-top: 48px;
  }

  .news li,
  .year-group {
    grid-template-columns: 1fr;
  }

  .news li {
    padding: 9px 0;
  }

  .news time {
    font-size: 13.5px;
  }

  .year {
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--rule);
  }

  .year-group {
    margin-top: 28px;
  }
}
