/* =========================================================
   Junsol Kim - personal website
   Design tokens
   ========================================================= */
:root {
  --bg:            #f6f3ea;
  --bg-alt:        #eeeadc;
  --bg-deep:       #e0dcca;
  --surface:       #ffffff;

  --ink:           #12151c;
  --ink-soft:      #1d222d;
  --muted:         #5a5d66;
  --muted-light:   #9a9ea5;
  --divider:       #ddd8c6;
  --divider-strong:#c8c2ae;

  --accent:        #7b3f2b; /* muted oxblood - picks up Chicago maroon without shouting */
  --accent-soft:   #a6573d;
  --accent-deep:   #4e2717;

  --serif: 'Cormorant Garamond', 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --fs-xs:    0.75rem;
  --fs-sm:    0.875rem;
  --fs-base:  1rem;
  --fs-md:    1.125rem;
  --fs-lg:    1.375rem;
  --fs-xl:    1.875rem;
  --fs-2xl:   2.5rem;
  --fs-3xl:   3.5rem;
  --fs-4xl:   4.75rem;

  --lh-tight: 1.14;
  --lh-body:  1.6;

  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  22px;
  --s-6:  32px;
  --s-7:  44px;
  --s-8:  60px;
  --s-9:  84px;
  --s-10: 112px;

  --max-w:    1120px;
  --max-w-rd: 720px;
  --radius:   2px;

  --ease: cubic-bezier(.2,.6,.2,1);
  --dur:  300ms;
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

h1 { font-size: clamp(1.9rem, 5.2vw, var(--fs-3xl)); font-weight: 500; overflow-wrap: break-word; hyphens: auto; }
h2 { font-size: clamp(1.5rem, 3.2vw, var(--fs-2xl)); font-weight: 500; overflow-wrap: break-word; }
h3 { font-size: var(--fs-lg); font-weight: 500; overflow-wrap: break-word; }
h4 { font-size: var(--fs-md); font-weight: 600; font-family: var(--sans); letter-spacing: 0; }

p { margin: 0 0 var(--s-4) 0; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
a:hover { border-bottom-color: var(--accent); }

hr.rule {
  border: 0;
  border-top: 1px solid var(--divider-strong);
  margin: var(--s-6) 0;
  max-width: 72px;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s-6);
}
@media (max-width: 640px) {
  .container { padding: 0 var(--s-4); }
}

.reading {
  max-width: var(--max-w-rd);
}

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

/* =========================================================
   Site header / nav
   ========================================================= */
.site-header {
  padding: var(--s-6) 0;
  border-bottom: 1px solid var(--divider);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(8px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}
.brand {
  font-family: var(--serif);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
  border: none;
  letter-spacing: -0.005em;
}
.brand:hover { color: var(--accent); }

.nav {
  display: flex;
  gap: var(--s-6);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-wrap: wrap;
}
.nav a {
  color: var(--muted);
  border: none;
  padding: var(--s-1) 0;
}
.nav a:hover, .nav a.current { color: var(--ink); }
.nav a.current { border-bottom: 1px solid var(--ink); }

@media (max-width: 720px) {
  .site-header .container { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .nav { gap: var(--s-4); flex-wrap: wrap; }
}

/* =========================================================
   Eyebrow / meta
   ========================================================= */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: var(--s-4);
  display: inline-block;
}

.lead {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.1vw, var(--fs-lg));
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.5;
  max-width: 42rem;
}

.link-arrow {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.link-arrow::after { content: " \2192"; }
.link-arrow:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding: var(--s-10) 0 var(--s-9);
}
.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: var(--s-8);
  align-items: center;
}
.hero h1 {
  margin-bottom: var(--s-5);
}
.hero .portrait {
  width: 100%;
  max-width: 260px;
  margin-left: auto;
  height: auto;
  filter: grayscale(15%) contrast(1.02);
  border-radius: var(--radius);
  box-shadow: 0 2px 30px rgba(12, 14, 21, 0.08);
}
.hero-meta {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-top: var(--s-6);
  overflow-wrap: anywhere;
  line-height: 1.8;
}
.hero-meta a { color: var(--ink); border: none; }
.hero-meta a:hover { color: var(--accent); }

@media (max-width: 860px) {
  .hero { padding: var(--s-8) 0 var(--s-7); }
  .hero .container { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
  .hero .portrait { max-width: 240px; margin: 0; }
}

/* =========================================================
   Section
   ========================================================= */
.section {
  padding: var(--s-9) 0;
  border-top: 1px solid var(--divider);
}
.section--alt { background: var(--bg-alt); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; }

/* =========================================================
   Project / theme cards
   ========================================================= */
.themes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--divider-strong);
}

.theme {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: var(--s-6);
  padding: var(--s-7) 0;
  border-bottom: 1px solid var(--divider-strong);
  transition: background var(--dur) var(--ease);
  align-items: baseline;
}
.theme:hover { background: color-mix(in srgb, var(--bg-alt) 60%, transparent); }

.theme-num {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  letter-spacing: 0.1em;
  padding-top: 4px;
}
.theme-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 var(--s-3) 0;
}
.theme-desc {
  color: var(--muted);
  font-size: var(--fs-base);
  max-width: 48ch;
}
.theme-cta {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.theme:hover .theme-cta { color: var(--ink); }

@media (max-width: 720px) {
  .theme { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); padding: var(--s-6) 0; }
  .theme-cta { display: none; }
}

/* =========================================================
   Paper shelf - first-page thumbnails of featured papers
   ========================================================= */
.shelf {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s-5);
  margin: 0 0 var(--s-8) 0;
}
.shelf-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  border: none;
  color: inherit;
}
.shelf-card:hover { border: none; }
.shelf-thumb {
  display: block;
  aspect-ratio: 8.5 / 11;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(12,14,21,.04), 0 6px 20px rgba(12,14,21,.06);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.shelf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.shelf-card:hover .shelf-thumb {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(12,14,21,.06), 0 14px 32px rgba(12,14,21,.12);
}
.shelf-meta {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  line-height: 1.5;
}
.shelf-venue { color: var(--ink); display: block; }
.shelf-year { color: var(--muted-light); }

@media (max-width: 860px) {
  .shelf { grid-template-columns: repeat(5, minmax(160px, 1fr)); overflow-x: auto; padding-bottom: var(--s-3); scroll-snap-type: x mandatory; margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); padding-left: var(--s-4); padding-right: var(--s-4); }
  .shelf-card { scroll-snap-align: start; }
}

/* =========================================================
   Publication list
   ========================================================= */
.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--s-6);
}
.pub {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: var(--s-5);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--divider);
  align-items: baseline;
}
.pub:last-child { border-bottom: none; }

.pub-year {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  letter-spacing: 0.05em;
  padding-top: 4px;
}
.pub-body h3 {
  font-family: var(--serif);
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 var(--s-2) 0;
}
.pub-body h3 a {
  color: var(--ink);
  border-bottom: 1px solid transparent;
}
.pub-body h3 a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.pub-authors {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.pub-authors em { font-style: italic; color: var(--ink-soft); }

.pub-venue {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--fs-base);
  color: var(--ink-soft);
}
.pub-badge {
  display: inline-block;
  margin-left: var(--s-3);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px var(--s-2);
  border-radius: var(--radius);
  vertical-align: middle;
}

@media (max-width: 720px) {
  .pub { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
  .pub-year { padding-top: 0; }
}

/* =========================================================
   News list
   ========================================================= */
.news {
  list-style: none;
  padding: 0;
  margin: 0;
}
.news li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--divider);
  align-items: baseline;
}
.news-date {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  letter-spacing: 0.05em;
}

@media (max-width: 720px) {
  .news li { grid-template-columns: minmax(0, 1fr); gap: var(--s-1); }
}

/* =========================================================
   Research page - projects with papers
   ========================================================= */
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-8) 0;
  border-top: 1px solid var(--divider-strong);
}
.project:last-child { border-bottom: 1px solid var(--divider-strong); }

.project-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: baseline;
}
.project-num {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--accent);
  letter-spacing: 0.1em;
}
.project-title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.18;
  margin: 0;
}
.project-body {
  max-width: 46rem;
  margin-left: calc(72px + var(--s-5));
  color: var(--ink-soft);
  font-size: var(--fs-md);
  overflow-wrap: break-word;
}
.project-body p { margin-bottom: var(--s-4); }

.project-papers {
  margin-left: calc(72px + var(--s-5));
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px dashed var(--divider-strong);
}
.project-papers h4 {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 var(--s-5) 0;
  font-weight: 500;
}

@media (max-width: 720px) {
  .project-body, .project-papers { margin-left: 0; }
  .project-head { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
}

/* =========================================================
   Page header
   ========================================================= */
.page-header {
  padding: var(--s-9) 0 var(--s-7);
  border-bottom: 1px solid var(--divider);
}
.page-header h1 { margin-bottom: var(--s-4); }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  padding: var(--s-8) 0 var(--s-7);
  margin-top: var(--s-9);
  background: var(--bg-alt);
  border-top: 1px solid var(--divider);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: var(--s-6);
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.05em;
}
.site-footer a { color: var(--muted); border: none; }
.site-footer a:hover { color: var(--ink); }

.social {
  display: flex;
  gap: var(--s-5);
  list-style: none;
  padding: 0;
  margin: 0;
}

/* =========================================================
   Utilities
   ========================================================= */
.mt-0 { margin-top: 0; }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.muted { color: var(--muted); }
