:root {
  --ink: #15161B;
  --paper: #FEFDFB;
  --muted: #6B6B72;
  --line: #15161B;

  --g1: #2B2A88;
  --g2: #C6426E;
  --g3: #1FA2A6;
  --g4: #F2A65A;
  --g5: #6C3BAA;

  --overlay-tint: rgba(21, 22, 27, 0.38);
  --card-max: 560px;
  --border-w: 2px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  color: var(--ink);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ============ ANIMATED GRADIENT FIELD ============ */
.field {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    120deg,
    var(--g1) 0%,
    var(--g2) 22%,
    var(--g3) 45%,
    var(--g4) 68%,
    var(--g5) 88%,
    var(--g1) 100%
  );
  background-size: 320% 320%;
  animation: drift 34s ease-in-out infinite;
}

@keyframes drift {
  0%   { background-position: 0% 40%; }
  25%  { background-position: 60% 0%; }
  50%  { background-position: 100% 70%; }
  75%  { background-position: 40% 100%; }
  100% { background-position: 0% 40%; }
}

@media (prefers-reduced-motion: reduce) {
  .field { animation: none; background-position: 30% 30%; }
}

/* ============ LAYOUT ============ */
.wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.card {
  width: 100%;
  max-width: var(--card-max);
  background: var(--paper);
  border: var(--border-w) solid var(--line);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.45);
}

/* ============ TOP SECTION ============ */
.top {
  padding: 40px 32px 8px;
}

.top-inner {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.portrait {
  position: relative;
  width: 150px;
  flex: 0 0 150px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: #EDEBE4;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portrait-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.portrait--empty img { display: none; }
.portrait--empty .portrait-fallback { display: flex; }

.info {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.name {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  line-height: 1.05;
}

.role {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 17px;
  color: var(--muted);
  margin: 0 0 20px;
}

.contact-lines {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
  color: #444;
}

.contact-lines a {
  color: #444;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.contact-lines a:hover {
  border-bottom-color: #444;
}

.social-links {
  display: flex;
  gap: 18px;
  margin: 0 0 22px;
  font-size: 15px;
}

.social-links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.social-links a:hover {
  border-bottom-color: var(--ink);
}

.resume-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border: 1.5px solid var(--line);
  padding: 10px 16px;
  transition: background 0.15s ease, color 0.15s ease;
}

.resume-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.dl-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.mark {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  display: inline-block;
  width: 1em;
}

/* ============ DIVIDER ============ */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--line);
  opacity: 0.25;
}

.divider-mark {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--g2);
}

/* ============ BOTTOM SECTION / STACK ============ */
.bottom {
  padding: 20px 0 24px;
}

.stack {
  display: flex;
  flex-direction: column;
}

.stack-item {
  border-top: 1px solid rgba(21,22,27,0.12);
}

.stack-item:last-child {
  border-bottom: 1px solid rgba(21,22,27,0.12);
}

.stack-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  padding: 16px 24px;
  transition: background 0.15s ease;
}

.stack-trigger:hover {
  background: rgba(21,22,27,0.04);
}

.stack-trigger .mark {
  transition: transform 0.25s ease;
  color: var(--ink);
}

.stack-trigger[aria-expanded="true"] .mark {
  transform: rotate(45deg);
  color: var(--g2);
}

.stack-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.stack-trigger[aria-expanded="true"] + .stack-panel {
  grid-template-rows: 1fr;
}

.stack-panel-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sub-link {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  padding: 10px 24px 10px 46px;
  position: relative;
  border-top: 1px dashed rgba(21,22,27,0.15);
  transition: color 0.15s ease, background 0.15s ease;
}

.sub-link:first-child { border-top: none; }

.sub-link::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: var(--muted);
}

.sub-link:hover {
  background: rgba(21,22,27,0.04);
  color: var(--g2);
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay-tint);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 680px;
  height: min(80vh, 720px);
  background: var(--paper);
  border: var(--border-w) solid var(--line);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
}

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper);
  border: var(--border-w) solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.modal-close .mark {
  transform: rotate(45deg);
  font-size: 16px;
}

.modal-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--paper);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 520px) {
  .wrap { padding: 28px 14px; }
  .top { padding: 32px 20px 8px; }
  .top-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .portrait { width: 140px; flex-basis: 140px; }
  .name { font-size: 28px; }
  .contact-lines { align-items: center; }
  .social-links { justify-content: center; }
  .resume-links { justify-content: center; }
  .modal-box { height: 85vh; }
}

/* ============ FOCUS STATES ============ */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--g2);
  outline-offset: 2px;
}
