/* Bogac Canbaz portfolio
   One typeface, one accent, no decoration that does not carry information. */

:root {
  --ink: #1c2530;
  --ink-soft: #55606c;
  --rule: #dfe3e8;
  --paper: #ffffff;
  --paper-soft: #f3f5f7;
  --accent: #1f4f7a;
  --accent-ink: #163a5a;
  --measure: 66ch;
  --gutter: clamp(20px, 4vw, 48px);
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
a:hover { color: var(--accent-ink); border-bottom-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-bottom-color: transparent; }

/* Header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.wordmark {
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  border: 0;
}
.site-header nav { display: flex; gap: 22px; flex-wrap: wrap; }
.site-header nav a {
  color: var(--ink-soft);
  border: 0;
  font-size: 15px;
}
.site-header nav a:hover { color: var(--ink); }

/* Layout */

main { padding: 0 var(--gutter); max-width: 1180px; margin: 0 auto; }

.section {
  padding: 56px 0 8px;
  border-top: 1px solid var(--rule);
}
.section > h2 {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  margin: 0 0 32px;
}

/* Intro */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 48px;
  align-items: start;
  padding: 64px 0 40px;
}
.intro h1 {
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: -0.012em;
  margin: 0 0 24px;
  max-width: 24ch;
}
.intro p { max-width: var(--measure); margin: 0 0 18px; }
.intro .links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 26px; }

.portrait { margin: 0; padding-top: 10px; }
.portrait img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--paper-soft);
}
.portrait.missing img { display: none; }
.portrait.missing::after {
  content: "headshot.jpg";
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 14px;
}

/* Hero video */

.hero { margin: 8px 0 24px; }
.hero video { object-fit: cover; }
.hero video, .hero .video-wrap {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--paper-soft);
}
.hero .video-wrap iframe { width: 100%; height: 100%; border: 0; }
.hero figcaption {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 14px 0 0;
}

/* Projects */

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 56px;
  padding: 0 0 56px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--rule);
}
.project:last-of-type { border-bottom: 0; margin-bottom: 0; }

.project h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  max-width: 28ch;
}
.project-meta { color: var(--ink-soft); font-size: 15px; margin: 0 0 28px; }
.project h4 {
  font-size: 17px;
  font-weight: 600;
  margin: 30px 0 8px;
}
.project p { max-width: var(--measure); margin: 0 0 14px; }
.project .note { font-size: 15px; color: var(--ink-soft); }

.math { padding-left: 20px; margin: 0; max-width: var(--measure); }
.math li { margin-bottom: 6px; }

.project-figures figure { margin: 0 0 32px; }
.project-figures img {
  display: block;
  width: 100%;
  background: var(--paper-soft);
}
.project-figures figcaption {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-top: 10px;
}

/* Metrics table */

.metrics {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
  margin: 10px 0 12px;
}
.metrics caption {
  caption-side: top;
  text-align: left;
  font-size: 14px;
  color: var(--ink-soft);
  padding: 0 0 10px;
}
.metrics th, .metrics td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--rule);
}
.metrics thead th { font-weight: 500; color: var(--ink-soft); border-bottom: 1px solid var(--ink); }
.metrics tbody th { font-weight: 400; width: 52%; }
.metrics td:nth-child(2) { font-weight: 600; white-space: nowrap; }
.metrics td:nth-child(3) { color: var(--ink-soft); }

/* Publications and patents */

.pubs { padding-left: 24px; margin: 0; max-width: 80ch; }
.pubs li { margin-bottom: 14px; }
.pubs li::marker { color: var(--ink-soft); }

/* Contact */

.contact { padding-bottom: 64px; }
.contact p { max-width: var(--measure); margin: 0; }

/* Footer */

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-soft);
}
.site-footer a { color: var(--ink-soft); border: 0; margin-left: 18px; }
.site-footer a:hover { color: var(--ink); }

/* Responsive */

@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .portrait { max-width: 220px; order: -1; }
  .project { grid-template-columns: 1fr; gap: 28px; }
  .project-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
  .metrics tbody th { width: auto; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-header nav { gap: 16px; }
  .metrics { font-size: 14px; }
  .site-footer { flex-direction: column; }
  .site-footer a { margin: 0 18px 0 0; }
}

/* ---- Multi-page additions ---- */

.site-header nav a[aria-current="page"] { color: var(--ink); font-weight: 500; }

.page-head { padding: 64px 0 40px; }
.page-head h1 {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.014em;
  line-height: 1.18;
  margin: 0 0 20px;
}
.lede { max-width: var(--measure); margin: 0; color: var(--ink-soft); }
.section .lede { font-size: 17px; }

.section--flush { border-top: 0; padding-top: 0; }

/* Capabilities list */

.capabilities { margin: 0; }
.capabilities > div {
  display: grid;
  grid-template-columns: minmax(0, 290px) minmax(0, 1fr);
  gap: 12px 48px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}
.capabilities > div:last-child { border-bottom: 1px solid var(--rule); }
.capabilities dt { font-weight: 600; line-height: 1.35; }
.capabilities dd { margin: 0; max-width: var(--measure); color: var(--ink-soft); }

/* Domains */

.domains { padding: 0; margin: 28px 0 0; list-style: none; max-width: 78ch; }
.domains li {
  padding: 14px 0 14px 20px;
  border-left: 2px solid var(--rule);
  margin-bottom: 4px;
  color: var(--ink-soft);
}
.domains li strong { color: var(--ink); font-weight: 600; }

/* Cross-page pointer */

.next { padding: 40px 0 64px; }
.next p { margin: 0; color: var(--ink-soft); }

@media (max-width: 860px) {
  .capabilities > div { grid-template-columns: 1fr; gap: 8px; }
}

/* ---- Portfolio structure ---- */

.eyebrow-role { font-size: 16px; color: var(--ink-soft); margin: 0 0 6px; }
.intro h1 {
  font-size: clamp(34px, 4.4vw, 50px);
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  max-width: none;
}
.standfirst { font-size: 19px; line-height: 1.5; max-width: 52ch; }

.prose p { max-width: var(--measure); margin: 0 0 16px; }
.prose p:last-child { margin-bottom: 0; }

.next-inline { margin-top: 30px; color: var(--ink-soft); }

/* Breadcrumb */

.crumb { padding: 26px 0 0; font-size: 14px; color: var(--ink-soft); }
.crumb a { color: var(--ink-soft); border-bottom-color: transparent; }
.crumb a:hover { color: var(--ink); }
.crumb span::before { content: "/"; margin: 0 8px; color: var(--rule); }

/* Project index cards */

.project-index { list-style: none; padding: 0; margin: 0; }
.project-index > li { border-top: 1px solid var(--rule); }
.project-index > li:last-child { border-bottom: 1px solid var(--rule); }

.project-card {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 40px;
  padding: 36px 0;
  border: 0;
  color: inherit;
}
.project-card:hover { color: inherit; }
.project-card figure { margin: 0; }
.project-card figure img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--paper-soft);
}
.project-card figure.nofig img { display: none; }
.project-card figure.nofig::after {
  content: "";
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--paper-soft);
}
.project-card h2 {
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.project-card p { max-width: var(--measure); margin: 0 0 12px; }
.project-card .project-meta { margin-bottom: 16px; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 15px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
}
.stat-row strong { color: var(--ink); font-weight: 600; }

.card-cue { font-size: 15px; color: var(--accent); }
.project-card:hover .card-cue { color: var(--accent-ink); text-decoration: underline; }
.project-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

/* Project page headings */

.proj-h { font-size: 24px; font-weight: 600; line-height: 1.25; margin: 0 0 6px; max-width: 30ch; }
.page-head h1 { max-width: 22ch; }

@media (max-width: 860px) {
  .project-card { grid-template-columns: 1fr; gap: 20px; }
}

/* ================================================================
   v2 layout: single left rail, justified body text
   ================================================================ */

main { max-width: 1120px; }

/* Every section becomes: heading in a fixed left rail, content beside it.
   This gives the whole site one continuous left text edge, and lets the
   body text run out to the right boundary of the page. */

.section {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  column-gap: 56px;
  padding: 52px 0;
  align-items: start;
}
.section > * { grid-column: 2; }
.section > h2 {
  grid-column: 1;
  grid-row: 1 / span 99;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  position: sticky;
  top: 96px;
}
.section--flush { display: block; padding-top: 0; border-top: 0; }

/* Justified body text, hyphenated so the spacing stays even */

.prose p,
.capabilities dd,
.domains li,
.lede,
.standfirst,
.contact p,
.pubs li,
.project p,
.hero figcaption,
.project-figures figcaption {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.links, .stat-row, .next-inline, .crumb, .project-meta { text-align: left; hyphens: manual; }

/* Let the text fill the column instead of stopping short */

.prose p, .capabilities dd, .lede, .contact p, .domains, .pubs { max-width: none; }
.project p, .math, .metrics { max-width: none; }

/* Intro: portrait sits in the rail, so the name and the section
   headings below share one vertical line */

.intro {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  column-gap: 56px;
  align-items: start;
  padding: 68px 0 52px;
}
.intro .portrait { grid-column: 1; margin: 0; padding: 0; max-width: none; order: 0; }
.intro .portrait img { width: 232px; height: 232px; object-fit: cover; }
.intro-text { grid-column: 2; }
.intro h1 {
  font-size: clamp(36px, 4.6vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 2px 0 18px;
}
.eyebrow-role { font-size: 15px; letter-spacing: 0.02em; margin: 0 0 10px; }
.standfirst { font-size: 20px; line-height: 1.5; max-width: none; margin: 0; }
.intro .links { margin-top: 28px; gap: 10px 26px; }

/* Capabilities read better stacked now that the rail carries the structure */

.capabilities > div { grid-template-columns: 1fr; gap: 6px; padding: 20px 0; }
.capabilities > div:first-child { padding-top: 0; border-top: 0; }
.capabilities dt { font-size: 17px; }

.domains { margin-top: 24px; }
.domains li { padding-right: 0; }

.pubs { padding-left: 22px; }

@media (max-width: 900px) {
  .section, .intro { grid-template-columns: 1fr; column-gap: 0; }
  .section > * , .intro-text, .intro .portrait { grid-column: 1; }
  .section > h2 { grid-row: auto; position: static; margin-bottom: 24px; }
  .intro .portrait { margin-bottom: 24px; }
  .intro .portrait img { width: 168px; height: 168px; }
}

@media (max-width: 560px) {
  .prose p, .capabilities dd, .domains li, .lede, .standfirst, .contact p, .pubs li {
    text-align: left;
  }
}

/* ================================================================
   Readable headings: section titles and case-study subheadings
   ================================================================ */

.section > h2 {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.project h4 {
  font-size: 20px;
  margin: 36px 0 10px;
}
.capabilities dt { font-size: 18px; }

@media (max-width: 900px) {
  .section > h2 { font-size: 24px; }
}

/* Portfolio thumbnails: show the whole image instead of cropping it */

.project-card figure img,
.project-card figure.nofig::after {
  aspect-ratio: 1 / 1;
}
.project-card figure img {
  object-fit: contain;
  background: var(--paper);
}
@media (max-width: 860px) {
  .project-card figure { max-width: 360px; }
}

/* Background: education, experience, awards
   One section, three groups separated by the same rule as the rest of the site */

.section--background > h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 14px;
}
.section--background > h3 ~ h3 {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.cv-list { list-style: none; padding: 0; margin: 0; }
.cv-list li { padding: 5px 0; color: var(--ink-soft); }
.cv-list strong { color: var(--ink); font-weight: 600; }

/* Experience reuses .capabilities; the group rule above replaces its closing border */
.section--background .capabilities > div:last-child { border-bottom: 0; padding-bottom: 0; }

/* Keep the institution and date line ragged; .capabilities dd would otherwise justify it */
.section--background .capabilities dd.project-meta {
  text-align: left;
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* ================================================================
   Coursework section on the About page
   ================================================================ */

.section--coursework > .lede { margin-bottom: 8px; }
.section--coursework > h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 32px 0 6px;
}
.section--coursework > h3:first-of-type { margin-top: 24px; }

.courses { margin: 0; }
.courses > div {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: 4px 40px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.courses > div:last-child { border-bottom: 1px solid var(--rule); }
.courses dt { font-weight: 600; line-height: 1.4; }
.courses dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  -webkit-hyphens: auto;
  hyphens: auto;
}

@media (max-width: 900px) {
  .courses > div { grid-template-columns: 1fr; gap: 6px; }
}

/* Course-project case study: two-column specification tables reuse .metrics */

.metrics.spec tbody th { width: 58%; }
.metrics.spec td { color: var(--ink); white-space: normal; }
.project-text { min-width: 0; }
@media (max-width: 860px) {
  .metrics.spec tbody th { width: 50%; }
}

/* Meta and eyebrow lines under article headings stay ragged, never justified */

.project .project-meta, .project .proj-eyebrow { text-align: left; -webkit-hyphens: manual; hyphens: manual; }

/* Coursework case study: several short articles share one page, so the
   headings carry a small eyebrow with the course they came from */

.proj-eyebrow {
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.project[id] { scroll-margin-top: 96px; }

/* ================================================================
   Coursework page and numbered course projects
   ================================================================ */

/* Course code sits above the course name */
.course-code {
  display: block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

/* Note under the Education list on the About page */
.cv-note { margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; }

/* Contents list at the top of the projects page */
.contents {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: proj;
  max-width: 78ch;
  border-top: 1px solid var(--rule);
}
.contents li {
  counter-increment: proj;
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  gap: 0 16px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.contents li::before {
  content: counter(proj);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.contents li a { border-bottom-color: transparent; }
.contents li a:hover { border-bottom-color: currentColor; }
.contents li span { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }

/* Each numbered project opens with a large index and a heavier rule */
.project--numbered {
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  padding-top: 36px;
  margin-bottom: 40px;
}
.project--numbered:last-of-type { margin-bottom: 0; }
.proj-index {
  font-size: 44px;
  font-weight: 300;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}
.project--numbered .proj-eyebrow { margin-bottom: 10px; }
.project--numbered .proj-eyebrow strong { color: var(--ink); font-weight: 600; }

@media (max-width: 560px) {
  .contents li { grid-template-columns: 2.2em minmax(0, 1fr); }
  .contents li span { grid-column: 2; white-space: normal; }
}

/* ================================================================
   Octagonal portrait
   ================================================================ */

/* Tall octagon: the frame is 15 wide by 17 high and every corner is cut
   at 45 degrees by one fifth of the width (3 of 15 across, 3 of 17 down),
   so the left and right edges run longer than the top and bottom */
.intro .portrait img {
  height: auto;
  aspect-ratio: 15 / 17;
  clip-path: polygon(20% 0, 80% 0, 100% 17.65%, 100% 82.35%,
                     80% 100%, 20% 100%, 0 82.35%, 0 17.65%);
}

/* ================================================================
   Dark theme
   theme.js sets data-theme on <html>; every color on the site comes
   from these variables, so swapping them is the whole theme
   ================================================================ */

:root { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4e8ed;
  --ink-soft: #a0aab5;
  --rule: #2b333d;
  --paper: #11161c;
  --paper-soft: #1a2129;
  --accent: #86b6e3;
  --accent-ink: #b3d1ee;
}

/* Theme switch, placed at the right end of the header */

.site-header { justify-content: flex-start; }
.site-header nav { margin-left: auto; }

/* Pill switch: in day mode the knob sits on the right with a sun and the
   label on the left; in night mode the pill darkens, the knob moves left
   with a moon, and the label moves right */

.theme-toggle {
  --toggle-w: 124px;
  --toggle-h: 32px;
  --knob: 26px;
  --inset: 2px;
  flex: none;
  align-self: center;
  position: relative;
  width: var(--toggle-w);
  height: var(--toggle-h);
  margin-left: 26px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.theme-toggle:hover { border-color: var(--ink-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle[aria-checked="true"] { border-color: var(--ink-soft); }

.theme-toggle-label {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.label-day { left: 14px; }
.label-night { right: 12px; opacity: 0; }
.theme-toggle[aria-checked="true"] .label-day { opacity: 0; }
.theme-toggle[aria-checked="true"] .label-night { opacity: 1; }

.theme-toggle-knob {
  position: absolute;
  top: calc((var(--toggle-h) - 2px - var(--knob)) / 2);
  left: var(--inset);
  width: var(--knob);
  height: var(--knob);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  transform: translateX(calc(var(--toggle-w) - 2px - var(--knob) - 2 * var(--inset)));
  transition: transform 0.25s ease, background-color 0.25s ease;
}
/* Night: the page variables are already swapped, so the pill stays on
   --paper-soft (now dark) and the knob takes --ink (now light) */
.theme-toggle[aria-checked="true"] .theme-toggle-knob {
  transform: none;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .theme-toggle-knob, .theme-toggle-label { transition: none; }
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}
.theme-toggle .icon-moon { display: none; }
.theme-toggle[aria-checked="true"] .icon-sun { display: none; }
.theme-toggle[aria-checked="true"] .icon-moon { display: block; }

@media (max-width: 520px) {
  .site-header nav { margin-left: 0; }
  .theme-toggle { position: absolute; top: 20px; right: var(--gutter); margin: 0; }
}
