:root {
  --bg1: #07101d;
  --bg2: #0d1b2d;
  --card: rgba(15, 28, 45, .78);
  --card2: rgba(255,255,255,.055);
  --line: rgba(255,255,255,.11);
  --text: #f4f7fb;
  --muted: #aeb9c8;
  --accent: #d9b977;
  --accent2: #f1ddad;
  --shadow: 0 26px 80px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 15%, rgba(69,112,165,.23), transparent 32%),
    radial-gradient(circle at 90% 85%, rgba(217,185,119,.11), transparent 28%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  overflow-x: hidden;
}

.shell {
  width: min(1080px, 100%);
  position: relative;
}

.shell::before,
.shell::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .23;
  pointer-events: none;
}

.shell::before {
  background: #416d9c;
  top: -20px;
  left: -70px;
}

.shell::after {
  background: #b49354;
  right: -90px;
  bottom: -20px;
}

@media (max-width: 1260px) {
  .shell::before,
  .shell::after {
    display: none;
  }
}

.card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(360px, 1.2fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.028));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.portrait-wrap {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  background: #d9d9d9;
}

.portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 620px;
  object-fit: cover;
  object-position: center 18%;
  display: block;
  filter: saturate(.96) contrast(1.02);
}

.portrait-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(5,12,22,.52), transparent 35%),
    linear-gradient(to right, transparent 72%, rgba(7,16,29,.22));
  pointer-events: none;
}

.content {
  padding: 64px 58px 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  display: block;
  width: fit-content;
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.eyebrow::before {
  display: none;
}

h1 {
  position: relative;
  margin: 0;
  padding: 18px 0 20px;
  transform: translateX(-2px);
  font-size: clamp(38px, 5vw, 64px);
  line-height: .94;
  letter-spacing: -.035em;
  font-weight: 750;
}

h1::before,
h1::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

h1::before { top: 0; }
h1::after { bottom: 0; }

.domain {
  width: fit-content;
  margin-top: 18px;
  padding: 2px 0;
  color: var(--accent2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
}

.roles {
  margin: 32px 0 0;
  display: grid;
  gap: 12px;
}

.role {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card2);
  color: #e8edf4;
  font-size: 15px;
  line-height: 1.4;
}

.role strong {
  color: var(--accent2);
  font-weight: 700;
}

.profile-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.profile-nav button {
  grid-column: span 2;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  padding: 10px 13px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.profile-nav button:nth-child(n+4) {
  grid-column: span 3;
}

@media (hover: hover) and (pointer: fine) {
  .profile-nav button:hover,
  .profile-nav button[aria-expanded="true"] {
    color: #08111f;
    background: var(--accent2);
    border-color: var(--accent2);
  }
}

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

html:has(.profile-panel[open]) {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.profile-panel {
  inset: 0;
  width: min(720px, calc(100% - 32px));
  max-height: min(84vh, 820px);
  max-height: min(84dvh, 820px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--text);
  background: #0c192a;
  box-shadow: 0 28px 80px rgba(0,0,0,.55);
  overflow: hidden;
}

.profile-panel[open] {
  display: flex;
  flex-direction: column;
}

.profile-panel::backdrop {
  background: rgba(2, 8, 16, .76);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

#profile-panel-content {
  min-height: 0;
  padding: 4px 18px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--accent) rgba(255,255,255,.05);
}

#profile-panel-content:focus-visible {
  outline-offset: -3px;
}

.profile-panel-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.055);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.profile-panel h2 {
  margin: 0;
  color: var(--accent2);
  font-size: 16px;
}

.profile-panel h2:focus {
  outline: none;
}

.profile-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.profile-panel h3 {
  margin: 18px 0 6px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.profile-panel h3:first-child {
  margin-top: 8px;
}

.profile-panel .degree {
  color: var(--accent2);
  font-weight: 700;
}

.profile-panel .stats {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: rgba(255,255,255,.035);
  border-radius: 0 10px 10px 0;
}

.profile-panel .subjects {
  color: #d9e0e9;
}

.subjects-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.subjects-list span {
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  background: rgba(255,255,255,.035);
  color: #d9e0e9;
  font-size: 11px;
  line-height: 1.35;
}

.profile-panel h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.achievement {
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}

.achievement.service-award {
  border-left: 3px solid var(--accent);
}

.achievement.science-award {
  border-left: 3px solid #7ea6d8;
}

.achievement.academic-award {
  border-left: 3px solid #7fc2a0;
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.category-heading::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(217,185,119,.1);
  flex: 0 0 auto;
}

.category-heading.science::before {
  background: #7ea6d8;
  box-shadow: 0 0 0 4px rgba(126,166,216,.1);
}

.category-heading.academic::before {
  background: #7fc2a0;
  box-shadow: 0 0 0 4px rgba(127,194,160,.1);
}

.achievement-date {
  color: var(--accent2) !important;
  font-weight: 700;
}

.science-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.science-picker button,
.science-controls button {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.science-picker button[aria-pressed="true"] {
  color: #08111f;
  background: var(--accent2);
  border-color: var(--accent2);
}

.science-viewer {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #07101c;
  user-select: none;
  -webkit-user-select: none;
}

.science-viewer:fullscreen,
.science-viewer.is-expanded {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #050b13;
}

.science-viewer.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.science-viewer:fullscreen .science-stage,
.science-viewer.is-expanded .science-stage {
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.science-viewer:fullscreen .science-stage img,
.science-viewer.is-expanded .science-stage img {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.science-stage {
  display: grid;
  place-items: center;
  min-height: min(260px, 55dvh);
  overflow: hidden;
  background: #050b13;
}

.science-stage img {
  display: block;
  max-width: 100%;
  max-height: 68dvh;
  object-fit: contain;
  pointer-events: none;
}

.science-stage [hidden] {
  display: none;
}

.science-stage p {
  padding: 12px;
  text-align: center;
}

#science-retry {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent2);
  background: #172334;
  cursor: pointer;
}

.science-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.science-fullscreen {
  border-color: rgba(235,205,142,.55) !important;
  color: var(--accent2) !important;
}

.science-controls button:last-child {
  justify-self: stretch;
}

.science-controls button:disabled {
  opacity: .4;
  cursor: default;
}

.science-counter {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.separator {
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
  margin: 32px 0 24px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  container: contact-area / inline-size;
}

.contact {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 14px;
  padding: 11px 0;
  margin-left: 0;
  transition: .18s ease;
}

.icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(217,185,119,.26);
  background: rgba(217,185,119,.07);
  color: var(--accent2);
  flex: 0 0 auto;
}

.contact small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
  letter-spacing: .03em;
}

.contact span {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.contact > :last-child {
  min-width: 0;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  border: 0;
  border-radius: 15px;
  min-height: 50px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

@media (hover: hover) and (pointer: fine) {
  .contact:hover,
  .social-links a:hover {
    background: rgba(255,255,255,.09);
  }

  .btn:hover { transform: translateY(-2px); }
}

.btn.primary {
  color: #10151c;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  box-shadow: 0 12px 28px rgba(217,185,119,.18);
}

.btn.secondary {
  color: var(--text);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
}

.btn.full {
  grid-column: 1 / -1;
}

.social {
  margin-top: 28px;
}

.social h2 {
  margin: 0 0 12px;
  color: var(--accent2);
  font-size: 15px;
  line-height: 1.4;
}

.social-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  container: contact-area / inline-size;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.social-links svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--accent2);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@container contact-area (max-width: 385px) {
  .contact {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 0;
  }

  .contact span {
    font-size: 13px;
  }

  .social-links a {
    flex-direction: column;
    justify-content: center;
    min-height: 58px;
    padding: 7px 4px;
    gap: 4px;
    text-align: center;
  }
}

.footer {
  margin-top: 28px;
  color: rgba(190,200,213,.78);
  font-size: 12px;
  letter-spacing: .04em;
}

@media (max-width: 820px) {
  body {
    display: block;
    padding: 0;
    background: #08111f;
  }

  .shell {
    width: 100%;
  }

  .shell::before, .shell::after {
    display: none;
  }

  .card {
    display: block;
    border: 0;
    border-radius: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #0a1524, #08111f);
    box-shadow: none;
  }

  .portrait-wrap {
    min-height: 0;
    height: min(72vh, 690px);
    height: min(72svh, 690px);
  }

  .portrait {
    min-height: 0;
    height: 100%;
    object-position: center 14%;
  }

  .portrait-wrap::after {
    background: linear-gradient(
      to top,
      #0a1524 0%,
      rgba(10,21,36,.9) 9%,
      rgba(10,21,36,.48) 19%,
      rgba(10,21,36,.13) 30%,
      transparent 42%
    );
  }

  .content {
    margin-top: -45px;
    position: relative;
    z-index: 2;
    padding: 20px 22px 34px;
  }

  h1 {
    font-size: clamp(40px, 13vw, 58px);
  }
}

@media (max-width: 470px) {
  .actions {
    grid-template-columns: 1fr;
  }

  .role {
    font-size: 14px;
  }

  .profile-nav {
    gap: 7px;
  }

  .profile-nav button {
    padding: 9px 5px;
    font-size: 11px;
  }

  .science-picker {
    grid-template-columns: 1fr;
  }

  .science-controls {
    grid-template-columns: 1fr 1fr;
  }

  .science-counter {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }

  .science-fullscreen {
    grid-column: 1 / -1;
  }
}

@media (max-width: 470px), (max-height: 500px) {
  .profile-panel {
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px);
    max-height: none;
    border-radius: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-nav button,
  .contact,
  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}
