/* ===================================================================
   Ruei-Che Chang — academic website
   Design language: Meta / Facebook Blueprint
   Font: Roboto (body) + Roboto Slab (headings) — al-folio academic pairing
   Colors: Meta Blueprint palette
     --blue:       #0064E0  (Meta primary blue)
     --ink:        #1C2B33  (Meta dark navy)
     --body:       #465A69  (Meta medium gray)
     --muted:      #6D8695  (secondary text)
     --blue-bg:    #E7F3FF  (Meta light blue tint)
     --blue-mid:   rgba(0,100,224,0.10)
     --award:      #E76F51  (warm orange for awards)
     --line:       #CBD2D9  (Meta separator gray)
   =================================================================== */

:root {
  --blue:       #0064E0;
  --blue-hover: #0050b8;
  --blue-bg:    #E7F3FF;
  --blue-mid:   rgba(0, 100, 224, 0.10);
  --ink:        #1C2B33;
  --body:       #465A69;
  --muted:      #6D8695;
  --award:      #E76F51;
  --line:       #CBD2D9;
  --bg:         #FFFFFF;

  /* Type: Roboto for body/UI, Roboto Slab for headings — al-folio academic pairing (matches rueiche.com) */
  --font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Helvetica, Arial, sans-serif;
  --font-head: "Roboto Slab", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px 64px;
}

.content-col { max-width: 100%; }

/* Two-column page layout */
.page-layout {
  display: flex;
  align-items: flex-start;
  gap: 48px;
  margin-top: 0;
}

.main-col {
  flex: 0 0 500px;
  min-width: 0;
}

.side-col {
  flex: 1;
  min-width: 0;
}

/* Right column section spacing (no left border constraint) */
.section-right {
  margin-top: 48px;
}
.section-right:first-child {
  margin-top: 0;
}

/* ====================== Research Highlight Cards ====================== */

.highlight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 0;
}

.hl-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  aspect-ratio: 4 / 3;
  background: var(--ink);
  cursor: pointer;
}

.hl-card img,
.hl-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0.78;
}

.hl-card:hover img,
.hl-card:hover video {
  transform: scale(1.05);
  opacity: 1;
}

/* Dark gradient overlay always visible at bottom */
.hl-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 18, 26, 0.92) 0%,
    rgba(10, 18, 26, 0.55) 45%,
    rgba(10, 18, 26, 0) 75%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px 11px;
  transition: background 0.25s ease;
}

.hl-card:hover .hl-overlay {
  background: linear-gradient(
    to top,
    rgba(10, 18, 26, 0.97) 0%,
    rgba(10, 18, 26, 0.65) 55%,
    rgba(10, 18, 26, 0.1) 80%
  );
}

.hl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.hl-venue {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  background: var(--blue);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.4;
}

.hl-award {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #000000;
  background: #aaff00;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.4;
}

/* Corner award seal on highlight cards — pinned to the top corner like the
   TIME seal on Chen-Hsuan Lin's Neuralangelo card */
.hl-seal {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #ffffff;
  /* background: linear-gradient(135deg, #95ff00 0%, #fca3ff 100%); */
  background: linear-gradient(135deg, #E8A13A 0%, #B54708 100%);
  padding: 4px 9px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.hl-seal i { font-size: 11px; }

.hl-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 2px;
  line-height: 1.25;
}

.hl-sub {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* ============================ Links ============================ */

a {
  color: var(--blue);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover, a:focus, a:active {
  color: var(--blue-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ====================== Header: photo + name ====================== */

.header-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-top: 96px;
  margin-bottom: 12px;
}

.dp {
  width: 64px;
  flex-shrink: 0;
  border-radius: 8px;
}

h1.title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 40px;
  line-height: 0.98;
  letter-spacing: -1px;
  color: var(--ink);
  margin: 0;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subtitle {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.1px;
}

h1.title .cjk {
  font-size: 1em;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Sub-page header (papers.html) */
.header-row-sub { padding-top: 56px; }
h1.title-sub { font-size: 40px; letter-spacing: -1px; }
.home-link { color: var(--ink); font-weight: 800; }
.home-link:hover { color: var(--blue); text-decoration: none; }

/* ============================== Bio ============================== */

p.intro {
  color: var(--body);
  font-size: 15px;
  line-height: 1.65;
  margin: 12px 0;
}

b, strong { font-weight: 700; color: var(--ink); }

/* Award/fellowship names without a link — ink so they read like the linked ones */
.award-name, .degree-name { color: var(--ink); font-weight: 500; }

/* Inline official Meta logo (from the SVG sprite) */
.brand-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.brand-meta {
  height: 1em;
  width: 1em;
  vertical-align: -0.16em;
  margin-right: 0.28em;
}
.brand-adobe {
  height: 0.86em;
  width: auto;
  vertical-align: -0.08em;
  margin-right: 0.3em;
}

/* Inline university logos in the bio (official marks, kept small) */
.uni-logo {
  display: inline-block;
  height: 1.1em;
  width: auto;
  vertical-align: -0.24em;
  margin-right: 0.34em;
}

.cv-line { margin-top: 24px; }

a.cv {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  background: var(--blue-bg);
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
a.cv:hover, a.cv:focus {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
}

/* ===================== Social circle icons ===================== */

.social-row { margin: 18px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }

a.social-icons { color: var(--blue); text-decoration: none; }

.circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
  transition: all 0.15s ease;
}
.circle .tiny { font-size: 15px; line-height: 1; }

a.social-icons:hover .circle,
a.social-icons:focus .circle {
  background: var(--blue);
  color: #fff;
}

/* ====================== Section headers ====================== */

.section { margin-top: 60px; }

h2.page-title {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2.5px solid var(--blue);
}

/* ============================== News ============================== */

p.news { margin: 0; line-height: 1; }
p.news br + br { display: none; }

.news-list { margin-top: 10px; line-height: 1.4; }

.news-date {
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}
.news-text { color: var(--body); font-size: 13.5px; }

/* wrapper each line in a flex row */
.news-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: none;
}
.news-date-col { min-width: 58px; flex-shrink: 0; }

/* ==================== Full-width sections below two-col ==================== */

.full-section {
  margin-top: 56px;
}

/* News + Awards two-column layout */
.news-awards-layout {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.news-scroll-col {
  flex: 1;
  min-width: 0;
}

.news-scroll {
  overflow-y: auto;
  max-height: 215px; /* ~matches 7-item awards section content height */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.news-scroll::-webkit-scrollbar { width: 4px; }
.news-scroll::-webkit-scrollbar-track { background: transparent; }
.news-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.awards-col {
  flex: 0 0 350px;
  min-width: 0;
}

.awards-list { margin-top: 10px; }

.award-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.award-item:last-child { border-bottom: none; }

.award-year {
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  flex-shrink: 0;
}

.award-text {
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.45;
}
.award-text a { color: var(--blue); }
.award-text a:hover { text-decoration: underline; }

/* Papers with left thumbnails (index.html only) */
.papers-thumbs .paper {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border-top: none;
}
.papers-thumbs .paper:first-of-type { border-top: 1px solid var(--line); }

.paper-thumb {
  width: 170px;
  min-width: 170px;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--blue-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.paper-thumb img,
.paper-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.paper-thumb-placeholder {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  padding: 4px;
  letter-spacing: 0.3px;
}

.paper-body { flex: 1; min-width: 0; }

/* =========================== Papers =========================== */

.see-all { margin: 0 0 20px; font-size: 13px; }

h3.year-heading {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 26px 0 6px;
}

/* ---- Selected / All publication toggle ---- */
.papers-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2.5px solid var(--blue);
}
.papers-head .page-title {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

.pub-toggle {
  display: inline-flex;
  border: 1px solid var(--blue);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.pub-toggle-btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 12px;
  color: var(--blue);
  background: #fff;
  border: none;
  padding: 4px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pub-toggle-btn + .pub-toggle-btn { border-left: 1px solid var(--blue); }
.pub-toggle-btn:hover { background: var(--blue-bg); }
.pub-toggle-btn.is-active { background: var(--blue); color: #fff; }

/* Selected view: show only papers tagged .selected and drop now-empty year groups */
.pubs-selected .paper:not(.selected) { display: none; }
.year-heading.is-empty { display: none; }

/* Chen-Hsuan Lin "Earlier Works" style:
   no border/bg — clean text rows with a bottom rule */
.paper {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.45;
}
.paper:first-of-type { border-top: 1px solid var(--line); }

.paper-title a {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  display: block;
  margin-bottom: 2px;
  text-decoration: none;
}
.paper-title a:hover, .paper-title a:focus {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.authors {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 400;
  display: block;
  margin-bottom: 3px;
}
.authors .self { font-weight: 700; color: var(--blue); }

/* Venue line: bold venue name on its own line, link buttons on the line below */
.venue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 6px;
  row-gap: 3px;
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.4;
}

/* Venue name — bold inline text, no pill */
.paper-award {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  letter-spacing: 0;
}

/* Award entry — colored inline text */
.paper-award.is-award {
  color: #de7e00;
  font-weight: 700;
  background: none;
  border: none;
  padding: 0;
}

/* Separators no longer needed — buttons are spaced by the flex gap */
.venue-sep { display: none; }

/* Link tags as compact buttons — same language as the CV button */
.venue a {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--blue-bg);
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 2px 10px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.5;
  transition: background 0.15s ease, color 0.15s ease;
}
.venue a:hover, .venue a:focus {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
}

/* Full-width, zero-height break: pushes the link buttons onto the next line.
   (Reuses the old em-dash element; its glyph is hidden via font-size:0.) */
.venue-dash {
  flex: 0 0 100%;
  height: 0;
  margin: 0;
  font-size: 0;
  line-height: 0;
}

.note {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
  border-top: none;
  padding-top: 0;
}
.note a { font-size: 12.5px; }

/* =========================== Contact =========================== */

.contact-email { color: var(--ink); font-weight: 600; }

/* ============================ Footer ============================ */

.footer { margin-top: 80px; border-top: 1px solid var(--line); padding-top: 20px; }
.footer p { font-size: 12.5px; color: var(--muted); margin: 0; }

/* =========================== Responsive =========================== */

@media (max-width: 900px) {
  .page-layout {
    flex-direction: column;
    gap: 0;
  }
  .main-col { flex: none; width: 100%; }
  .side-col { width: 100%; margin-top: 40px; }
  .highlight-grid { grid-template-columns: repeat(3, 1fr); }
  .news-awards-layout { flex-direction: column; align-items: stretch; }
  .awards-col { flex: none; width: 100%; }
  .paper-thumb { width: 130px; min-width: 130px; height: 70px; }
}

@media (max-width: 767px) {
  .header-row {
    flex-direction: column;
    gap: 24px;
    padding-top: 48px;
  }
  .dp { width: 120px; }
  h1.title { font-size: 48px; letter-spacing: -0.5px; }
  h1.title-sub { font-size: 32px; }
  .container { padding: 0 20px 48px; }
}
