:root {
  --bg: #002340;
  --card: #01334D;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --border: #034A6B;
  --accent: #7ACFCD;
  --acc2: #FFD166;
  --link: #4CC9F0;
  --shadow: 0 10px 30px rgba(0,0,0,.40);

  --liq-bg-tint: 6%;
  --liq-border: 10%;
  --liq-sheen: .08;
  --liq-caustic: .12;
  --liq-shadow: 0 8px 28px rgba(0,0,0,.35);

  --badge-size: 20px;
  --badge-gap: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

/* Header / hero */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 60px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1;
}

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

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.title {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: .2px;
}

.subtitle {
  margin: 4px 0 0 calc(20px + 8px);
  color: var(--muted);
  font-size: .98rem;
}

.name-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.header-actions a {
  text-decoration: none;
  color: var(--text) !important;
  padding: 10px 14px !important;
}

/* Buttons */
.btn {
  position: relative;
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s ease, transform .05s ease;
}

.text-color-check {
  color: var(--text) !important;
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
}

.btn:hover {
  border-color: color-mix(in oklab, var(--border), var(--text) 25%);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--acc2));
  color: #002340;
  border: none;
  font-weight: 600;
}

/* Cards & layout */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0 0 14px 0;
  font-size: 1.2rem;
  letter-spacing: .2px;
}

/* Key/value basic info */
.kv {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kv li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.kv li:last-child {
  border: none;
}

.kv a {
  color: var(--link);
  text-decoration: none;
}

.kv a:hover {
  text-decoration: underline;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  position: relative;
  overflow: hidden;
  isolation: isolate;

  font-size: .85rem;
  padding: 6px 10px;
  border-radius: 999px;

  background: color-mix(in oklab, var(--card), #fff 6%);
  border: 1px solid color-mix(in oklab, var(--border), #fff 12%);
  color: var(--text);
  backdrop-filter: blur(8px) saturate(120%);
  box-shadow: 0 6px 18px rgba(0,0,0,.18), 0 0 0 1px rgba(255,255,255,.04) inset;
}

.tag::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(to bottom, rgba(255,255,255,.10), rgba(255,255,255,0) 40%),
    radial-gradient(110% 60% at 50% -10%, rgba(255,255,255,.07), transparent 60%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.tags.compact .tag {
  font-size: .78rem;
  padding: 4px 8px;
}

.tag:hover {
  border-color: color-mix(in oklab, var(--link), #fff 24%);
  background: color-mix(in oklab, var(--link), #000 6%);
  color: var(--bg);
  box-shadow: 0 8px 22px rgba(0,0,0,.22);
}

@media (prefers-reduced-transparency: reduce) {
  .tag {
    backdrop-filter: none;
    background: color-mix(in oklab, var(--card), #fff 3%);
  }
  .tag::after { display: none; }
}

/* Lists (experience, projects, etc.) */
.list {
  display: grid;
  gap: 12px;
}

.item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in oklab, var(--card), #000 6%);
}

.item h3 {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
}

.item .meta {
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
}

.meta {
  color: var(--muted);
  font-size: .92rem;
}

/* Skills grid */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.skill-cat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: color-mix(in oklab, var(--card), #000 6%);
}

.skill-cat h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.skill-cat ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.skill-cat li + li {
  margin-top: 6px;
}

.skill-desc {
  color: var(--muted);
  font-size: .92rem;
}

/* Publications */
.pubs {
  padding-left: 0;
  list-style: none;
}

#publications #pubsList.list {
  gap: 12px;
}

.pub-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in oklab, var(--card), #000 6%);
  padding: 14px 14px 12px 14px;
}

.pub-item h3 {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
}

.pub-item .meta {
  color: var(--muted);
  font-size: .92rem;
  margin-top: 4px;
}

/* AI card styling */
.ai-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: color-mix(in oklab, var(--card), #ffffff 4%);
  border: 1px solid transparent;
  background:
    linear-gradient(0deg, color-mix(in oklab, var(--card), #ffffff 4%), color-mix(in oklab, var(--card), #ffffff 4%)) padding-box,
    linear-gradient(135deg, #7ACFCD 0%, #9B8CFF 35%, #FFD166 65%, #00FFE1 100%) border-box;
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--border), #fff 5%) inset,
    0 16px 60px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
}

.ai-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 22px;
  padding: 24px 22px;

  /* Deep, slightly vignetted base */
  background:
    radial-gradient(160% 260% at 0% 0%, #05192f 0%, #01334D 38%, #000915 100%);
  border: 1px solid rgba(124, 207, 205, .35);

  box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 0 40px rgba(0,0,0,.7),
    0 22px 60px rgba(0,0,0,.85);
}

/* Big ink blobs drifting behind the content */
.ai-card::before,
.ai-card::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 180%;
  height: 180%;
  filter: blur(55px);
  opacity: .55;
  z-index: -1;
  pointer-events: none;
  transform: translate3d(0,0,0);
  mix-blend-mode: screen;
}

/* Top-left purple/teal blob */
.ai-card::before {
  top: -40%;
  left: -20%;
  background:
    radial-gradient(60% 65% at 15% 20%, #9B8CFF 0%, transparent 65%),
    radial-gradient(50% 55% at 65% 0%, #7ACFCD 0%, transparent 70%);
  animation: inkOrbit 28s ease-in-out infinite alternate;
}

/* Bottom-right yellow/aqua blob */
.ai-card::after {
  bottom: -45%;
  right: -15%;
  background:
    radial-gradient(55% 60% at 80% 70%, #FFD166 0%, transparent 70%),
    radial-gradient(50% 55% at 20% 90%, #00FFE1 0%, transparent 70%);
  animation: inkOrbit 32s ease-in-out infinite alternate-reverse;
}

.ai-card .section-header {
  position: relative;
  z-index: 2;
}

#generateSummary {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* AI busy state */
.ai-card.ai-busy::before,
.ai-card.ai-busy::after {
  filter: blur(65px);
  opacity: .9;
  animation-duration: 14s;
}

/* Smooth orbital motion of the blobs */
@keyframes inkOrbit {
  0%   { transform: translate3d(0,0,0) rotate(0deg); }
  50%  { transform: translate3d(8px,-6px,0) rotate(6deg); }
  100% { transform: translate3d(-6px,6px,0) rotate(12deg); }
}

/* AI gradient text */
.ai-ink,
.ai-card .ai-ink {
  background: linear-gradient(135deg, #EAF7FF 0%, #C6E5FF 25%, #E6D9FF 55%, #FFF0D1 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600 !important;
}

/* AI button */
.ai-btn {
  border-color: color-mix(in oklab, var(--border), var(--text) 25%);
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  color: var(--text);
  font-weight: 600;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transition: transform .08s ease, box-shadow .2s ease, opacity .2s ease;
}

.ai-btn:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  opacity: .95;
}

.ai-btn:active {
  transform: translateY(1px);
}

.ai-btn-hero {
  position: relative;
  z-index: 2;
}

/* Halo backdrop */
.ai-btn-hero::before {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 0%, rgba(226,243,255,.32), transparent 70%),
    radial-gradient(circle at 70% 120%, rgba(0,255,225,.48), transparent 72%);
  filter: blur(10px);
  opacity: 0;
  transition: opacity .35s ease;
  z-index: -1;
}

/* When the card is “thinking”, show and pulse the halo */
.ai-card.ai-busy .ai-btn-hero::before {
  opacity: 1;
  animation: inkPulse 1.6s ease-in-out infinite;
}

/* Soft breathing motion for the halo */
@keyframes inkPulse {
  0%, 100% { transform: scale(1);   opacity: .65; }
  50%      { transform: scale(1.08); opacity: 1;  }
}

/* AI disclaimer */
.disclaimer {
  margin-top: 10px;
  font-size: .92rem;
  color: var(--muted);
  border-left: 3px solid color-mix(in oklab, var(--link), #ffffff 12%);
  padding-left: 10px;
}

/* Liquid cards / glass effect */
.liquid {
  position: relative;
  overflow: hidden;
  isolation: isolate;

  background: color-mix(in oklab, var(--card), #fff var(--liq-bg-tint));
  border: 1px solid color-mix(in oklab, var(--border), #fff var(--liq-border));
  box-shadow: var(--liq-shadow), 0 0 0 1px rgba(255,255,255,.04) inset;
  backdrop-filter: blur(10px) saturate(120%);
}

.liquid::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(255,255,255, var(--liq-sheen)), rgba(255,255,255,0) 38%),
    linear-gradient(to top, rgba(255,255,255, calc(var(--liq-sheen) * .8)), rgba(255,255,255,0) 42%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.liquid::before {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  top: -18%;
  height: 60%;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255,255,255, var(--liq-caustic)), transparent 60%);
  filter: blur(10px);
  pointer-events: none;
}

.liquid-min {
  --liq-bg-tint: 5%;
  --liq-border: 8%;
  --liq-sheen: .05;
  --liq-caustic: .08;
  --liq-shadow: 0 6px 18px rgba(0,0,0,.28);
}

.btn.liquid-btn {
  background: color-mix(in oklab, var(--card), #fff 6%);
  border: 1px solid color-mix(in oklab, var(--border), #fff 12%);
  backdrop-filter: blur(8px) saturate(120%);
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
}

.btn.liquid-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255,255,255,.10), rgba(255,255,255,0) 40%);
  pointer-events: none;
}

.btn.liquid-btn:hover {
  border-color: color-mix(in oklab, var(--border), #fff 24%);
}

.ai-card.liquid::after {
  opacity: .5;
}

@media (prefers-reduced-motion: reduce) {
  .ai-card::before,
  .ai-card::after,
  .ai-card.ai-busy::before,
  .ai-card.ai-busy::after,
  .ai-card.ai-busy .ai-btn-hero::before {
    animation: none !important;
  }
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: min(420px, calc(100% - 36px));
  border-radius: 16px;
  padding: 14px;
  z-index: 80;
  backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid color-mix(in oklab, var(--border), #fff 12%);
  background: color-mix(in oklab, var(--card), #fff 6%);
  box-shadow: 0 12px 28px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04) inset;
  overflow: hidden;
  isolation: isolate;
  animation: ccIn .25s ease both;
}

.cookie-content {
  display: grid;
  gap: 8px;
}

.cookie-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.cookie-actions .btn {
  padding: 8px 12px;
  border-radius: 12px;
}

/* Footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 24px 0 8px;
}

/* Chip links (certificates) */
.item-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .65rem;
  text-decoration: none;

  color: var(--text);
  border: 1px solid color-mix(in oklab, var(--border), #fff 16%);
  background: color-mix(in oklab, var(--card), #fff 8%);
  backdrop-filter: blur(8px) saturate(120%);
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
}

.chip-link:hover {
  border-color: color-mix(in oklab, var(--link), #fff 24%);
  background: color-mix(in oklab, var(--link), #000 10%);
  color: var(--bg);
  box-shadow: 0 8px 22px rgba(0,0,0,.32);
}

.chip-link i {
  font-size: .8rem;
  opacity: .85;
}

/* Keyframes */
@keyframes ccIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes inkFlow {
  0%   { transform: rotate(0deg) translate3d(0,0,0); }
  50%  { transform: rotate(180deg) translate3d(2px, -2px, 0); }
  100% { transform: rotate(360deg) translate3d(0,0,0); }
}

@keyframes aiFloat1 {
  0%, 100% { transform: translate3d(0,0,0) rotate(0deg); }
  50%      { transform: translate3d(8px, -6px, 0) rotate(3deg); }
}

@keyframes aiFloat2 {
  0%, 100% { transform: translate3d(0,0,0) rotate(0deg); }
  50%      { transform: translate3d(-10px, 6px, 0) rotate(-2deg); }
}

/* Responsive tweaks */
@media (max-width: 820px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kv li {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand {
    width: 100%;
    align-items: flex-start;
    gap: 8px;
  }

  .subtitle {
    margin: 4px 0 0 calc(var(--badge-size) + var(--badge-gap));
  }

  .header-actions {
    margin-left: 0;
    align-self: stretch;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 20px;
  }
}

/* =========================
   Loading page styling
   ========================= */

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;

  /* Classic site background */
  background: var(--bg);

  color: var(--text);
  opacity: 1;
  transform: translateY(0);
  transition: opacity .35s ease, transform .35s ease;
}

.page-loader--hidden {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.page-loader-shell {
  width: 100%;
  max-width: 980px;
}

/* Loader card – classic liquid look, not rainbow AI background */
.page-loader-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 22px 20px;
  border-radius: 22px;
  background: color-mix(in oklab, var(--card), #fff var(--liq-bg-tint));
  border: 1px solid color-mix(in oklab, var(--border), #fff var(--liq-border));
  box-shadow: var(--liq-shadow), 0 0 0 1px rgba(255,255,255,.04) inset;
  backdrop-filter: blur(10px) saturate(120%);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Remove AI big blobs ONLY on the loader card (keep them on the normal AI card) */
.page-loader-card::before,
.page-loader-card::after {
  content: none;
}

/* Pill button that reuses ai-btn + ai-btn-hero */
.page-loader-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 18px;
  min-height: 42px;
  font-size: .9rem;
  cursor: default;
}

/* Keep the halo animation like the Ask card */
.page-loader-card.ai-busy .ai-btn-hero::before {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 0%, rgba(226,243,255,.32), transparent 70%),
    radial-gradient(circle at 70% 120%, rgba(0,255,225,.48), transparent 72%);
  filter: blur(10px);
  opacity: 1;
  z-index: -1;
  animation: inkPulse 1.6s ease-in-out infinite;
}

/* Animated dot inside the button */
.page-loader-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #EAF7FF;
  box-shadow: 0 0 0 0 rgba(234,247,255,.6);
  animation: loaderDotPulse 1.4s ease-in-out infinite;
}

/* Hint text under the button */
.page-loader-hint {
  margin-top: 14px;
  font-size: .8rem;
}

.page-loader-hint a {
  color: var(--link);
  text-decoration: none;
}

.page-loader-hint a:hover {
  text-decoration: underline;
}

/* Dot pulsing animation */
@keyframes loaderDotPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(234,247,255,.6);
    opacity: 1;
  }
  70% {
    transform: scale(1.4);
    box-shadow: 0 0 0 10px rgba(234,247,255,0);
    opacity: .9;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(234,247,255,0);
    opacity: 1;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .page-loader,
  .page-loader-pill::before,
  .page-loader-dot {
    animation: none !important;
  }
}

.collab-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
}

.collab-dialog-backdrop[hidden] {
  display: none;
}

.collab-dialog-card {
  max-width: 440px;
  width: 100%;
}

/* Optional: small ghost button for close */
.btn.ghost.small {
  font-size: 14px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
}