:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #2a3038;
  --text: #c9d1d9;
  --muted: #8b949e;
  --heading: #f0f6fc;
  --accent: #3fb950;
  --accent-text: #6bbf7e;
  --link: #58a6ff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
}

h1, h2, h3, h4, strong, b { font-weight: 600; }

a { color: var(--link); }
img { max-width: 100%; display: block; }
p { margin: 0 0 14px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
}
.nav ul { display: flex; gap: 32px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.nav ul a { color: var(--muted); text-decoration: none; }
.nav ul a:hover { color: var(--heading); }

/* Header */
.intro { padding: 80px 0 64px; }
.intro h1 { font-size: 44px; line-height: 1.15; color: var(--heading); margin: 0 0 8px; }
.intro .title { font-size: 20px; margin: 0 0 4px; }
.intro .sub { color: var(--muted); margin: 0 0 28px; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--heading);
  text-decoration: none;
  font-size: 15px;
}
.button:hover { border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
.button.primary:hover { filter: brightness(1.1); }

/* Sections */
section { padding: 56px 0; border-top: 1px solid var(--border); }
section h2 { font-size: 26px; color: var(--heading); margin: 0 0 28px; }

.entry + .entry { margin-top: 44px; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.entry h3 { font-size: 19px; color: var(--heading); margin: 0; }
.entry .date { color: var(--muted); font-size: 15px; white-space: nowrap; }
.entry .org { color: var(--accent-text); margin: 2px 0 12px; font-size: 15.5px; }
.entry h4 { color: var(--heading); font-size: 16.5px; margin: 24px 0 6px; }

.small { color: var(--muted); font-size: 15px; }
.small strong { color: var(--text); font-weight: 600; }

ul.list { margin: 4px 0 14px; padding-left: 20px; }
ul.list li { margin-bottom: 4px; }

/* About */
.about { display: flex; gap: 36px; align-items: flex-start; }
.photo {
  flex: 0 0 200px;
  height: 240px;
  overflow: hidden;
  border-radius: 4px;
}
.photo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.9); transform-origin: 57% 52%; }

/* Projects */
.project {
  border: 1px solid #1b2129;
  border-radius: 2px;
  padding: 24px 26px 18px;
  background: var(--surface);
}
.project + .project { margin-top: 24px; }
.project h3 { font-size: 19px; color: var(--heading); margin: 0; }
.project .org { color: var(--muted); font-size: 15px; margin: 2px 0 14px; }
.project h4 { color: var(--heading); font-size: 16px; margin: 20px 0 6px; }

/* Collapsible sections */
.collapsible { --fade: var(--surface); --peek: 150px; }
.collapsible.on-page { --fade: var(--bg); --peek: 480px; }
.js .collapsible .body { position: relative; max-height: var(--peek); overflow: hidden; }
.js .collapsible .body::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--fade));
}
.js .collapsible.open .body { max-height: none; }
.js .collapsible.open .body::after { display: none; }
.collapsible + .small { margin-top: 18px; }

.toggle {
  display: none;
  margin-top: 10px;
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--accent-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  cursor: pointer;
}
.js .toggle { display: inline-flex; align-items: center; }
.toggle:hover { text-decoration: underline; }
.toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.open > .toggle::after { transform: translateY(2px) rotate(-135deg); }

.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 8px; }
.shots a { color: var(--muted); font-size: 13.5px; text-decoration: none; }
.shots a:hover { color: var(--text); }
.shots img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 4px;
}

.table-wrap { overflow-x: auto; margin: 8px 0 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
code {
  font-family: "IBM Plex Mono", Consolas, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--text);
}
td code { white-space: nowrap; }

/* Contact */
.contact-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 20px; font-weight: 500; }
.contact-links a { color: var(--accent-text); text-decoration: none; }
.contact-links a:hover { text-decoration: underline; }
.contact-links span { color: var(--muted); }

/* Resume viewer */
.resume-viewer {
  width: min(900px, 94vw);
  height: 92vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}
.resume-viewer::backdrop { background: rgba(0, 0, 0, 0.7); }
.resume-viewer[open] { display: flex; flex-direction: column; }
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.viewer-bar strong { color: var(--heading); font-weight: 600; }
.viewer-bar .links { gap: 8px; }
.viewer-bar .button { padding: 6px 14px; font-size: 14px; background: none; font-family: inherit; cursor: pointer; }
.viewer-bar .button.primary { background: var(--accent); }
.image-viewer {
  max-width: 94vw;
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}
.image-viewer::backdrop { background: rgba(0, 0, 0, 0.75); }
.image-viewer[open] { display: flex; flex-direction: column; }
.image-frame { padding: 12px; overflow: auto; }
.image-frame img { max-width: 100%; max-height: calc(92vh - 80px); margin: 0 auto; }

.resume-viewer iframe { flex: 1; width: 100%; border: 0; background: #fff; }

footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }

/* Mobile */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .nav ul { gap: 18px; overflow-x: auto; font-size: 14px; }
  .intro { padding: 56px 0 48px; }
  .intro h1 { font-size: 36px; }
  .about { flex-direction: column; gap: 20px; }
  .photo { flex: none; width: 160px; height: 190px; }
  .project { padding: 20px 18px 14px; }
  .shots { grid-template-columns: repeat(2, 1fr); }

  /* IOC table: one stacked card per row */
  table thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 2px 0; font-size: 14px; }
  td[data-label="IOC"] { margin-bottom: 6px; }
  td[data-label="IOC"] code { white-space: normal; word-break: break-all; }
  td:not([data-label="IOC"])::before { content: attr(data-label) ": "; color: var(--muted); }
}
@media (max-width: 370px) {
  .nav ul { gap: 12px; font-size: 13px; }
}
