/* ==========================================================================
   K.M. Naimuddin — portfolio
   No framework, no preprocessor. Edit this file directly.
   ========================================================================== */

/* --- tokens ------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --surface: #f6f8f9;
  --surface-2: #eef2f4;
  --border: #e1e6ea;
  --text: #12171c;
  --muted: #5c6875;
  --accent: #0b7285;
  --accent-hover: #095c6b;
  --accent-wash: #e6f4f7;
  --shadow: 0 1px 2px rgb(18 23 28 / 6%), 0 8px 24px rgb(18 23 28 / 6%);
  --shadow-lift: 0 2px 4px rgb(18 23 28 / 8%), 0 16px 40px rgb(18 23 28 / 12%);

  --max: 1080px;
  --gap: 1.5rem;
  --radius: 12px;
  --radius-sm: 7px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo,
    Consolas, monospace;

  /* Accent trio driving the hero gradient, the role words and the pillar icons.
     Kept dark enough in light mode to stay readable on white. */
  --g-a: #0b7285;
  --g-b: #5b35c6;
  --g-c: #b8246b;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c242e;
  --border: #263039;
  --text: #e4ebf2;
  --muted: #94a3b3;
  --accent: #3bc4de;
  --accent-hover: #63d3e8;
  --accent-wash: #10333c;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 50%), 0 16px 40px rgb(0 0 0 / 45%);

  --g-a: #3bc4de;
  --g-b: #9b7bff;
  --g-c: #ff6fae;
}

/* --- reset -------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  font-weight: 650;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0.5rem;
}

/* --- layout primitives -------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

section {
  padding-block: 4.5rem;
  scroll-margin-top: 5rem;
}

section.alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section-head {
  margin-bottom: 2.5rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.section-head h2 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

.section-head p {
  color: var(--muted);
  max-width: 58ch;
  margin: 0;
}

/* --- header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 4rem;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand:hover {
  text-decoration: none;
  color: var(--text);
}

.brand .mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a.current {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

#nav-toggle {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}
:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}
.theme-icon-sun {
  display: none;
}
.theme-icon-moon {
  display: block;
}

/* --- buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 550;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg);
}

.btn-ghost:hover {
  border-color: var(--muted);
  color: var(--text);
  background: var(--surface);
}

.btn svg {
  width: 1rem;
  height: 1rem;
}

/* --- hero --------------------------------------------------------------- */

.hero {
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3.1rem);
  margin-bottom: 0.75rem;
}

.hero .lede {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 52ch;
}

.hero .role {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--accent);
  background: var(--accent-wash);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.hero .role .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.75rem;
}

/* --- identity chips + stat row ----------------------------------------- */

.identity {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.identity li {
  font-size: 0.8rem;
  font-weight: 550;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.identity li:first-child {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.stat-row li {
  display: flex;
  flex-direction: column;
}

.stat-row strong {
  font-size: 1.4rem;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-row span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* --- portrait ----------------------------------------------------------
   A squircle behind a gradient ring, with an offset outline echoing it and a
   soft accent glow underneath. Decorative layers are spans, not pseudo-elements
   on the image, so the img itself stays a plain replaced element.
   --------------------------------------------------------------------- */

.portrait {
  position: relative;
  width: clamp(200px, 27vw, 280px);
  aspect-ratio: 1;
  flex-shrink: 0;
}

/* The photo is a circular composition on white, so the frame is a circle too —
   a squircle would leave white wedges in the corners and clip the blue rings. */
.portrait-echo {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.35;
  transform: scale(1.075);
}

.portrait-echo::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  opacity: 0.16;
  z-index: -1;
}

.portrait-ring {
  position: relative;
  display: block;
  height: 100%;
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(
    from 210deg,
    var(--accent),
    #7c5cff 28%,
    var(--accent-hover) 55%,
    transparent 76%,
    var(--accent) 100%
  );
}

.portrait-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.portrait-badge {
  position: absolute;
  left: 50%;
  bottom: -0.75rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  font-weight: 600;
}

.pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 0 rgb(34 160 107 / 60%);
  animation: pulse 2.4s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 0.55rem rgb(34 160 107 / 0%); }
  100% { box-shadow: 0 0 0 0 rgb(34 160 107 / 0%); }
}

.socials {
  display: flex;
  gap: 0.4rem;
  margin-top: 1.5rem;
}

.socials a {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  border: 1px solid transparent;
}

.socials a:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.socials svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* --- about -------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.about-grid p:last-child {
  margin-bottom: 0;
}

.facts {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.35rem 1.15rem;
}

.facts li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.facts li:last-child {
  border-bottom: 0;
}

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

.facts .v {
  text-align: right;
  font-weight: 550;
}

/* --- languages ---------------------------------------------------------- */

.lang-list {
  display: grid;
  /* 460px is wide enough that three never fit, so this tops out at two columns. */
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 0.75rem;
}

.lang {
  display: grid;
  grid-template-columns: 6.5rem auto 1fr;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.92rem;
}

.lang .name {
  font-weight: 600;
}

.lang .cefr {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--accent);
  letter-spacing: 0.02em;
}

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

/* --- skills ------------------------------------------------------------- */

.skill-groups {
  display: grid;
  /* min() keeps the track from forcing horizontal scroll on a 320px phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 1.25rem;
}

.skill-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 1.25rem;
}

.skill-group h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.9rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.82rem;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

/* --- timeline ----------------------------------------------------------- */

.timeline {
  display: grid;
  gap: 0;
}

.tl-item {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.75rem;
  padding-block: 1.6rem;
  border-top: 1px solid var(--border);
}

.tl-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.tl-date {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.tl-body h3 {
  font-size: 1.08rem;
  margin-bottom: 0.15rem;
}

.tl-org {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.tl-org .sep {
  opacity: 0.5;
  margin-inline: 0.35rem;
}

.tl-body ul {
  display: grid;
  gap: 0.35rem;
}

.tl-body li {
  position: relative;
  padding-left: 1.05rem;
  font-size: 0.94rem;
  color: var(--muted);
}

.tl-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
}

.tl-body .tags {
  margin-top: 0.85rem;
}

.note {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.9rem;
  max-width: 78ch;
}

.quiet {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}

.skill-group.span-2 {
  grid-column: span 2;
}

/* --- research ----------------------------------------------------------- */

.paper {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.paper + .paper {
  margin-top: 1.25rem;
}

/* Alternate the image side so a stack of papers doesn't read as a column. */
.paper.flip .paper-body {
  order: 2;
}

.paper-status .pulse {
  background: #22a06b;
  box-shadow: 0 0 0 0 rgb(34 160 107 / 60%);
}

.paper-status.in-progress .pulse {
  background: #d97706;
  box-shadow: 0 0 0 0 rgb(217 119 6 / 60%);
  animation-name: pulse-amber;
}

@keyframes pulse-amber {
  70% { box-shadow: 0 0 0 0.55rem rgb(217 119 6 / 0%); }
  100% { box-shadow: 0 0 0 0 rgb(217 119 6 / 0%); }
}

.paper-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.paper-body h3 {
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  margin-bottom: 0.5rem;
}

.paper-authors {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.paper-authors strong {
  color: var(--text);
  font-weight: 600;
}

.paper-body > p {
  font-size: 0.95rem;
  color: var(--muted);
}

.paper-body .tags {
  margin-bottom: 1.25rem;
}

.paper-media img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

/* --- references --------------------------------------------------------- */

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 1rem;
}

.ref {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 1.25rem;
  border-left: 3px solid var(--accent);
}

.ref-name {
  font-weight: 640;
  font-size: 0.98rem;
  margin-bottom: 0.3rem;
}

.ref-role {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* --- certificate without an image --------------------------------------- */

.cert-plate {
  display: grid;
  place-items: center;
  aspect-ratio: 800 / 618;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-wash), var(--surface-2));
  color: var(--accent);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Placeholder for a URL that still has to be filled in. */
.needs-link {
  border: 1px dashed #d97706 !important;
  color: #b45309 !important;
  background: rgb(217 119 6 / 8%) !important;
  cursor: help;
}

.needs-link:hover {
  color: #92400e !important;
  text-decoration: none;
}

:root[data-theme="dark"] .needs-link {
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  background: rgb(245 158 11 / 10%) !important;
}

/* Placeholder styling — anything wearing this needs real content before launch. */
.needs-input {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border: 1px dashed #d97706;
  border-radius: 4px;
  background: rgb(217 119 6 / 8%);
  color: #b45309;
  font-size: 0.82rem;
  font-style: normal;
}

:root[data-theme="dark"] .needs-input {
  border-color: #f59e0b;
  color: #fbbf24;
  background: rgb(245 158 11 / 10%);
}

/* --- two-column sub-blocks --------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: 3rem;
}

.split h3.block-title,
h3.block-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.5rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.plain-list li strong {
  color: var(--text);
  font-weight: 550;
}

.plain-list .when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

/* --- projects ----------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.75rem;
}

.chip {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 500;
  transition: all 0.15s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--muted);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.project-grid {
  display: grid;
  /* 360px lands on a 2x2 grid at full width, which suits four projects. */
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--muted);
}

.card[hidden] {
  display: none;
}

.card-media {
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-media img {
  transform: scale(1.04);
}

.card-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.card-body p {
  font-size: 0.9rem;
  color: var(--muted);
  flex: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a06b;
}

.card .tags {
  margin-bottom: 1rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.card-actions .btn {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

/* --- modal -------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  padding: 1rem;
  overflow-y: auto;
  background: rgb(10 14 18 / 60%);
  backdrop-filter: blur(3px);
}

.modal.open {
  display: block;
}

.modal-panel {
  position: relative;
  width: min(880px, 100%);
  margin: 3rem auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.modal-panel h2 {
  font-size: 1.4rem;
  padding-right: 2.5rem;
}

.modal-meta {
  display: grid;
  gap: 0.5rem;
  margin-block: 1.25rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
}

.modal-meta .row {
  display: flex;
  gap: 0.6rem;
}

.modal-meta .row > span:first-child {
  color: var(--muted);
  min-width: 5rem;
  flex-shrink: 0;
}

.shots {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.shots img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* --- certificates ------------------------------------------------------- */

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  gap: 1.1rem;
}

.cert {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
}

.cert:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cert img {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.cert .cert-body {
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.cert .cert-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.cert .cert-issuer {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: auto;
}

.cert a.verify {
  font-size: 0.8rem;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.cert a.verify svg {
  width: 0.8rem;
  height: 0.8rem;
}

/* --- contact ------------------------------------------------------------ */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 1.25rem;
}

.contact-card .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.contact-card .value {
  font-size: 0.9rem;
  font-weight: 550;
  /* Break only when a word genuinely cannot fit, so the email stays readable. */
  overflow-wrap: break-word;
}

.cta-band {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}

.cta-band h3 {
  font-size: 1.25rem;
}

.cta-band p {
  color: var(--muted);
  max-width: 46ch;
  margin-inline: auto;
}

/* --- footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  font-size: 0.87rem;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

/* --- chat widget -------------------------------------------------------- */

.chat-launch {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 550;
  box-shadow: var(--shadow-lift);
}

.chat-launch:hover {
  background: var(--accent-hover);
}

.chat-launch svg {
  width: 1.05rem;
  height: 1.05rem;
}

.chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 130;
  width: min(370px, calc(100vw - 2.5rem));
  height: min(520px, calc(100vh - 3rem));
  display: none;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.chat-panel.open {
  display: flex;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.chat-head .avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.chat-head .who {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
}

.chat-head .status {
  font-size: 0.75rem;
  color: var(--muted);
}

.chat-head button {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 5px;
}

.chat-head button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  font-size: 0.89rem;
  line-height: 1.5;
}

.msg.bot {
  align-self: flex-start;
  background: var(--surface-2);
  border-bottom-left-radius: 3px;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.msg a {
  color: inherit;
  text-decoration: underline;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 1rem 0.75rem;
}

.chat-suggestions button {
  font-size: 0.79rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}

.chat-suggestions button:hover {
  color: var(--text);
  border-color: var(--accent);
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.89rem;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-form button {
  display: grid;
  place-items: center;
  width: 2.3rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
}

.chat-form button:hover {
  background: var(--accent-hover);
}

.chat-form svg {
  width: 1rem;
  height: 1rem;
}

/* --- hero opening ------------------------------------------------------- */

.greeting {
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.name-xl {
  font-size: clamp(2.5rem, 7.5vw, 4.25rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: 0.6rem;
  /* Fallback for anything without background-clip: text. */
  color: var(--text);
  background: linear-gradient(100deg, var(--g-a) 0%, var(--g-b) 48%, var(--g-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@supports not (background-clip: text) {
  .name-xl {
    -webkit-text-fill-color: currentColor;
  }
}

.tagline {
  font-size: clamp(1.05rem, 2.6vw, 1.45rem);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.tagline em {
  font-style: normal;
  font-weight: 650;
  position: relative;
  white-space: nowrap;
}

.tagline em::after {
  content: "";
  position: absolute;
  left: -0.1em;
  right: -0.1em;
  bottom: -0.05em;
  height: 0.4em;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.14;
  z-index: -1;
}

.tagline .c1 { color: var(--g-a); }
.tagline .c2 { color: var(--g-b); }
.tagline .c3 { color: var(--g-c); }

.highlight {
  position: relative;
  max-width: 56ch;
  padding: 1.1rem 1.25rem 1.1rem 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(
    115deg,
    color-mix(in srgb, var(--g-a) 9%, transparent),
    color-mix(in srgb, var(--g-b) 7%, transparent) 55%,
    transparent
  );
  border: 1px solid var(--border);
}

.highlight::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(var(--g-a), var(--g-b), var(--g-c));
}

.highlight p {
  margin: 0;
  font-size: 1.02rem;
  color: var(--muted);
}

.highlight b {
  color: var(--text);
  font-weight: 620;
}

/* --- CV dropdown -------------------------------------------------------- */

.cv-menu {
  position: relative;
}

#cv-toggle .chev {
  transition: transform 0.18s;
}

#cv-toggle[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.cv-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 60;
  width: min(330px, calc(100vw - 3rem));
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-lift);
}

.cv-list[hidden] {
  display: none;
}

.cv-list a {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.cv-list a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.cv-icon {
  font-size: 1.15rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.cv-name {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.cv-desc {
  display: block;
  font-size: 0.79rem;
  color: var(--muted);
  line-height: 1.45;
}

/* --- about pillars ------------------------------------------------------ */

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 2.75rem;
}

.pillar {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: transform 0.18s, box-shadow 0.18s;
}

.pillar:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.pillar-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.9rem;
  border-radius: 10px;
  background: var(--accent-wash);
  color: var(--accent);
}

.pillar:nth-child(2) .pillar-icon {
  background: color-mix(in srgb, var(--g-b) 14%, transparent);
  color: var(--g-b);
}

.pillar:nth-child(3) .pillar-icon {
  background: color-mix(in srgb, var(--g-c) 14%, transparent);
  color: var(--g-c);
}

.pillar-icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.pillar h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.pillar p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.pull {
  margin: 1.5rem 0;
  padding-left: 1.15rem;
  border-left: 3px solid var(--accent);
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.55;
}

/* --- skill group icons -------------------------------------------------- */

.skill-group h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.grp-icon {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 7px;
  background: var(--accent-wash);
  color: var(--accent);
  flex-shrink: 0;
}

.grp-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* --- leadership cards --------------------------------------------------- */

.lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: 1rem;
}

.lead {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  border-top: 3px solid var(--accent);
}

.lead-when {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.4rem;
}

.lead h4 {
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 0.15rem;
}

.lead-org {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.lead-desc {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

/* --- reveal on scroll --------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.shown {
  opacity: 1;
  transform: none;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 860px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }

  .portrait {
    order: -1;
    width: 150px;
    margin-bottom: 1rem;
  }

  .about-grid,
  .split,
  .paper {
    grid-template-columns: 1fr;
  }

  .paper-media {
    order: -1;
  }

  .skill-group.span-2 {
    grid-column: auto;
  }

  .stat-row {
    gap: 1.25rem 2rem;
  }

  .tl-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  #nav-toggle {
    display: grid;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1.25rem 1rem;
    box-shadow: var(--shadow);
  }

  .site-nav.open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0.1rem;
  }

  .site-nav a {
    padding: 0.6rem 0.7rem;
  }

  .lang {
    grid-template-columns: auto auto;
    row-gap: 0.3rem;
  }

  .lang .desc {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  section {
    padding-block: 3rem;
  }

  .chat-launch span {
    display: none;
  }

  .chat-launch {
    padding: 0.85rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .site-header,
  .chat-launch,
  .chat-panel,
  .filters,
  .modal {
    display: none !important;
  }
}
