@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:       #0b3b4a;
  --ink-2:     #33636b;
  --ink-3:     #6a938e;
  --bg:        #ffffff;
  --bg-2:      #eaf8fb;
  --bg-3:      #e6f9ef;
  --accent:    #1589fe;
  --accent-2:  #21a9d0;
  --accent-3:  #35c29a;
  --accent-4:  #9bd9fe;
  --border:    #d3eef8;
  --border-s:  #b6e2ee;
  --radius:    10px;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
  --max-w:     860px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
}

/* ── PROGRESS BAR ── */
#progress-bar {
  position: fixed; top: 0; left: 0;
  height: 2px; background: var(--accent-3);
  z-index: 200; width: 0%;
  transition: width 0.1s linear;
}

/* ── NAV ── */
nav {
  background: var(--accent);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(21,137,254,0.3);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-brand {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.nav-brand span {
  color: var(--accent-4);
  font-style: italic;
}
nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2px;
}
nav ul li a {
  display: block;
  padding: 6px 14px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.01em;
}
nav ul li a:hover { background: rgba(255,255,255,0.1); color: #fff; }
nav ul li a.active { background: var(--accent-3); color: #fff; font-weight: 600; }

/* ── LAYOUT ── */
main { max-width: var(--max-w); margin: 0 auto; padding: 3rem 24px 5rem; }

/* ── TYPOGRAPHY ── */
h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 0.5em;
  padding-bottom: 0.4em;
  border-bottom: 2px solid var(--border);
  position: relative;
}
h1::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 56px; height: 2px;
  background: var(--accent-3);
}
h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--accent-2);
  margin: 2.2em 0 0.7em;
  padding-left: 14px;
  border-left: 3px solid var(--accent-3);
  line-height: 1.3;
}
h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1.5em 0 0.4em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  color: var(--ink-3);
}
p {
  margin-bottom: 1.2em;
  color: var(--ink-2);
  text-align: justify;
  hyphens: auto;
}
.lead {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--ink-2);
  line-height: 1.65;
  margin-bottom: 2rem;
  font-weight: 300;
}

/* ── HERO (index) ── */
.hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-3);
  margin-bottom: 1.2rem;
}
.hero-eyebrow::before {
  content: '';
  width: 20px; height: 1.5px;
  background: var(--accent-3);
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  margin-top: 1.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-3);
}
.hero-meta b { color: var(--ink-2); font-weight: 500; }

/* ── THESIS BOX ── */
.thesis {
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 2rem 2.2rem;
  margin: 2.5rem 0;
  position: relative;
  overflow: hidden;
}
.thesis::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}
.thesis-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-4);
  margin-bottom: 0.8rem;
}
.thesis p {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.9);
  text-align: left;
  margin: 0;
}
.formula-block {
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  color: rgba(255,255,255,0.7);
  line-height: 2;
}
.formula-block .comment { color: rgba(255,255,255,0.35); }

/* ── CARDS ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px,1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover {
  border-color: var(--accent-3);
  box-shadow: 0 4px 20px rgba(21,137,254,0.15);
  transform: translateY(-2px);
}
.card-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: #cdeffb;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.card h3 {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin: 0 !important;
}
.card p {
  font-size: 13px;
  color: var(--ink-3);
  text-align: left;
  margin: 0;
  flex: 1;
}
.card-arrow { font-size: 12px; color: var(--accent-3); font-weight: 500; }

/* ── TIMELINE ── */
.timeline { margin: 1.5rem 0; }
.tl-item {
  display: flex;
  gap: 1.2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.tl-item:last-child { border-bottom: none; }
.tl-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent-3);
  flex-shrink: 0;
  margin-top: 7px;
}
.tl-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.tl-content p { font-size: 13px; color: var(--ink-3); margin: 0; text-align: left; }

/* ── TAGS ── */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1.5rem; }
.tag {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-3);
  color: var(--ink-3);
  border: 1px solid var(--border-s);
}

/* ── PDF VIEWER ── */
.pdf-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 1.5rem 0;
}
.pdf-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.pdf-icon {
  width: 44px; height: 44px;
  background: #cdf7ec;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.pdf-card-header h3 {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin: 0 !important;
}
.pdf-card-header p { font-size: 12px; color: var(--ink-3); margin: 0; text-align: left; }
.pdf-placeholder {
  height: 180px;
  border: 2px dashed var(--border-s);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-style: italic;
}
.pdf-placeholder span { font-size: 2rem; }
.pdf-embed {
  width: 100%;
  height: 85vh;
  border: none;
  border-radius: 8px;
}

/* ── NOTEBOOK CELLS ── */
.nb-cell {
  margin: 1.5rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.nb-cell-header {
  background: var(--bg-3);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nb-cell-header .lang-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #46ae61;
}
.nb-code {
  background: #0f1117;
  padding: 1.1rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: #e2e8f0;
  overflow-x: auto;
}
.nb-code .kw  { color: #c084fc; }
.nb-code .fn  { color: #60a5fa; }
.nb-code .cm  { color: #4b5563; }
.nb-code .st  { color: #86efac; }
.nb-code .nm  { color: #fb923c; }
.nb-output {
  background: var(--bg-2);
  padding: 1rem 1.3rem;
  font-size: 13px;
  color: var(--ink-3);
  border-top: 1px solid var(--border);
  font-style: italic;
}

/* ── SLIDE EMBED ── */
.slide-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
}
.slide-container iframe {
  width: 100%;
  height: 540px;
  border: none;
  display: block;
}

/* ── BACK TO TOP ── */
#back-to-top {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 42px; height: 42px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(11,59,74,0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
}
#back-to-top.show { opacity: 1; transform: translateY(0); }
#back-to-top:hover { background: var(--accent-2); }

/* ── SECTION LABEL ── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  max-width: var(--max-w);
  margin: 0 auto;
}
footer a { color: var(--accent-3); text-decoration: none; }
footer a:hover { text-decoration: underline; }