/* =========================================================
   Chelsie Lim — academic site
   Restrained, editorial, scholarly. Light only by default.
   ========================================================= */

:root {
  /* Palette — warm paper / ink with a single oxblood accent */
  --paper:        #F6F3EC;   /* primary background, warm off-white */
  --paper-2:      #EFEBE1;   /* alt section */
  --paper-3:      #FBF9F3;   /* card / surface */
  --rule:         #C9C2B2;   /* hairlines */
  --ink:          #1F1B16;   /* primary text — near-black, warm */
  --ink-2:        #4A4538;   /* secondary text */
  --ink-3:        #807A6B;   /* tertiary / meta */
  --accent:       #6B1F2A;   /* oxblood — links, marks */
  --accent-soft:  #8C2F3A;
  --focus:        #8A6B1F;   /* warm focus ring */

  /* Type */
  --serif: "Source Serif 4", "Iowan Old Style", "Charter", Georgia, serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Type scale */
  --t-xs:   0.8125rem;   /* 13px */
  --t-sm:   0.9375rem;   /* 15px */
  --t-base: 1.0625rem;   /* 17px body */
  --t-lg:   1.25rem;     /* 20px */
  --t-xl:   1.625rem;    /* 26px */
  --t-2xl:  2.125rem;    /* 34px */
  --t-3xl:  clamp(2.25rem, 4.4vw, 3.5rem);    /* section super */
  --t-hero: clamp(2.5rem, 6.4vw, 5rem);       /* hero only */

  /* Spacing */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 6rem;
  --s-10: 8rem;

  /* Layout */
  --maxw: 72rem;          /* 1152px */
  --measure: 38rem;       /* prose ~ 65ch */
  --radius: 2px;
}

/* Reset-ish */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-soft); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper); padding: var(--s-3) var(--s-4);
  z-index: 100;
}
.skip-link:focus { left: var(--s-3); top: var(--s-3); }

/* Container */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* ============== HEADER ============== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
  padding-block: var(--s-4);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  text-decoration: none; color: var(--ink);
}
.brand-mark { color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--serif); font-weight: 600; font-size: 1.0625rem;
  letter-spacing: 0.005em;
}
.brand-sub {
  font-size: 0.75rem; color: var(--ink-3); letter-spacing: 0.08em;
  text-transform: uppercase; margin-top: 2px;
}
.nav { list-style: none; display: flex; gap: var(--s-5); margin: 0; padding: 0; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: var(--t-sm);
  letter-spacing: 0.01em;
  padding-block: var(--s-1);
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
@media (max-width: 640px) {
  .brand-sub { display: none; }
  .nav { gap: var(--s-3); flex-wrap: wrap; justify-content: flex-end; }
  .nav a { font-size: 0.8125rem; }
}

/* ============== HERO ============== */
.hero {
  padding-block: clamp(3rem, 7vw, 6rem) clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; max-width: 22rem; }
}
.eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 var(--s-5) 0;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.25rem, 5vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 var(--s-6) 0;
  color: var(--ink);
  max-width: 20ch;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}
.lede {
  font-family: var(--serif);
  font-size: var(--t-lg);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 36rem;
  margin: 0 0 var(--s-6) 0;
}
.project-card {
  max-width: 38rem;
  margin: 0 0 var(--s-6);
  padding: var(--s-5);
  background: var(--paper-3);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 24px -24px rgba(31, 27, 22, 0.35);
}
.project-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 var(--s-3);
}
.project-card h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  line-height: 1.16;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--s-3);
}
.project-card h2 em {
  color: var(--accent);
  font-style: italic;
}
.project-card p:last-child {
  font-family: var(--serif);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
}
.hero-meta {
  font-size: var(--t-sm);
  color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  align-items: center;
}
.hero-meta .dot { color: var(--rule); }

/* Portrait */
.portrait { margin: 0; }
.portrait-frame {
  aspect-ratio: 3 / 4;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 18px 32px -22px rgba(31,27,22,0.2);
}
.portrait-frame img {
  width: 100%; height: 100%; object-fit: cover;
}
.portrait figcaption {
  font-size: 0.75rem; color: var(--ink-3);
  margin-top: var(--s-3);
  letter-spacing: 0.04em;
}

/* ============== SECTIONS ============== */
.section {
  padding-block: clamp(3.5rem, 7vw, 6rem);
  border-bottom: 1px solid var(--rule);
}
.section-alt { background: var(--paper-2); }

.two-col {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
@media (max-width: 820px) {
  .two-col { grid-template-columns: 1fr; gap: var(--s-5); }
}
.col-label {
  position: sticky;
  top: 5.5rem;
  display: flex; align-items: center; gap: var(--s-3);
}
@media (max-width: 820px) { .col-label { position: static; } }
.col-label .rule {
  flex: none;
  width: 1.25rem; height: 1px; background: var(--ink-3);
}
.section-kicker {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
  font-weight: 500;
}

/* Prose */
.prose {
  font-family: var(--serif);
  font-size: var(--t-base);
  line-height: 1.7;
  max-width: var(--measure);
  color: var(--ink);
}
.prose p + p { margin-top: 1em; }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  padding: 1px 5px;
  border-radius: var(--radius);
}
.dropcap::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 3.4em;
  line-height: 0.85;
  float: left;
  padding: 0.05em 0.12em 0 0;
  color: var(--accent);
}
.interests-block {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.interests-block h3 {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 500;
  margin: 0 0 var(--s-4);
}
.interests-block ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: 0;
  margin: 0;
}
.interests-block li {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--ink-2);
  background: var(--paper-3);
  border: 1px solid var(--rule);
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
}

/* Research */
.research-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--t-2xl);
  line-height: 1.18;
  letter-spacing: -0.005em;
  margin: 0 0 var(--s-6) 0;
  max-width: 28ch;
  color: var(--ink);
}
.pull {
  margin: var(--s-7) 0;
  padding: var(--s-5) 0 var(--s-5) var(--s-5);
  border-left: 2px solid var(--accent);
  max-width: 36rem;
}
.pull p {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-xl);
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}
.research-pillars {
  list-style: none; margin: var(--s-7) 0 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-6) var(--s-7);
  border-top: 1px solid var(--rule);
  padding-top: var(--s-6);
}
@media (max-width: 680px) { .research-pillars { grid-template-columns: 1fr; } }
.research-pillars h4 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t-sm);
  margin: 0 0 var(--s-2) 0;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.research-pillars p {
  margin: 0; color: var(--ink-2);
  font-size: var(--t-sm); line-height: 1.6;
}

/* Teaching / profile */
.profile-list {
  display: grid;
  gap: var(--s-5);
  max-width: 42rem;
}
.profile-item {
  padding: var(--s-5);
  background: var(--paper-3);
  border: 1px solid var(--rule);
}
.profile-item h3,
.profile-item h4 {
  font-family: var(--serif);
  font-size: var(--t-xl);
  line-height: 1.25;
  font-weight: 500;
  margin: var(--s-2) 0 var(--s-3);
  color: var(--ink);
}
.profile-item p:last-child {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: 1.65;
}

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub {
  padding: var(--s-5) 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: var(--s-5);
}
.pub:last-child { border-bottom: 1px solid var(--rule); }
@media (max-width: 680px) { .pub { grid-template-columns: 1fr; gap: var(--s-2); } }
.pub-meta {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0.25em 0 0 0;
}
.pub-title {
  font-family: var(--serif);
  font-size: var(--t-lg);
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 var(--s-2) 0;
  font-weight: 500;
}
.pub-cite {
  font-size: var(--t-sm);
  color: var(--ink-2);
  margin: 0;
}
.pub-abstract {
  grid-column: 2;
  margin: var(--s-3) 0 0;
  max-width: 44rem;
  font-size: var(--t-sm);
  line-height: 1.7;
  color: var(--ink-2);
}
@media (max-width: 680px) { .pub-abstract { grid-column: 1; } }
.pub--placeholder .pub-title { color: var(--ink-2); }
.pubs-note {
  margin-top: var(--s-6);
  font-size: var(--t-sm);
  color: var(--ink-3);
}

/* Contact form */
.contact-form {
  max-width: 38rem;
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-6);
  padding: var(--s-6);
  background: var(--paper-3);
  border: 1px solid var(--rule);
}
.field { display: grid; gap: var(--s-2); }
.field label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 500;
}
.field input, .field textarea {
  font-family: var(--sans);
  font-size: var(--t-base);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }

.form-actions {
  display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2);
}
.btn {
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: var(--s-3) var(--s-5);
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: var(--s-2);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--rule);
}
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-3); }
.form-note { font-size: 0.8125rem; color: var(--ink-3); margin: var(--s-2) 0 0; }

/* Link cards */
.links {
  list-style: none; margin: var(--s-7) 0 0; padding: 0;
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(2, minmax(0,1fr));
  max-width: 38rem;
}
@media (max-width: 560px) { .links { grid-template-columns: 1fr; } }
.link-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  background: var(--paper-3);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.link-card:hover {
  border-color: var(--ink-3);
  background: var(--paper);
}
.link-label {
  font-family: var(--serif);
  font-size: var(--t-base);
  font-weight: 500;
  display: block;
}
.link-host {
  font-size: 0.75rem;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  display: block;
  grid-column: 1 / 2;
}
.link-icon { color: var(--ink-3); grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.link-card:hover .link-icon { color: var(--accent); }

/* ============== FOOTER ============== */
.site-footer {
  padding-block: var(--s-7);
  background: var(--paper);
  border-top: 1px solid var(--rule);
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6);
  justify-content: space-between; align-items: center;
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.footer-inner p { margin: 0; }
.colophon { font-style: italic; font-family: var(--serif); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
