/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: #1a1a1a;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Layout ===== */
.container {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* ===== Links ===== */
a {
  color: #1a1a1a;
  text-decoration-color: #bbb;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

a:hover {
  text-decoration-color: #1a1a1a;
}

.meta {
  color: #888;
  font-size: 0.82rem;
}

.meta a {
  color: #666;
}

.sep {
  margin: 0 0.3em;
  color: #ccc;
}

hr {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 2.5rem 0;
}

/* ================================================
   Hero
   ================================================ */
.hero {
  background: #0a0a0a;
  color: #f5f5f5;
  padding: 5rem 1.5rem 4rem;
  margin-bottom: 2.5rem;
}

.hero-inner {
  max-width: 740px;
  margin: 0 auto;
}

.profile-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  border: 3px solid rgba(255,255,255,0.15);
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.rotating-text {
  color: #f5f5f5;
  border-bottom: 3px solid rgba(255,255,255,0.3);
  padding-bottom: 2px;
}

.cursor {
  display: inline-block;
  color: rgba(255,255,255,0.4);
  font-weight: 300;
  animation: blink 1s step-end infinite;
  margin-left: 1px;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.55);
  font-style: italic;
  margin-bottom: 1.25rem;
}

.hero-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
}

.hero-links a,
.hero-links .cvdiff-btn {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}

.hero-links a:hover,
.hero-links .cvdiff-btn:hover {
  color: #fff;
  border-color: #fff;
}

/* ================================================
   Navigation
   ================================================ */
.site-nav {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

.site-nav a {
  color: #999;
  text-decoration: none;
  margin: 0 0.75em;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: #1a1a1a;
  border-bottom-color: #1a1a1a;
}

/* ================================================
   Focus Toggle
   ================================================ */
.focus-toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.focus-btn {
  background: none;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.4em 1.2em;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}

.focus-btn:hover {
  border-color: #888;
  color: #333;
}

.focus-btn.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

/* ================================================
   Sections
   ================================================ */
.section {
  margin-bottom: 3rem;
  transition: opacity 0.3s;
}

.hidden {
  display: none !important;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1a1a;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #1a1a1a;
}

.section-lead {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  text-align: justify;
}

.link-list {
  list-style: disc;
  padding-left: 1.25rem;
  font-size: 0.92rem;
  line-height: 2;
}

.link-list a {
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  transition: border-color 0.2s;
}

.link-list a:hover {
  border-bottom-color: #1a1a1a;
}

/* ================================================
   Condensed
   ================================================ */
.condensed-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.condensed-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #444;
  text-align: justify;
}

.condensed-list li:last-child {
  border-bottom: none;
}

.condensed-list li strong {
  color: #1a1a1a;
}

/* ================================================
   About
   ================================================ */
.about-lead {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.hl {
  transition: opacity 0.4s, color 0.4s;
  border-bottom: 2px solid transparent;
}

.hl.emphasized {
  border-bottom-color: #1a1a1a;
}

.hl.dimmed {
  opacity: 0.25;
}

.about-body {
  font-size: 0.92rem;
  color: #555;
  margin-bottom: 0.5rem;
  text-align: justify;
}

.about-mode {
  display: none;
}

.about-mode.visible {
  display: block;
}

.revolves {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 1rem;
}

.revolves span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #aaa;
  padding: 0.3em 0.6em;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  margin: 0 0.25rem 0.25rem 0;
}

/* ================================================
   Collapsible Details
   ================================================ */
details {
  margin-bottom: 0.25rem;
}

details summary {
  cursor: pointer;
  list-style: none;
  padding: 0.6rem 0;
  padding-right: 1.5em;
  position: relative;
  border-bottom: 1px solid #f0f0f0;
  transition: border-color 0.2s;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: '\203A';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 300;
  color: #ccc;
  transition: transform 0.2s, color 0.2s;
}

details summary:hover::after {
  color: #888;
}

details[open] summary::after {
  transform: translateY(-50%) rotate(90deg);
  color: #1a1a1a;
}

details summary:hover {
  border-bottom-color: #ccc;
}

details[open] summary {
  border-bottom-color: #1a1a1a;
}

.details-content {
  padding: 0.75rem 0 1.25rem 0;
  font-size: 0.9rem;
  color: #444;
  line-height: 1.65;
}

.details-content p {
  margin-bottom: 0.5rem;
  text-align: justify;
}

.details-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 0.5rem;
}

.details-content li {
  padding: 0.2rem 0 0.2rem 1.25em;
  position: relative;
  font-size: 0.88rem;
}

.details-content li::before {
  content: '';
  position: absolute;
  left: 0.25em;
  top: 0.75em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ccc;
}

/* ================================================
   Job Entry
   ================================================ */
.job-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: 100%;
}

.job-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1a1a1a;
}

.job-org {
  font-size: 0.85rem;
  color: #888;
}

.job-org::before {
  content: '\2014\00a0';
  color: #ccc;
}

.job-date {
  font-size: 0.78rem;
  color: #aaa;
  margin-left: auto;
  white-space: nowrap;
}

.job-sub {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #666;
  margin: 0.75rem 0 0.3rem;
  text-transform: uppercase;
}

/* ================================================
   Projects
   ================================================ */
.project-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.standalone-entry {
  padding: 0.5rem 0;
}

.standalone-entry p {
  font-size: 0.88rem;
  color: #555;
  margin-top: 0.25rem;
  text-align: justify;
}

/* ================================================
   Talks
   ================================================ */
.talk-entry {
  display: flex;
  gap: 1.25rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.talk-year {
  font-size: 0.78rem;
  font-weight: 700;
  color: #aaa;
  min-width: 3em;
  padding-top: 0.15em;
  font-variant-numeric: tabular-nums;
}

.talk-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.talk-desc {
  font-size: 0.85rem;
  color: #666;
}

/* ================================================
   Skills
   ================================================ */
.skills-group {
  margin-bottom: 0.6rem;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.skills-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
  min-width: 7em;
  flex-shrink: 0;
}

.skills-list {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.6;
}

/* ================================================
   Education
   ================================================ */
.edu-entry {
  margin-bottom: 1rem;
}

.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.edu-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.edu-date {
  font-size: 0.78rem;
  color: #aaa;
}

.edu-org {
  font-size: 0.85rem;
  color: #666;
}

.edu-note {
  font-size: 0.82rem;
  color: #888;
  margin-top: 0.15rem;
}

.certs-list {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.82rem;
  color: #888;
  line-height: 1.8;
  text-align: justify;
}

.cert-item {
  display: inline;
}

.cert-item.hidden {
  display: none;
}

.cert-item::before {
  content: attr(data-sep);
}

/* ================================================
   Contact
   ================================================ */
.contact {
  padding-top: 2rem;
  border-top: 2px solid #1a1a1a;
  text-align: center;
}

.contact-inner {
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

/* ================================================
   CVDiff Page Styles
   ================================================ */
.cvdiff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cvdiff-title {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-links .cvdiff-btn {
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  border-radius: 0;
  padding: 0 0 1px 0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: inherit;
  cursor: pointer;
}

.hero-links .cvdiff-btn.active {
  background: none;
  color: #fff;
  border-bottom-color: #fff;
}

.cvdiff-toggles {
  display: flex;
  gap: 0.25rem;
}

.cvdiff-btn {
  background: none;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  padding: 0.3em 0.8em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.cvdiff-btn:hover {
  border-color: #888;
  color: #333;
}

.cvdiff-btn.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.scope-toggles {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

/* ===== CV Content ===== */
.cv-content {
  padding-bottom: 120px;
  min-height: 60vh;
  transition: opacity 0.25s;
}

.cv-content.fading {
  opacity: 0;
}

.cv-standalone {
  font-size: 0.92rem;
  line-height: 1.7;
}

.cv-standalone h2 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1a1a;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #1a1a1a;
}

.cv-standalone h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-top: 0.75rem;
}

.cv-standalone .cv-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.cv-standalone .cv-contact {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 1.5rem;
}

.cv-standalone p {
  text-align: justify;
}

.cv-standalone ul {
  list-style: none;
  padding-left: 0;
}

.cv-standalone li {
  padding: 0.15rem 0 0.15rem 1.25em;
  position: relative;
  font-size: 0.88rem;
  color: #444;
  text-align: justify;
}

.cv-standalone li::before {
  content: '';
  position: absolute;
  left: 0.25em;
  top: 0.75em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ccc;
}

/* ===== Diff ===== */
.diff-container {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.diff-file-header {
  background: #f6f8fa;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  color: #555;
}

.diff-hunk-header {
  background: #ddf4ff;
  color: #0969da;
  padding: 0.3rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.diff-line {
  display: flex;
  padding: 0 1rem;
  min-height: 1.6em;
}

.diff-line-num {
  width: 3.5em;
  text-align: right;
  color: #bbb;
  user-select: none;
  flex-shrink: 0;
  padding-right: 0.75em;
}

.diff-line-content {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 0.5em;
}

.diff-add {
  background: #e6ffec;
}

.diff-add .diff-line-content {
  color: #1a7f37;
}

.diff-add .diff-line-content::before {
  content: '+ ';
  color: #1a7f37;
  font-weight: 700;
}

.diff-remove {
  background: #ffebe9;
}

.diff-remove .diff-line-content {
  color: #cf222e;
}

.diff-remove .diff-line-content::before {
  content: '- ';
  color: #cf222e;
  font-weight: 700;
}

.diff-same .diff-line-content::before {
  content: '  ';
}

.diff-empty {
  color: #999;
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

/* ===== Side-by-Side Diff ===== */
.diff-side-by-side {
  display: block;
}

.diff-side-header {
  display: flex;
}

.diff-side-label {
  flex: 1;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.72rem;
  color: #555;
}

.diff-side-label:first-child {
  border-right: 1px solid #e0e0e0;
}

.diff-side-hunk-header {
  display: flex;
  background: #ddf4ff;
  border-bottom: 1px solid #e0e0e0;
}

.diff-side-hunk-label {
  flex: 1;
  padding: 0.3rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #0969da;
}

.diff-side-hunk-label:first-child {
  border-right: 1px solid #c8e1ff;
}

.diff-line-pair {
  display: flex;
  border-bottom: 1px solid #f0f0f0;
}

.diff-side {
  flex: 1;
  display: flex;
  padding: 0 0.75rem;
  min-height: 1.6em;
}

.diff-side:first-child {
  border-right: 1px solid #e8e8e8;
}

.diff-side .diff-line-num {
  width: 2.5em;
  text-align: right;
  color: #bbb;
  user-select: none;
  flex-shrink: 0;
  padding-right: 0.5em;
}

.diff-side .diff-line-content {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 0.3em;
}

.diff-side.diff-side-remove {
  background: #ffebe9;
}

.diff-side.diff-side-remove .diff-line-content {
  color: #cf222e;
}

.diff-side.diff-side-add {
  background: #e6ffec;
}

.diff-side.diff-side-add .diff-line-content {
  color: #1a7f37;
}

.diff-side.diff-side-empty {
  background: #f8f8f8;
}

.diff-side.diff-side-empty .diff-line-content {
  color: transparent;
}

/* ===== Timeline Bar ===== */
.timeline-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0a0a0a;
  border-top: none;
  padding: 1.25rem 1.5rem 1.5rem;
  z-index: 100;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.timeline-bar:active {
  cursor: grabbing;
}

.timeline-track {
  max-width: 740px;
  margin: 0 auto;
  position: relative;
}

.timeline-line {
  display: none;
}

/* ===== Seek Bar ===== */
.seekbar {
  position: relative;
  padding: 0.75rem 0;
}

.seekbar-track {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  cursor: pointer;
}

.seekbar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255,255,255,0.5);
  border-radius: 2px;
  transition: width 0.15s ease;
  pointer-events: none;
}

.seekbar-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 12px;
  background: rgba(255,255,255,0.25);
  border-radius: 1px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
}

.seekbar-tick:hover {
  background: rgba(255,255,255,0.6);
  height: 16px;
}

.seekbar-tick.active {
  background: #fff;
  height: 18px;
}

.seekbar-tick-label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
  font-weight: 500;
  transition: color 0.2s;
  pointer-events: none;
}

.seekbar-tick:hover .seekbar-tick-label {
  color: rgba(255,255,255,0.7);
}

.seekbar-tick.active .seekbar-tick-label {
  color: #fff;
  font-weight: 700;
}

.seekbar-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.2), 0 1px 4px rgba(0,0,0,0.3);
  cursor: grab;
  transition: left 0.15s ease, transform 0.1s;
  z-index: 3;
}

.seekbar-thumb:hover {
  transform: translate(-50%, -50%) scale(1.15);
}

.timeline-bar:active .seekbar-thumb {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.2);
}

/* ===== CV Header Grid ===== */
.cv-header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #1a1a1a;
}

.cv-grid-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  grid-column: 1;
}

.cv-grid-tr {
  font-size: 0.82rem;
  color: #888;
  text-align: right;
  align-self: end;
}

.cv-grid-bl {
  font-size: 0.82rem;
  color: #888;
  grid-column: 1;
}

.cv-grid-br {
  font-size: 0.82rem;
  color: #888;
  text-align: right;
}

.cv-header-grid a {
  color: #888;
  text-decoration: none;
  border-bottom: 1px solid #ddd;
  transition: color 0.2s, border-color 0.2s;
}

.cv-header-grid a:hover {
  color: #1a1a1a;
  border-color: #1a1a1a;
}

/* ===== Checkpoint Info ===== */
.checkpoint-info {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.checkpoint-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.checkpoint-date {
  font-size: 0.8rem;
  color: #888;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .hero {
    padding: 3.5rem 1.25rem 3rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .container {
    padding: 0 1.25rem 4rem;
  }

  .job-header {
    flex-direction: column;
    gap: 0.1rem;
  }

  .job-date {
    margin-left: 0;
  }

  .job-org::before {
    display: none;
  }

  .skills-group {
    flex-direction: column;
    gap: 0.15rem;
  }

  .edu-header {
    flex-direction: column;
  }

  .cvdiff-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .timeline-bar {
    padding: 0.75rem 1rem 1.25rem;
  }

  .seekbar-tick-label {
    font-size: 0.52rem;
  }

  .cv-header-grid {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .cv-grid-tr,
  .cv-grid-br {
    text-align: left;
  }

  .talk-entry {
    gap: 0.75rem;
  }

  .diff-container {
    font-size: 0.7rem;
  }

  .diff-line-num {
    width: 2.5em;
  }

  .diff-side .diff-line-num {
    width: 2em;
    font-size: 0.6rem;
  }

  .diff-side .diff-line-content {
    font-size: 0.65rem;
  }
}

@media (max-width: 380px) {
  .focus-toggle {
    flex-direction: column;
    align-items: center;
  }

  .hero-title {
    font-size: 1.5rem;
  }
}
