/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-w:   300px;
  --bar-h:       56px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Brand */
  --clr-accent:  #2980b9;
  --clr-accent2: #3498db;

  /* Shell theme */
  --shell-hero-base:       #2c678c;
  --shell-hero-accent:     #68a7cb;
  --shell-divider:         rgba(151, 191, 215, 0.34);
  --shell-bg-image:        url('/img/background-blue.png');
  --shell-bg-repeat:       repeat;
  --shell-bg-size:         500px 500px;
  --shell-bg-position:     0 var(--bg-y, 0px);
  --mobile-page-bg:        #0d1117;
  /* --shell-hero-base composited through --sidebar-overlay.
     Used as background-color on mobile shell elements so iOS Safari's
     dynamic chrome-color sampling picks up the darkened value. */
  --shell-hero-dark:       #2b4557;

  /* Surface */
  --clr-bg:      #0d1117;
  --clr-surface: #161b22;
  --clr-card:    #1c2330;
  --clr-border:  rgba(255, 255, 255, 0.08);

  /* Text */
  --clr-text:    #e6edf3;
  --clr-muted:   #8b949e;
  --clr-link:    #58a6ff;

  /* Sidebar overlay */
  --sidebar-overlay: rgba(8, 18, 32, 0.68);

  /* Motion */
  --t: 0.25s ease;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

html, body {
  height: 100%;
  background-color: var(--shell-hero-base);
  background-image: var(--shell-bg-image);
  background-repeat: var(--shell-bg-repeat);
  background-size: var(--shell-bg-size);
  background-position: var(--shell-bg-position);
  animation: bgscroll 12s linear infinite;
  color: var(--clr-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img     { display: block; user-select: none; }
button  { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
a       { color: var(--clr-link); text-decoration: none; }
a:hover { text-decoration: underline; }
#mobile-spill { display: none; }

/* =====================================================
   APP GRID
   ===================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "sidebar content";
  height: 100vh;
  overflow: hidden;
}


/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
  grid-area: sidebar;
  background-color: var(--shell-hero-base);
  background-image: var(--shell-bg-image);
  background-repeat: var(--shell-bg-repeat);
  background-size: var(--shell-bg-size);
  background-position: var(--shell-bg-position);
  animation: bgscroll 12s linear infinite;
  overflow: hidden;
  border-right: 1px solid var(--shell-divider);
}

@keyframes bgscroll {
  from { background-position: 0 var(--bg-y, 0px); }
  to   { background-position: 500px var(--bg-y, 0px); }
}

@keyframes bgscroll-overlay {
  from { background-position: 0 0, 0 var(--bg-y, 0px); }
  to   { background-position: 0 0, 500px var(--bg-y, 0px); }
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 2rem 1.5rem 1.5rem;
  background: var(--sidebar-overlay);
}

/* Profile block */
.profile-block {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 1.25rem;
}

.avatar-wrap {
  width: 168px;
  height: 168px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.05;
  color: #fff;
  letter-spacing: -0.02em;
}

.email-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.35rem 0.7rem;
  transition: background var(--t), color var(--t);
}

.email-link:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  text-decoration: none;
}

/* Sidebar navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  border-left: 3px solid transparent;
  text-align: left;
  transition: color var(--t), background var(--t), border-color var(--t);
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  text-decoration: none;
}

.nav-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-left-color: #fff;
}

.nav-btn svg { flex-shrink: 0; }

/* Social links */
.social-links {
  display: flex;
  gap: 0.6rem;
  padding-top: 1.25rem;
  margin-top: auto;
  border-top: 1px solid var(--clr-border);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: color var(--t), background var(--t);
}

.social-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  text-decoration: none;
}

/* =====================================================
   TOP BAR
   ===================================================== */
.topbar {
  grid-area: topbar;
  display: none;
  align-items: center;
  gap: 0;
  padding: 0;
  position: relative;
  background-color: var(--shell-hero-base);
  background-image: var(--shell-bg-image);
  background-repeat: var(--shell-bg-repeat);
  background-size: var(--shell-bg-size);
  background-position: var(--shell-bg-position);
  animation: bgscroll 12s linear infinite;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 10;
  overflow: hidden;
}

.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--sidebar-overlay);
  pointer-events: none;
}

.topbar-hero-wrap,
.topbar-compact-wrap,
.topbar-left,
.topbar-nav,
.topbar-social {
  position: relative;
  z-index: 1;
}


/* Profile button in topbar */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 1rem;
  height: 100%;
  flex-shrink: 0;
  border-right: 1px solid var(--shell-divider);
  transition: background var(--t);
}

.topbar-left:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.avatar-mini {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: block;
  flex-shrink: 0;
}

.topbar-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

/* Topbar navigation tabs — hidden by default (desktop uses sidebar nav).
   On mobile this element lives outside #topbar as a direct .app child so
   position:sticky works across the full unified scroll. */
.topbar-nav {
  display: none;
  align-items: stretch;
}

.tab {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t);
}

.tab:hover {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.tab.active {
  color: #fff;
  border-bottom-color: var(--shell-hero-accent);
}

/* Social icons in topbar */
.topbar-social {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  flex-shrink: 0;
  border-left: 1px solid var(--shell-divider);
}

.topbar-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.45);
  transition: color var(--t);
}

.topbar-social a:hover {
  color: #fff;
  text-decoration: none;
}

/* =====================================================
   CONTENT AREA
   ===================================================== */
.content {
  grid-area: content;
  position: relative;
  overflow: hidden;
  background: var(--clr-bg);
}

/* Each section is stacked in the same space; only .active is visible */
.section {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.section.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── About / text sections ── */
.section-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 3.5rem 2.5rem 4rem;
}

.section-inner--wide {
  max-width: 960px;
}

.section-inner h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.75rem;
  color: #fff;
}

.section-inner h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.35rem;
  color: #fff;
}

.section-sub {
  color: var(--clr-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.section-sub a {
  color: var(--clr-muted);
}

.section-sub a:hover {
  color: var(--clr-link);
}

.section-inner p {
  font-size: 1.05rem;
  line-height: 1.78;
  color: #c9d1d9;
  margin-bottom: 1.2rem;
}

.section-inner a {
  color: var(--clr-link);
}

.farewell {
  font-weight: 600 !important;
  font-size: 1.15rem !important;
  color: #fff !important;
  margin-top: 1.5rem !important;
}

/* ── GitHub repo grid ── */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

a.repo-card {
  display: flex;
  flex-direction: column;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  padding: 1rem 1.15rem 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t), background var(--t);
}

a.repo-card:hover {
  border-color: var(--clr-accent2);
  background: var(--clr-card);
  text-decoration: none;
}

.repo-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--clr-link);
  margin-bottom: 0.4rem;
}

.repo-desc {
  font-size: 0.82rem;
  color: var(--clr-muted);
  line-height: 1.5;
  margin-bottom: 0.85rem;
  flex: 1;
}

.repo-meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.77rem;
  color: var(--clr-muted);
}

.repo-lang {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lang-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  flex-shrink: 0;
}

.status-msg {
  color: var(--clr-muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.status-msg a {
  color: var(--clr-link);
}

/* ── Resume iframe ── */
.resume-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.resume-wrap iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  display: block;
}

/* =====================================================
   PORTFOLIO CARDS
   ===================================================== */
.portfolio-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2.5rem 4rem;
}

.portfolio-intro {
  margin-bottom: 1.75rem;
}

.portfolio-intro h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.35rem;
  color: #fff;
}

.portfolio-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--clr-border);
}

/* ── Project card ── */
.pcard {
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
}

.pcard:last-child {
  border-bottom: none;
}

.pcard-header {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background var(--t);
}

.pcard-header:hover,
.pcard.is-open .pcard-header {
  background: rgba(255, 255, 255, 0.03);
}

/* Colored left accent bar */
.pcard-accent {
  width: 4px;
  align-self: stretch;
  background: var(--card-color);
  flex-shrink: 0;
}

/* Pixel-art icon tile */
.pcard-icon {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.pcard-icon svg {
  width: 100%;
  height: 100%;
}

/* Title / subtitle / tags */
.pcard-info {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 0.75rem;
}

.pcard-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.pcard-subtitle {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--clr-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

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

.ptag {
  font-size: 0.67rem;
  font-weight: 500;
  padding: 0.1rem 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--clr-muted);
  border: 1px solid var(--clr-border);
  letter-spacing: 0.02em;
}

/* Org + period (right-aligned) */
.pcard-meta {
  padding: 0.5rem 0.5rem 0.5rem 0;
  text-align: right;
  flex-shrink: 0;
}

.pcard-org {
  font-size: 0.77rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.pcard-period {
  font-size: 0.72rem;
  color: var(--clr-muted);
  margin-top: 0.2rem;
  white-space: nowrap;
}

/* Expand / collapse chevron */
.pcard-chevron {
  padding: 0 0.85rem;
  color: var(--clr-muted);
  flex-shrink: 0;
  transition: transform var(--t), color var(--t);
}

.pcard.is-open .pcard-chevron {
  transform: rotate(180deg);
  color: var(--card-color, var(--clr-accent2));
}

/* Expandable body — CSS grid 0fr → 1fr trick */
.pcard-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.pcard.is-open .pcard-body {
  grid-template-rows: 1fr;
}

.pcard-body-inner {
  overflow: hidden;
}

.pcard-content {
  padding: 1.25rem 1.25rem 1.5rem 4.75rem;
  border-top: 1px solid var(--clr-border);
}

/* Bullet list */
.pcard-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pcard-bullets li {
  font-size: 0.875rem;
  color: #c9d1d9;
  line-height: 1.68;
  padding-left: 1.2rem;
  position: relative;
}

.pcard-bullets li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--card-color, var(--clr-accent2));
  font-weight: 600;
}

/* External links row */
.pcard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.1rem;
}

.pcard-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--card-color, var(--clr-link));
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.pcard-link:hover {
  border-bottom-color: var(--card-color, var(--clr-link));
  text-decoration: none;
}

/* ── Sub-items (nested collapsibles inside a card) ── */
.sub-items {
  margin-top: 1.25rem;
  border: 1px solid var(--clr-border);
  border-left: 3px solid var(--card-color, var(--clr-accent));
}

.sub-item {
  border-bottom: 1px solid var(--clr-border);
}

.sub-item:last-child {
  border-bottom: none;
}

.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s;
}

.sub-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sub-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.sub-chevron {
  color: var(--clr-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sub-item.is-open .sub-chevron {
  transform: rotate(90deg);
}

.sub-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.sub-item.is-open .sub-body {
  grid-template-rows: 1fr;
}

.sub-body-inner {
  overflow: hidden;
}

.sub-body-inner p {
  font-size: 0.845rem;
  color: var(--clr-muted);
  line-height: 1.65;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0;
}

.sub-body-inner p + p {
  padding-top: 0;
}

/* ── Mobile-only topbar hero elements (desktop: topbar is hidden, so these are never seen) ── */
.topbar-hero-wrap,
.topbar-compact-wrap { display: none; }

.sticky-header { display: none; }


.avatar-hero {
  display: block;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

/* =====================================================
   RESPONSIVE — MOBILE
   ===================================================== */
@media (max-width: 767px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--mobile-page-bg);
    background-image: none;
    animation: none;
  }

  /* Canvas background (html) must match the darkened hero so the iOS
     top-spill / overscroll area shows the right color.  body stays dark
     to cover section content. */
  html {
    background-color: var(--shell-hero-dark);
  }

  :root {
    --mobile-hero-h: auto;
    --mobile-fixed-header-h: calc(var(--safe-top) + (var(--bar-h) * 2) + 2px);
    --mobile-shell-spill-h: max(var(--mobile-fixed-header-h), 11rem);
    --hero-pad-x: clamp(1rem, 4.2vw, 1.5rem);
    --hero-pad-top: clamp(1rem, 3.8vw, 1.35rem);
    --hero-pad-bottom: clamp(0.78rem, 2.5vw, 0.98rem);
    --hero-avatar-size: clamp(90px, 25.5vw, 114px);
    --hero-gap-x: clamp(0.92rem, 2.7vw, 1.26rem);
    --hero-gap-y: clamp(0.44rem, 1.9vw, 0.72rem);
    --hero-name-size: clamp(2.1rem, 9vw, 2.5rem);
  }

  body {
    position: relative;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0 0 auto;
    height: var(--mobile-shell-spill-h);
    background-color: var(--shell-hero-dark);
    background-image:
      linear-gradient(var(--sidebar-overlay), var(--sidebar-overlay)),
      var(--shell-bg-image);
    background-repeat: no-repeat, var(--shell-bg-repeat);
    background-size: auto, var(--shell-bg-size);
    background-position: 0 0, var(--shell-bg-position);
    animation: bgscroll-overlay 12s linear infinite;
    pointer-events: none;
    z-index: 0;
  }

  /* ── Mobile spill: real DOM element for iOS Safari chrome-color sampling.
     Safari ignores pseudo-elements and non-fixed elements for dynamic
     chrome tinting.  This thin fixed layer sits behind the status bar at
     the highest z-index so Safari always samples --shell-hero-dark,
     regardless of scroll position or active section.  It only covers the
     safe-area inset so it never obscures page content. ── */
  #mobile-spill {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background-color: var(--shell-hero-dark);
    background-image:
      linear-gradient(var(--sidebar-overlay), var(--sidebar-overlay)),
      var(--shell-bg-image);
    background-repeat: no-repeat, var(--shell-bg-repeat);
    background-size: auto, var(--shell-bg-size);
    background-position: 0 0, var(--shell-bg-position);
    animation: bgscroll-overlay 12s linear infinite;
    pointer-events: none;
    z-index: 9999;
  }

  /* ── App: plain block flow on mobile to keep sticky behavior reliable
     across iOS browsers. ── */
  .app {
    display: block !important;
    min-height: 100svh;
    height: auto;
    overflow: visible;
    position: relative;
    z-index: 1;
  }

  .sidebar { display: none !important; }

  /* ── Content: normal document flow on mobile so Safari can collapse
     its browser chrome and let the shell background bleed into the top. ── */
  .content {
    min-height: 100svh;
    overflow: visible;
    padding-bottom: 0;
    background: transparent;
  }

  /* ── Hero (topbar): block element, scrolls away naturally.
     The overlay is baked into the background-image stack (not a ::before)
     so that iOS Safari's chrome-color sampling sees the darkened value. ── */
  .topbar {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    padding-top: var(--safe-top);
    border-bottom: none;
    background-color: var(--shell-hero-dark);
    background-image:
      linear-gradient(var(--sidebar-overlay), var(--sidebar-overlay)),
      var(--shell-bg-image);
    background-repeat: no-repeat, var(--shell-bg-repeat);
    background-size: auto, var(--shell-bg-size);
    background-position: 0 0, var(--shell-bg-position);
    animation: bgscroll-overlay 12s linear infinite;
    --bg-y: 0px;
  }

  .topbar::before {
    content: none;
  }

  .topbar-hero-wrap {
    display: block;
    height: auto;
    position: relative;
    overflow: hidden;
  }

  .topbar-hero {
    display: grid;
    grid-template-columns: var(--hero-avatar-size) max-content;
    grid-template-areas:
      "avatar name"
      "social social";
    align-items: center;
    justify-content: center;
    align-content: start;
    column-gap: var(--hero-gap-x);
    row-gap: var(--hero-gap-y);
    height: auto;
    width: 100%;
    padding: var(--hero-pad-top) var(--hero-pad-x) var(--hero-pad-bottom);
  }

  .avatar-hero {
    grid-area: avatar;
    width: var(--hero-avatar-size);
    height: var(--hero-avatar-size);
    flex-shrink: 0;
  }

  .hero-name {
    grid-area: name;
    font-size: var(--hero-name-size);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    line-height: 1.01;
    text-align: left;
    width: max-content;
    max-width: 100%;
    min-width: 0;
  }

  .hero-social-row {
    grid-area: social;
    justify-self: stretch;
    width: auto;
  }

  .hero-social-row.social-links {
    margin-top: 0.1rem;
    padding-top: 0;
    border-top: none;
    gap: 0.52rem;
    align-items: center;
  }

  .hero-social-row.social-links .social-link {
    width: 34px;
    height: 34px;
  }

  .hero-social-row .hero-email-inline {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
  }

  .hero-social-row .hero-email-inline #email-text-topbar {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-social-row .hero-email-inline.hero-email-inline--icon-only {
    justify-content: center;
    padding: 0;
    gap: 0;
  }

  .hero-social-row .hero-email-inline.hero-email-inline--icon-only #email-text-topbar {
    display: none;
  }

  /* ── Mobile header: normal flow while the hero is visible, then fixed
     once the compact state fully takes over.  Overlay is baked into the
     background stack (same rationale as .topbar above). ── */
  .sticky-header {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 20;
    padding-top: calc(var(--safe-top) * var(--compact-progress, 0));
    --bg-y: 0px;
    background-color: var(--shell-hero-dark);
    background-image:
      linear-gradient(var(--sidebar-overlay), var(--sidebar-overlay)),
      var(--shell-bg-image);
    background-repeat: no-repeat, var(--shell-bg-repeat);
    background-size: auto, var(--shell-bg-size);
    background-position: 0 0, var(--shell-bg-position);
    animation: bgscroll-overlay 12s linear infinite;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .app.app--mobile-header-fixed .sticky-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
  }

  .sticky-header::before {
    content: none;
  }

  .topbar-compact-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.62rem;
    height: calc(var(--bar-h) * var(--compact-progress, 0));
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, calc(0.10 * var(--compact-progress, 0)));
  }

  .topbar-left {
    height: var(--bar-h);
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 0.35rem;
    border-right: none;
    border-bottom: none;
    opacity: var(--compact-progress, 0);
    transform: translateY(calc((1 - var(--compact-progress, 0)) * -6px));
    transition: opacity 0.16s linear, transform 0.16s ease-out;
    pointer-events: none;
  }

  .avatar-mini {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: block;
    flex-shrink: 0;
  }

  .topbar-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-compact-social {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    opacity: var(--compact-progress, 0);
    transform: translateY(calc((1 - var(--compact-progress, 0)) * -6px));
    transition: opacity 0.16s linear, transform 0.16s ease-out;
    pointer-events: none;
  }

  .topbar-compact-social .topbar-compact-social-link {
    width: 30px;
    height: 30px;
  }

  .topbar-compact-social .topbar-compact-social-link svg {
    width: 15px;
    height: 15px;
  }

  .sticky-header.hero-hidden .topbar-left {
    pointer-events: auto;
  }

  .sticky-header.hero-hidden .topbar-compact-social {
    pointer-events: auto;
  }

  .app.app--resume-compact .topbar {
    display: none !important;
  }

  .app.app--resume-compact .sticky-header {
    padding-top: var(--safe-top);
    background-color: var(--shell-hero-dark);
    background-image:
      linear-gradient(var(--sidebar-overlay), var(--sidebar-overlay)),
      var(--shell-bg-image);
    background-repeat: no-repeat, var(--shell-bg-repeat);
    background-size: auto, var(--shell-bg-size);
    background-position: 0 0, var(--shell-bg-position);
    animation: bgscroll-overlay 12s linear infinite;
  }

  .app.app--resume-compact .topbar-compact-wrap {
    height: var(--bar-h);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  }

  .app.app--resume-compact .topbar-left,
  .app.app--resume-compact .topbar-compact-social {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .topbar-social { display: none; }

  .topbar-nav {
    display: flex;
    flex: none;
    height: var(--bar-h);
    width: 100%;
  }

  .tab {
    position: relative;
    z-index: 1;
    padding: 0 0.65rem;
    font-size: 0.8rem;
  }

  /* ── Sections: static block elements flowing below the sticky nav.
     min-height ensures short-content sections (e.g. About) always have enough
     height for #content to scroll by topbar.offsetHeight so the hero can be
     dismissed even when the text is brief. ── */
  .section {
    position: relative;
    display: none;
    opacity: 1;
    pointer-events: auto;
    min-height: calc(100dvh - var(--bar-h) - var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--clr-bg);
  }

  .section.active {
    display: block;
  }

  .app.app--mobile-header-fixed .section.active {
    padding-top: var(--mobile-fixed-header-h);
  }

  #section-greece {
    background: #f5f0e8;
  }

  /* Resume: explicit height so the iframe fills the viewport below the nav ── */
  #section-resume {
    min-height: 0;
    height: calc(100dvh - (var(--bar-h) * 2) - var(--safe-bottom));
    padding-bottom: 0;
  }

  .app.app--mobile-header-fixed #section-resume {
    padding-top: 0;
    min-height: calc(100dvh - var(--safe-bottom));
    height: auto;
  }

  .app.app--mobile-header-fixed #section-resume .resume-wrap {
    margin-top: var(--mobile-fixed-header-h);
    height: calc(100dvh - var(--mobile-fixed-header-h) - var(--safe-bottom));
  }

  /* ── Content padding ── */
  .section-inner {
    padding: 2rem 1.25rem 3rem;
  }

  .section-inner h1 { font-size: 1.75rem; }
  .section-inner h2 { font-size: 1.5rem; }
  .section-inner p  { font-size: 1rem; }

  .repo-grid {
    grid-template-columns: 1fr;
  }

  /* Portfolio cards on mobile */
  .portfolio-wrap {
    padding: 1.5rem 0 3rem;
  }

  .portfolio-intro {
    padding: 0 1.25rem;
  }

  .pcard-meta { display: none; }

  .pcard-icon {
    width: 56px;
    height: 56px;
  }

  .pcard-content {
    padding: 1rem 1rem 1.25rem 1rem;
  }
}

@media (max-width: 400px) {
  .tab {
    position: relative;
    z-index: 1;
    padding: 0 0.45rem;
    font-size: 0.75rem;
  }
}
