/* ============================================================
   ESC102 Engineering Portfolio — style.css
   ============================================================ */

:root {
  --bg:        #ffffff;
  --surface:   #f7f8fa;
  --border:    #e2e5ea;
  --text:      #1a1a1a;
  --muted:     #6b7280;
  --accent:    #002a5c;
  --accent-lt: #d6e4f0;

  --frame:     #002a5c;
  --diverge:   #4a7c59;
  --converge:  #c9472f;
  --represent: #7b5ea7;

  --radius: 8px;
  --nav-h:  56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }

/* ═══════════════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════════════ */

.home-hero {
  background: var(--accent);
  color: #fff;
  padding: 5.5rem 2rem 4.5rem;
}
.home-hero .container { max-width: 860px; margin: 0 auto; }
.hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 3rem; }
.hero-text { display: flex; flex-direction: column; gap: .8rem; flex: 1; }
.hero-photo { flex-shrink: 0; }
.hero-photo img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 3px solid rgba(255,255,255,.25);
  display: block;
}
.hero-eyebrow {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .65;
}
.hero-name { font-size: 2.8rem; font-weight: 700; line-height: 1.12; }
.hero-tagline {
  font-size: 1.1rem;
  opacity: .85;
  max-width: 520px;
  line-height: 1.65;
  margin-top: .2rem;
}

.home-position { padding: 4.5rem 2rem 3.5rem; }
.home-position .container { max-width: 860px; margin: 0 auto; }

.section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}
.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.position-statement {
  font-size: 1.15rem;
  font-style: italic;
  border-left: 4px solid var(--accent);
  padding: .9rem 1.4rem;
  margin: 1.25rem 0 1.75rem;
  color: var(--accent);
  background: var(--accent-lt);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.position-body p { margin-bottom: 1rem; color: #2a2a2a; }

/* ── Position Evolution timeline ───────────────────────────── */
.position-evolution {
  padding: 4rem 2rem 3rem;
  border-top: 1px solid var(--border);
}
.position-evolution .container { max-width: 860px; margin: 0 auto; }

.timeline {
  position: relative;
  margin-top: 1.75rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.timeline-item { position: relative; padding-left: 1.25rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.88rem;
  top: .45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.timeline-meta {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}
.timeline-date {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.timeline-tag {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .2em .65em;
  border-radius: 99px;
}
.timeline-quote {
  font-style: italic;
  font-size: 1rem;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding: .5rem .9rem;
  background: var(--accent-lt);
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.65;
}
.timeline-text {
  font-size: .97rem;
  color: #2a2a2a;
  line-height: 1.7;
  margin: 0;
}

/* ── References ─────────────────────────────────────────────── */
.home-references {
  padding: 3.5rem 2rem 4rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.home-references .container { max-width: 860px; margin: 0 auto; }
.ieee-references {
  margin-top: 1.5rem;
  max-width: 780px;
}
.ieee-ref-entry {
  font-size: .92rem;
  line-height: 1.75;
  color: #2a2a2a;
  padding-left: 2.6rem;
  text-indent: -2.6rem;
  margin-bottom: .65rem;
}
.ieee-ref-entry a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: color .15s, text-decoration-color .15s;
}
.ieee-ref-entry a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ── Project cards ──────────────────────────────────────────── */
.projects-nav {
  padding: 3.5rem 2rem 6rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.projects-nav > .section-label {
  max-width: 860px;
  margin: 0 auto 1.75rem;
  display: block;
}
.project-cards {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.project-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  border-top: 4px solid var(--card-color, var(--accent));
  padding: 2rem 1.75rem 1.6rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .2s, transform .2s;
  min-height: 240px;
}
.project-card::before {
  content: attr(data-num);
  position: absolute;
  right: -.05em;
  bottom: -.15em;
  font-size: 9rem;
  font-weight: 900;
  line-height: 1;
  color: var(--card-color, var(--accent));
  opacity: .07;
  pointer-events: none;
  user-select: none;
}
.project-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
  transform: translateY(-3px);
  text-decoration: none;
}
.card-number {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--card-color, var(--accent));
  margin-bottom: .6rem;
}
.card-title { font-size: 1.25rem; font-weight: 700; color: var(--text); line-height: 1.25; margin-bottom: .6rem; }
.card-desc { font-size: .88rem; color: var(--muted); line-height: 1.55; margin-bottom: 1.5rem; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-arrow {
  font-size: .88rem;
  font-weight: 700;
  color: var(--card-color, var(--accent));
  display: flex;
  align-items: center;
  gap: .25rem;
  transition: gap .15s;
}
.project-card:hover .card-arrow { gap: .5rem; }
.card-badges { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   PROJECT PAGES
   ═══════════════════════════════════════════════════════════ */

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--accent);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  padding: .45em 1em .45em .8em;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.topbar-back:hover { background: #003d80; text-decoration: none; transform: translateX(-2px); }
.topbar-back::before { content: "←"; font-size: .95em; }
.topbar-title { font-size: .88rem; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── PDF embed ──────────────────────────────────────────────── */
.pdf-wrapper { position: relative; margin: 1rem 0; }
.pdf-embed {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: block;
  background: var(--surface);
}
.pdf-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: .55rem;
  font-size: .8rem;
  color: var(--muted);
  font-style: italic;
}
.pdf-scroll-hint svg { flex-shrink: 0; animation: bounce-y 1.6s ease-in-out infinite; }
@keyframes bounce-y {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(3px); }
}

/* ── Sidebar layout ─────────────────────────────────────────── */
.project-layout {
  display: flex;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
  gap: 3rem;
  align-items: flex-start;
}
.sidebar {
  width: 190px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
  padding: 2.5rem 0;
}
.sidebar-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-left: .9rem;
}
.sidebar-nav { display: flex; flex-direction: column; gap: .1rem; }
.sidebar-link {
  font-size: .88rem;
  font-weight: 500;
  color: var(--muted);
  padding: .45rem .9rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  display: block;
}
.sidebar-link:hover { color: var(--accent); background: var(--surface); text-decoration: none; }
.sidebar-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-lt); font-weight: 600; }

/* ── Main content ───────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; padding: 2.5rem 0 6rem; }

/* ── Project header ─────────────────────────────────────────── */
.project-page-header { margin-bottom: 2.5rem; }
.project-page-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.project-page-title { font-size: 1.85rem; font-weight: 700; color: var(--accent); line-height: 1.2; margin-bottom: .6rem; }
.strand-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .28em .8em;
  border-radius: 99px;
  color: #fff;
}
.badge-frame     { background: var(--frame); }
.badge-diverge   { background: var(--diverge); }
.badge-converge  { background: var(--converge); }
.badge-represent { background: var(--represent); }
.badge-tbd       { background: var(--border); color: var(--muted); }

/* ── Content sections ───────────────────────────────────────── */
.content-section { scroll-margin-top: calc(var(--nav-h) + 2rem); }
.content-section + .content-section { margin-top: 3.5rem; }

.subsection-title {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: .4em 1em;
  border-radius: 4px;
  margin-bottom: 1.1rem;
}

.summary-body p { margin-bottom: 1rem; font-size: 1rem; }
.summary-body ul { padding-left: 1.4rem; margin-bottom: 1rem; }
.summary-body li { margin-bottom: .35rem; font-size: 1rem; }

.annotation-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}

.section-divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── Annotation sub-topics ──────────────────────────────────── */
.annotation-point + .annotation-point {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px dashed var(--border);
}
.annotation-point p { margin-bottom: 1rem; font-size: 1rem; }

.annotation-point-label {
  display: inline-block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #fff;
  padding: .3em .8em;
  border-radius: 4px;
  margin-bottom: .75rem;
}
.annotation-point-label.label-reframe  { background: #1e40af; }
.annotation-point-label.label-team     { background: #92400e; }
.annotation-point-label.label-positive      { background: #166534; }
.annotation-point-label.label-pairwise      { background: #6b21a8; }
.annotation-point-label.label-bridge-frame  { background: #0f766e; }
.annotation-point-label.label-bridge-bad    { background: #b45309; }
.annotation-point-label.label-p2-frame      { background: #0369a1; }
.annotation-point-label.label-p2-represent  { background: #7c3aed; }

/* ── Teammates line ─────────────────────────────────────────── */
.project-page-teammates {
  font-size: .85rem;
  color: var(--text);
  margin-top: .45rem;
  margin-bottom: .1rem;
}
.project-page-teammates::before {
  content: "Team: ";
  font-weight: 700;
  color: var(--accent);
}

/* ── Text emphasis ──────────────────────────────────────────── */
mark {
  background: #fef08a;
  color: inherit;
  padding: .05em .2em;
  border-radius: 3px;
}
.key-term {
  font-weight: 700;
  color: var(--accent);
}
.lesson {
  display: block;
  font-weight: 600;
  border-left: 3px solid var(--converge);
  padding: .5rem .9rem;
  margin-top: .75rem;
  background: #fff5f3;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .95rem;
}

/* ── CTMF overview chart ────────────────────────────────────── */
.ctmf-overview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
}
.ctmf-overview-header {
  display: grid;
  grid-template-columns: 1fr 130px 1fr;
  gap: 1rem;
  padding: .6rem 1.25rem;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ctmf-overview-row {
  display: grid;
  grid-template-columns: 1fr 130px 1fr;
  gap: 1rem;
  padding: .9rem 1.25rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.ctmf-overview-row:last-child { border-bottom: none; }
.ctmf-overview-row:nth-child(even) { background: var(--surface); }
.ctmf-overview-name { font-weight: 700; font-size: .95rem; }
.ctmf-overview-desc { font-size: .88rem; color: var(--muted); }

/* ── CTMF cards ─────────────────────────────────────────────── */
.ctmf-grid { display: grid; gap: 1.25rem; margin-top: 1rem; }
.ctmf-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  background: var(--bg);
}
.ctmf-card.frame     { border-left-color: var(--frame); }
.ctmf-card.diverge   { border-left-color: var(--diverge); }
.ctmf-card.converge  { border-left-color: var(--converge); }
.ctmf-card.represent { border-left-color: var(--represent); }
.ctmf-card.placeholder-card { border-left-color: var(--border); opacity: .6; }

.ctmf-card-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.ctmf-name { font-weight: 700; font-size: 1.05rem; }

.ctmf-row-label {
  display: block;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  padding: .45rem 0 .15rem;
  margin-top: .85rem;
  border-top: 1.5px solid var(--border);
}
.ctmf-card.converge  .ctmf-row-label { color: var(--converge); border-color: var(--converge); }
.ctmf-card.frame     .ctmf-row-label { color: var(--frame);    border-color: var(--frame); }
.ctmf-card.diverge   .ctmf-row-label { color: var(--diverge);  border-color: var(--diverge); }
.ctmf-card.represent .ctmf-row-label { color: var(--represent);border-color: var(--represent); }

.ctmf-card p { font-size: .97rem; margin-bottom: .4rem; line-height: 1.7; }

.placeholder {
  display: block;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  color: var(--muted);
  font-size: .9rem;
  font-style: italic;
}

/* ── Figures & captions ─────────────────────────────────────── */
.figure { margin: 1.75rem 0; }
.figure img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.figure.narrow { display: flex; flex-direction: column; align-items: center; }
.figure.narrow img { width: auto; max-width: 340px; max-height: 420px; object-fit: contain; }
.figure-caption {
  font-size: .83rem;
  color: var(--muted);
  font-style: italic;
  margin-top: .55rem;
  line-height: 1.55;
  padding: 0 .1rem;
}
.figure-caption strong { color: var(--text); font-style: normal; font-weight: 600; }
.figure-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.75rem 0; }
.figure-row .figure { margin: 0; }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  background: var(--accent);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 1.5rem;
  font-size: .78rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .project-cards { grid-template-columns: 1fr; }
  .project-layout { flex-direction: column; padding: 0 1rem; gap: 0; }
  .sidebar { position: static; width: 100%; padding: 1.25rem 0 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
  .sidebar-nav { flex-direction: row; gap: .5rem; flex-wrap: wrap; }
  .sidebar-link { border-left: none; border-bottom: 2px solid transparent; border-radius: 0; }
  .sidebar-link.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .hero-name { font-size: 2rem; }
  .hero-inner { flex-direction: column-reverse; align-items: flex-start; gap: 1.5rem; }
  .hero-photo img { width: 120px; height: 120px; }
  .topbar { padding: 0 1rem; }
  .ctmf-overview-header,
  .ctmf-overview-row { grid-template-columns: 1fr; gap: .4rem; }
}
