/* ==========================================================================
   Jihye "Erica" Bae — personal academic site
   Aesthetic: warm letterpress paper. Cream ground, ink type, marigold accent.
   Newsreader (display) + Karla (text). No build step, no JS dependency.
   ========================================================================== */

/* --- tokens ------------------------------------------------------------- */
:root {
  --paper:        #fbf7f0;
  --paper-deep:   #f3ece0;
  --paper-card:   #fffdf9;
  --ink:          #231f1a;
  --ink-soft:     #4e463c;
  --ink-mute:     #7d7365;
  --rule:         #e0d5c2;
  --rule-soft:    #ece3d4;

  --marigold:     #d9901c;
  --marigold-lo:  #f6c96a;
  --pine:         #235f56;
  --pine-lo:      #e2efeb;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans:  "Karla", "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;

  --measure: 34rem;      /* comfortable reading width */
  --page:    72rem;      /* outer page width          */
  --gutter:  clamp(1.25rem, 5vw, 4.5rem);

  --step:    clamp(3rem, 6vw, 5rem);   /* vertical section rhythm */
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.72;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper grain — a single inline SVG turbulence, fixed so it never scrolls */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E");
}

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

a { color: inherit; }

::selection { background: var(--marigold-lo); color: var(--ink); }

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

/* --- layout primitives -------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: .65rem 1.1rem;
  z-index: 99;
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.skip:focus { left: .5rem; top: .5rem; }

/* --- typography --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  font-variation-settings: "opsz" 36;
  line-height: 1.16;
  letter-spacing: -.008em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1.15em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

/* small caps label used above every section */
.eyebrow {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1.4rem;
  display: flex;
  align-items: center;
  gap: .85rem;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* inline links: a marigold rule that thickens into a highlight on hover */
.prose a,
a.link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--marigold), var(--marigold));
  background-repeat: no-repeat;
  background-position: 0 88%;
  background-size: 100% 1.5px;
  transition: background-size .28s cubic-bezier(.4, 0, .2, 1), color .28s;
  padding-bottom: .05em;
}
.prose a:hover,
a.link:hover {
  background-size: 100% .82em;
}

/* --- masthead ----------------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
  padding-block: .6rem;
}

.sigmark {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--ink);
}
.sigmark img {
  height: 3.2rem;
  width: auto;
  transition: opacity .22s;
}
.sigmark__name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  letter-spacing: -.005em;
  transition: color .22s;
}
.sigmark:hover img { opacity: .62; }
.sigmark:hover .sigmark__name { color: var(--marigold); }

.nav { display: flex; gap: clamp(1.1rem, 3vw, 2.4rem); }
.nav a {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding-block: .35rem;
  position: relative;
  white-space: nowrap;
  transition: color .2s;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--marigold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after,
.nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }

/* phones: four nav items don't fit beside the logo — give them their own row */
@media (max-width: 600px) {
  .masthead__inner { flex-wrap: wrap; row-gap: .25rem; }
  .nav { width: 100%; justify-content: space-between; gap: .75rem; }
  .nav a { font-size: .74rem; letter-spacing: .1em; }
}

/* --- hero (home) -------------------------------------------------------- */
.hero { padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2rem, 5vw, 3.25rem); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, .85fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.hero__name {
  font-size: clamp(2.35rem, 5.4vw, 4rem);
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  line-height: 1.06;
  letter-spacing: -.02em;
  margin-bottom: 1.35rem;
}
.hero__name em {
  font-style: normal;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  color: var(--marigold);
}

.hero__role {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 30rem;
  margin-bottom: 2rem;
}
.hero__role--lead { margin-bottom: .6rem; }
.hero__role strong { font-weight: 700; color: var(--ink); }

/* portrait: soft arch frame with an offset marigold plate behind it */
.portrait { position: relative; justify-self: center; width: 100%; max-width: 16.5rem; }
.portrait::before {
  content: "";
  position: absolute;
  inset: .85rem -.85rem -.85rem .85rem;
  border: 1px solid var(--marigold);
  border-radius: 9rem 9rem .5rem .5rem;
  z-index: 0;
}
.portrait__img {
  position: relative;
  z-index: 1;
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 9rem 9rem .5rem .5rem;
  overflow: hidden;
  background: var(--paper-deep);
  box-shadow: 0 18px 44px -26px rgba(35, 31, 26, .5);
}
.portrait__img img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 820px) {
  .hero__grid { grid-template-columns: 1fr; }
  .portrait { max-width: 14rem; justify-self: start; margin-top: .5rem; }
}

/* --- generic section ---------------------------------------------------- */
main { flex: 1; }

.section { padding-block: var(--step); }
.section + .section { border-top: 1px solid var(--rule-soft); }

.section__title {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  margin-bottom: 1.75rem;
}

/* two-column: sticky label rail + content */
.railed {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 4.5rem);
  align-items: start;
}
.railed__rail { position: sticky; top: 6.5rem; }
/* headings inside the narrow rail need a smaller size to break cleanly */
.railed__rail .section__title { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
@media (max-width: 860px) {
  .railed { grid-template-columns: 1fr; }
  .railed__rail { position: static; }
}

/* --- interests list ----------------------------------------------------- */
.interests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  max-width: 34rem;
  counter-reset: interest;
}
.interests li {
  counter-increment: interest;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-variation-settings: "opsz" 28;
  padding-block: .85rem;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  transition: color .25s, padding-left .25s;
}
.interests li:first-child { border-top: 1px solid var(--rule-soft); }
.interests li::before {
  content: counter(interest, decimal-leading-zero);
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--marigold);
  flex-shrink: 0;
}
.interests li:hover { padding-left: .5rem; color: var(--pine); }

/* --- contact card ------------------------------------------------------- */
.contact {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: .35rem;
  padding: clamp(1.6rem, 3.5vw, 2.4rem);
  box-shadow: 0 1px 0 var(--rule-soft), 0 22px 40px -34px rgba(35, 31, 26, .55);
}
.contact__mail {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.6vw, 1.55rem);
  font-variation-settings: "opsz" 28;
  word-break: break-word;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.profiles { display: flex; flex-wrap: wrap; gap: .6rem; }
.profiles a {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: .5rem 1.05rem;
  background: var(--paper);
  transition: background .22s, color .22s, border-color .22s, transform .22s;
}
.profiles a:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  transform: translateY(-2px);
}

/* --- project entries (research) ----------------------------------------- */
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 16rem);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
  padding-block: clamp(2.25rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--rule-soft);
}
.project:first-of-type { border-top: 1px solid var(--rule-soft); }

/* alternate sides — swap the track widths too, so the prose always gets the
   wide column and only the artwork ever sits in the narrow one */
.project:nth-child(even) {
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
}
.project:nth-child(even) .project__art { order: -1; }

.project__num {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--marigold);
  display: block;
  margin-bottom: .85rem;
}
.project__title {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  margin-bottom: .9rem;
}
.project__meta {
  color: var(--ink-mute);
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px dashed var(--rule);
  max-width: var(--measure);
}
.project__art {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--paper-card);
  border: 1px solid var(--rule-soft);
  border-radius: .35rem;
}
.project__art img { max-height: 11rem; width: auto; object-fit: contain; mix-blend-mode: multiply; }

/* completed projects: text-only entries, same full-width layout as ongoing */
.study {
  padding-block: clamp(1.75rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--rule-soft);
  max-width: 48rem;
}
.study:first-of-type { border-top: 1px solid var(--rule-soft); }
.study .project__title { font-size: clamp(1.3rem, 2.6vw, 1.75rem); }

@media (max-width: 760px) {
  .project,
  .project:nth-child(even) { grid-template-columns: 1fr; }
  .project:nth-child(even) .project__art { order: 0; }
}

/* --- bibliography ------------------------------------------------------- */
.biblio { list-style: none; margin: 0; padding: 0; counter-reset: ref; }
.biblio li {
  position: relative;
  padding: 1.35rem 0 1.35rem 3.25rem;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 1rem;
  line-height: 1.68;
  max-width: 48rem;
}
.biblio li:first-child { border-top: 1px solid var(--rule-soft); }
.biblio li::before {
  counter-increment: ref;
  content: counter(ref, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.65rem;
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--marigold);
}
.biblio cite { font-style: italic; }
.biblio .self { font-weight: 700; }
.biblio .doi {
  display: inline-block;
  max-width: 100%;
  margin-top: .35rem;
  word-break: break-all;
}
.tag {
  display: inline-block;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pine);
  background: var(--pine-lo);
  border-radius: 100px;
  padding: .2rem .6rem;
  margin-left: .45rem;
  vertical-align: .12em;
}

/* --- CV ----------------------------------------------------------------- */
.cv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
  padding-block: clamp(3rem, 8vw, 5.5rem) 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 100px;
  padding: .8rem 1.5rem;
  transition: background .22s, color .22s, transform .22s;
}
.btn:hover { background: var(--marigold); border-color: var(--marigold); color: var(--ink); transform: translateY(-2px); }
.btn svg { width: 1rem; height: 1rem; }

.cv-embed { padding-bottom: var(--step); }
.cv-mobile { display: none; }
@media (max-width: 700px) {
  .cv-head .btn { display: none; }
  .cv-embed { display: none; }
  .cv-mobile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: var(--step);
  }
  .cv-mobile p { margin: 0; color: var(--ink-soft); }
}
.btn--ghost { background: transparent; color: var(--ink); }

.cv-embed iframe {
  display: block;
  width: 100%;
  height: 85vh;
  min-height: 36rem;
  border: 1px solid var(--rule-soft);
  border-radius: .35rem;
  background: #fff;
}

/* --- footer ------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--rule);
  margin-top: var(--step);
  padding-block: 3rem 3.5rem;
  background: var(--paper-deep);
  position: relative;
  z-index: 1;
}
.foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  color: var(--ink-mute);
}
.foot__verse {
  font-family: var(--serif);
  font-style: italic;
  font-variation-settings: "opsz" 24;
  font-size: 1.02rem;
  color: var(--ink-soft);
}
.foot a { text-decoration: none; border-bottom: 1px solid var(--rule); transition: border-color .2s; }
.foot a:hover { border-color: var(--marigold); }

/* --- entrance choreography --------------------------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.rise {
  animation: rise .75s cubic-bezier(.22, 1, .36, 1) backwards;
}
.rise:nth-child(1) { animation-delay: .04s; }
.rise:nth-child(2) { animation-delay: .12s; }
.rise:nth-child(3) { animation-delay: .2s; }
.rise:nth-child(4) { animation-delay: .28s; }

/* --- print -------------------------------------------------------------- */
@media print {
  body::before, .masthead, .foot, .btn { display: none !important; }
  body { background: #fff; font-size: 10.5pt; }
}
