/* =============================================================
   Seunghyun Shin: academic homepage
   Template visuals (BootstrapMade "Personal") rebuilt by hand.
   No Bootstrap, no AOS, no JavaScript.
   ============================================================= */

/* ---------- Icon font: local Bootstrap Icons, subset by hand ---------- */

@font-face {
  font-display: block;
  font-family: "bootstrap-icons";
  src: url("../vendor/bootstrap-icons/fonts/bootstrap-icons.woff2") format("woff2"),
       url("../vendor/bootstrap-icons/fonts/bootstrap-icons.woff") format("woff");
}

[class^="bi-"]::before,
[class*=" bi-"]::before {
  display: inline-block;
  font-family: "bootstrap-icons" !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  vertical-align: -0.125em;
  -webkit-font-smoothing: antialiased;
}

.bi-file-earmark-pdf-fill::before { content: "\f63d"; }
.bi-github::before { content: "\f3ed"; }
.bi-link-45deg::before { content: "\f470"; }
.bi-geo-alt::before { content: "\f3e8"; }
.bi-envelope::before { content: "\f32f"; }
.bi-share::before { content: "\f52e"; }
.bi-linkedin::before { content: "\f472"; }
.bi-instagram::before { content: "\f437"; }
.bi-twitter-x::before { content: "\f8db"; }
.bi-arrow-up-short::before { content: "\f145"; }
.bi-mortarboard-fill::before { content: "\f6fd"; }
.bi-arrow-counterclockwise::before { content: "\f117"; }

/* ---------- Tokens ---------- */

:root {
  --bg: #ffffff;
  --fg: #1c1c1c;
  --muted: #6b6b6b;
  --rule: #e4e4e4;
  --surface: #fafafa;
  --accent: #b45309;
  --link: #1f5fa8;
  --header-bg: rgba(255, 255, 255, 0.88);
  --shadow: rgba(0, 0, 0, 0.1);
  --footer-bg: #14161a;
  --footer-fg: #ededed;
  --measure: 60rem;   /* layout width */
  --prose: 52rem;     /* cap for the bio paragraph only */
  --heading-font: "Raleway", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --fg: #e6e6e6;
    --muted: #9a9a9a;
    --rule: #2c2f36;
    --surface: #1a1d23;
    --accent: #e9a070;
    --link: #7fb0e8;
    --header-bg: rgba(20, 22, 26, 0.88);
    --shadow: rgba(0, 0, 0, 0.5);
    --footer-bg: #0f1114;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

a:hover { border-bottom-color: currentColor; }

img { max-width: 100%; height: auto; }

section { margin-top: 3.5rem; }

section[id] { scroll-margin-top: 1.5rem; }

/* ---------- Intro ---------- */

.intro {
  display: flex;
  gap: 2rem;
  align-items: center;
  padding: 4rem 0 0;
}

.intro-text { flex: 1 1 auto; min-width: 0; }

h1 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.quicklinks {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.quicklinks a { white-space: nowrap; }

.quicklinks .sep { padding: 0 0.45rem; color: var(--rule); }

.cv-date {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* round icon buttons, used in Contact */

.icon-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
}

.icon-links a {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.05rem;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.icon-links a:hover {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.contact .icon-links { align-self: center; }

.portrait {
  flex: 0 0 auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--rule);
}

.bio { margin: 2rem 0 0; }

.bio p {
  margin: 0 0 0.9rem;
  max-width: var(--prose);
}

.bio p:last-child { margin-bottom: 0; }

/* ---------- Section titles ---------- */

.section-title { margin: 0 0 2rem; }

.section-title h2 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--fg);
}

.section-title h2::after {
  content: "";
  display: inline-block;
  width: 110px;
  height: 2px;
  margin: 0 0 0.32em 0.9rem;
  background: var(--accent);
  vertical-align: middle;
}

/* ---------- News ---------- */

.news > li { margin-bottom: 1rem; }

.news .when { flex-basis: 6rem; }

.news .what {
  font-size: 0.95rem;
  line-height: 1.6;
}

.news .what strong { font-weight: 600; }

/* ---------- Show more / show less (CSS only, no JS) ---------- */

.more-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* only the first 7 show; everything past that is behind the button.
   position-based, so adding a new item at the top just works. */
.news > li:nth-child(n + 8) { display: none; }

.more-toggle:checked ~ .news > li { display: flex; }

.more-btn {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--heading-font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.more-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.more-toggle:focus-visible ~ .more-btn {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.more-close { display: none; }

.more-toggle:checked ~ .more-btn .more-open { display: none; }

.more-toggle:checked ~ .more-btn .more-close { display: inline; }

/* ---------- Research interest cards ---------- */

.interests-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.interests-grid > li {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding-bottom: 1.1rem;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.interests-grid > li:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 26px var(--shadow);
}

.interests-grid img,
.interests-grid video {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--rule);
}

.interests-grid h3 {
  margin: 0.9rem 1rem 0.3rem;
  font-family: var(--heading-font);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: color 0.25s ease;
}

.interests-grid > li:hover h3 { color: var(--accent); }

.interests-grid p {
  margin: 0 1rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- Publications ---------- */

.pubs { list-style: none; margin: 0; padding: 0; }

.pubs > li {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.pubs > li:last-child { margin-bottom: 0; }

.pub-thumb {
  flex: 0 0 auto;
  width: 220px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--rule);
}

/* every still thumbnail sits in the same 16:9 box, letterboxed rather than
   cropped so nothing is cut out of a paper figure */
img.pub-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: contain;
  background: var(--surface);
}

.pub-body { flex: 1 1 auto; min-width: 0; }

.pub-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.pub-authors {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.me { color: var(--accent); font-weight: 600; }

.pub-venue {
  margin: 0.1rem 0 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
}

.pub-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.62rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.pub-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pub-links a i { font-size: 0.9em; }

/* ---------- Timeline (news / education / experience) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline > li {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  margin-bottom: 1.5rem;
}

.timeline > li:last-child { margin-bottom: 0; }

.when {
  flex: 0 0 9.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.what { flex: 1 1 auto; min-width: 0; }

.what .role {
  font-family: var(--heading-font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: block;
}

.what .where,
.what .note {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

/* dotted rail, only on the CV sections */

#education .timeline > li,
#experience .timeline > li { align-items: flex-start; }

#education .what,
#experience .what {
  position: relative;
  padding-left: 1.4rem;
  border-left: 2px solid var(--rule);
}

#education .what::before,
#experience .what::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.42em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

/* ---------- Contact ---------- */

.contact { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }

.contact > li {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.contact .label {
  flex: 0 0 7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.contact .label i {
  color: var(--accent);
  margin-right: 0.4rem;
}

.map {
  display: block;
  width: 100%;
  height: 340px;
  margin-top: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

/* ---------- Footer ---------- */

footer {
  margin-top: 4.5rem;
  padding: 2.75rem 1.5rem 2rem;
  background: var(--footer-bg);
  color: var(--footer-fg);
  text-align: center;
}

.footer-inner { max-width: var(--measure); margin: 0 auto; }

.footer-name {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-affil {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  opacity: 0.72;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.2rem 0 0;
}

.footer-social a {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: var(--footer-fg);
  font-size: 1rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.footer-social a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.footer-copy {
  margin: 1.4rem 0 0;
  font-size: 0.78rem;
  opacity: 0.6;
}

/* ---------- Back to top ---------- */

.scroll-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 40;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 1.6rem;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.scroll-top:hover { opacity: 1; border: 0; }

/* ---------- Tablet ---------- */

@media (max-width: 48rem) {
  .interests-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

/* ---------- Phone ---------- */

@media (max-width: 34rem) {
  main { padding-left: 1.15rem; padding-right: 1.15rem; }

  .intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding-top: 2.25rem;
  }

  .portrait { width: 120px; height: 120px; }

  h1 { font-size: 1.75rem; }

  .section-title h2 { font-size: 1.4rem; }

  .section-title h2::after { width: 60px; }

  .interests-grid { grid-template-columns: 1fr; }

  .interests-grid img { aspect-ratio: 16 / 9; }

  .pubs > li { flex-direction: column; gap: 0.75rem; }

  .pub-thumb { width: 100%; max-width: 280px; }

  .timeline > li,
  .contact > li { flex-direction: column; gap: 0.15rem; }

  .when,
  .contact .label { flex-basis: auto; }

  #education .timeline > li,
  #experience .timeline > li { gap: 0.3rem; }

  .map { height: 220px; }
}

/* ---------- Interactive publication thumbnails ---------- */

.widget {
  position: relative;
  border: 0;
  background: transparent;
  perspective: 900px;
}

.face {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface);
}

/* flip card: comparison on the front, continuous control on the back */

.flip {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flip.flipped { transform: rotateY(180deg); }

.flip .face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip .front { position: relative; }

.flip .back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

.flip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 5;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}


.flip-btn:hover { background: var(--accent); border-color: #ffffff; }

/* video stage, shared by both widget kinds */

.compare,
.stack {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
}

.compare video,
.stack video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* drag to reveal */

.compare {
  cursor: ew-resize;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.compare .cmp-ours { clip-path: inset(0 0 0 50%); }

.compare .cmp-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #ffffff;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.compare .cmp-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.compare:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -2px;
}

/* stacked variants, one visible at a time */

.stack video {
  opacity: 0;
  transition: opacity 0.18s ease;
}

.stack video.is-on { opacity: 1; }

/* footer strip under every widget */

.foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-top: 1px solid var(--rule);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.foot .arrow {
  position: relative;
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}

.foot .arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -2px;
  border-left: 4px solid var(--rule);
  border-top: 2.5px solid transparent;
  border-bottom: 2.5px solid transparent;
}

.stack-range {
  flex: 1 1 auto;
  min-width: 0;
  height: 12px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* segmented control (TriMotion reference modality) */

.foot.seg {
  gap: 3px;
  padding: 4px;
}

.seg-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 2px 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.seg-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.seg-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* modality swap: several comparisons stacked, one visible at a time */

.swap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
}

.swap > .compare {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.swap > .compare.is-on {
  opacity: 1;
  pointer-events: auto;
}

/* corner labels naming each side of a comparison */

.cmp-tag {
  position: absolute;
  bottom: 4px;
  z-index: 2;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  pointer-events: none;
}

.cmp-l { left: 4px; }

.cmp-r { right: 4px; }

/* a written prompt standing in where the reference is not a video */

.cmp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: #15171b;
  color: #e4e4e4;
  font-size: 10px;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
}

/* a small reference still pinned over the left-hand clip */

.compare .cmp-inset {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 3;
  width: 34%;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.compare .cmp-inset img {
  display: block;
  width: 100%;
  height: auto;
}

.compare .cmp-inset figcaption {
  padding: 1px 0;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-align: center;
}

/* caption strip naming the effect applied on the right-hand clip */

.compare .cmp-note {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  font-size: 8px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.45;
  pointer-events: none;
}
