/* ============================================
   COLOR PALETTE - Easy to update colors here
   ============================================ */
:root {
  --primary-dark: #1a1324;
  --secondary-dark: #241a34;
  --surface-card: #eea302;
  --text-primary: #f5f2fa;
  --text-muted: #c9bdd9;
  /* Single reserve: symmetric body padding + viewport calcs for fixed header/footer */
  /* Fits fixed header/footer box + border; raise if nav/footer clips */
  --chrome-band: 104px;
  --footer-height: var(--chrome-band);
  --header-height: var(--chrome-band);
  /* --primary-dark: #121826;
  --secondary-dark: #1B2336;
  --surface-card: #EEA302;
  --text-primary: #F4F6FB;
  --text-muted: #B8C0D4; */
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background-color: var(--primary-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-height);
  padding-bottom: var(--footer-height);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--chrome-band);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  overflow: hidden;
  background: linear-gradient(
    to bottom,
    var(--primary-dark) 100%,
    #1a1324 0%,

    transparent 100%
  );
  border-bottom: 1px solid var(--surface-card);
}

/* First screen: header + hero = one viewport (index page) */
.viewport-top {
  height: calc(100vh - var(--footer-height) - var(--header-height));
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Fixed header does not consume flex row height */
.viewport-top > header {
  flex: 0 0 0;
  min-height: 0;
  overflow: visible;
}

.viewport-top main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

nav {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
  padding: 0.15rem 0.6rem;
}

.logo-img {
  height: calc(1.25rem * 0.9);
  width: auto;
  display: block;
}

/* Desktop: match header .btn.btn-header height (.btn padding + line box + borders) */
@media (min-width: 769px) {
  html {
    height: 100%;
    overflow-y: hidden;
  }

  body {
    height: 100%;
    overflow-y: hidden;
  }

  .viewport-top {
    overflow: hidden;
  }

  main.dot-texture-bg {
    max-height: calc(100vh - var(--footer-height) - var(--header-height));
    overflow: hidden;
  }

  .logo-img {
    height: calc(0.9 * (3rem + 4px));
  }

  nav {
    flex-wrap: nowrap;
  }
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

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

.nav-toggle {
  display: none;
}

.mobile-nav-overlay {
  display: none;
}

.mobile-nav-links {
  display: none;
}

.btn-header {
  padding: 0.65rem 1.15rem;
  border-radius: 9999px;
  font-size: 0.95rem;
  line-height: 1;
}

.btn-header-cv {
  background-color: transparent;
  color: var(--text-primary);
  border: 2px solid var(--surface-card);
  border-radius: 8px;
}

/* Ensure border wins over .btn { border: none } */
header .btn-header-cv {
  border: 2px solid var(--surface-card);
}

.btn-header-cv:hover {
  background-color: var(--surface-card);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.btn-header-contact {
  background-color: var(--surface-card);
  color: var(--primary);
  border: 2px solid transparent;
}

.btn-header-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
  flex: 1;
  width: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  /* padding: 2rem; */
  align-items: center;
  justify-content: center;
  display: flex;
}

/* Portfolio: fill viewport band below fixed header; wider column for carousel */
main.dot-texture-bg > .container {
  min-height: calc(100vh - var(--footer-height) - var(--header-height));
  flex-direction: column;
  width: 100%;
  max-width: min(1500px, 96vw);
  justify-content: center;
  align-items: stretch;
}

/* ============================================
   DOT TEXTURE (hero + portfolio main)
   ============================================ */
.dot-texture-bg {
  position: relative;
  overflow: hidden;
}

/* Subtle dot texture: orange, low opacity, denser towards bottom */
.dot-texture-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: repeating-radial-gradient(
    circle at center,
    rgba(238, 163, 2, 0.14) 0px,
    transparent 1.5px
  );
  background-size: 10px 10px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 50%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 50%);
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
  pointer-events: none;
}

.dot-texture-bg .container {
  position: relative;
  z-index: 1;
}

/* Portfolio page: main section fills viewport */
main.dot-texture-bg {
  min-height: calc(100vh - var(--footer-height) - var(--header-height));
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(0.5rem, 1.5vh, 1.25rem) 1.25rem;
}

/* Home hero: fill band between header/footer; wider column than global .container */
.hero .container {
  min-height: 0;
  flex: 1;
  width: 100%;
  max-width: min(1400px, 100%);
  /* padding: 1rem 1.25rem; */
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 4rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.hero-image-wrapper {
  flex-shrink: 0;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  overflow: hidden;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.hero-text {
  flex: 1;
  text-align: left;
}

.hero-heading-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero h1 {
  font-size: 5.5rem;
  font-weight: 700;

  color: var(--text-primary);
}

.hero-heading-accent {
  background: linear-gradient(135deg, var(--surface-card), #ed8e29);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@supports not (background-clip: text) {
  .hero-heading-accent {
    background: none;
    -webkit-text-fill-color: unset;
    color: var(--surface-card);
  }
}

.hero-subtitle {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.hero-description {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--surface-card);
  color: var(--text-primary);
}

.btn-primary:hover {
  background-color: #2d3a54;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 2px solid var(--surface-card);
}

.btn-secondary:hover {
  background-color: var(--surface-card);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn:focus {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* ============================================
   PORTFOLIO PAGE
   ============================================ */
.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 3rem;
  text-align: center;
  color: var(--text-primary);
}

.portfolio-carousel {
  --portfolio-band: calc(100vh - var(--header-height) - var(--footer-height));
  --carousel-arrow-gap: 0.85rem;
  position: relative;
  padding: 0;
  margin-bottom: 0;
  width: 100%;
  height: calc(var(--portfolio-band) * 0.9);
  min-height: 0;
  max-height: calc(var(--portfolio-band) * 0.9);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--carousel-arrow-gap);
}

.portfolio-carousel__btn {
  position: relative;
  z-index: 5;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  align-self: center;
  border-radius: 50%;
  border: 1px solid var(--surface-card);
  background: var(--secondary-dark);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.portfolio-carousel__icon {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.portfolio-carousel__btn:hover {
  background: var(--surface-card);
  color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.portfolio-carousel__btn:focus-visible {
  outline: 2px solid var(--surface-card);
  outline-offset: 3px;
}

.portfolio-carousel__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.portfolio-list {
  --portfolio-gap: 1.5rem;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--portfolio-gap);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  padding: 0.5rem 0;
  margin-bottom: 0;
  scroll-behavior: smooth;
  scroll-snap-type: none;
  scroll-padding-inline: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.portfolio-list::-webkit-scrollbar {
  display: none;
}

.portfolio-item {
  position: relative;
  flex: 0 0 calc((100% - 2 * var(--portfolio-gap)) / 3 * 1.25);
  width: calc((100% - 2 * var(--portfolio-gap)) / 3 * 1.25);
  max-width: none;
  min-height: 0;
  height: 100%;
  scroll-snap-align: start;
  background-color: var(--secondary-dark);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  padding-top: 4px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

@media (max-width: 900px) {
  .portfolio-list {
    --portfolio-gap: 1.25rem;
  }

  .portfolio-item {
    flex: 0 0 calc((100% - 1 * var(--portfolio-gap)) / 2 * 1.25);
    width: calc((100% - 1 * var(--portfolio-gap)) / 2 * 1.25);
  }
}

@media (max-width: 600px) {
  .portfolio-item {
    flex: 0 0 calc(100% * 1.25);
    width: calc(100% * 1.25);
  }
}

.portfolio-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(90deg, var(--surface-card), var(--text-muted));
  border-radius: 12px 12px 0 0;
}

.portfolio-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.portfolio-item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.portfolio-item-image-wrapper {
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 0;
  overflow: hidden;
  /* border-radius: 6px 6px 0 0; */
}

.portfolio-item-image-wrapper .portfolio-item-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center center;
}

.portfolio-item-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 1.75rem;
  width: 100%;
  box-sizing: border-box;
}

.portfolio-item-title {
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.portfolio-item-client {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  /* margin-bottom: 0.5rem; */
}

.portfolio-item-meta {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.portfolio-item-meta .portfolio-item-role,
.portfolio-item-meta .portfolio-item-dates {
  display: block;
}

.portfolio-item-overview {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 0;
}

.portfolio-item-overview + .portfolio-item-overview {
  margin-top: 0.75rem;
}

.portfolio-item-highlights {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.portfolio-item-highlights li {
  margin-bottom: 0.35rem;
}

.portfolio-item-highlights li:last-child {
  margin-bottom: 0;
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact-section {
  min-height: calc(100vh - var(--footer-height) - var(--header-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 2rem;
  background-color: var(--secondary-dark);
  border-top: 1px solid rgba(238, 163, 2, 0.2);
}

/* CTA block (visible by default) */
.contact-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  max-width: 640px;
  margin: 0 auto;
  transition: opacity 0.3s ease;
}

.contact-cta--hiding {
  opacity: 0;
  pointer-events: none;
}

.contact-cta--hidden {
  display: none;
}

.contact-cta--showing {
  opacity: 0;
}

.contact-cta--showing.contact-cta--visible {
  opacity: 1;
}

.contact-cta h2 {
  font-size: clamp(1.75rem, 3.25vw, 3.8rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
  line-height: 1.3;
}

.contact-cta-highlight {
  color: var(--surface-card);
  background: linear-gradient(135deg, var(--surface-card), #ed8e29);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@supports not (background-clip: text) {
  .contact-cta-highlight {
    background: none;
    -webkit-text-fill-color: unset;
  }
}

.contact-cta-tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0;
}

.contact-cta-button {
  margin-top: 0.5rem;
  border-radius: 9999px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  background-color: var(--surface-card);
  color: var(--primary-dark);
  border: none;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.contact-cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.contact-cta-button::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-left: 0.25rem;
}

/* Form wrapper (hidden by default, shown when CTA is clicked) */
.contact-form-wrapper[hidden] {
  display: none;
}

.contact-form-wrapper {
  padding-top: 0.5rem;
  transition: opacity 0.3s ease;
}

.contact-form-wrapper.contact-form-wrapper--opening {
  opacity: 0;
}

.contact-form-wrapper.contact-form-wrapper--open {
  opacity: 1;
}

.contact-form-wrapper.contact-form-wrapper--closing {
  opacity: 0;
}

.contact-form-wrapper h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.contact-intro {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.contact-form {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.contact-form label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: -0.5rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--primary-dark);
  border: 2px solid rgba(201, 189, 217, 0.3);
  border-radius: 8px;
  transition: border-color 0.3s ease;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--surface-card);
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-form .btn {
  align-self: flex-start;
  margin-top: 0.5rem;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  z-index: 90;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  overflow: hidden;
  background-color: var(--secondary-dark);
  border-top: 1px solid var(--surface-card);
}

.footer-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 0;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-height: 0;
}

.footer-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

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

.footer-section a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: var(--text-primary);
}

.linkedin-link {
  font-weight: 700;
  font-size: 1.1rem;
}

.footer-copyright {
  text-align: right;
  justify-content: flex-end;
}

.footer-copyright p {
  margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  :root {
    /* Header bar; footer is taller (2×2 grid) — decouple from --chrome-band */
    --chrome-band: 80px;
    --header-height: var(--chrome-band);
    --footer-height: 100px;
  }

  /* Index only: lock document — hero band stays between fixed header/footer, no vertical scroll */
  html:has(body.page-home) {
    height: 100%;
    overflow: hidden;
  }

  body.page-home {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.page-home .viewport-top {
    overflow: hidden;
    min-height: 0;
  }

  /* Portfolio page: no body/main vertical scroll; band between header/footer */
  html:has(body.page-portfolio) {
    height: 100%;
    overflow: hidden;
  }

  body.page-portfolio {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.page-portfolio main.dot-texture-bg {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.page-portfolio main.dot-texture-bg > .container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .logo-img {
    height: 32px;
    width: auto;
  }

  nav {
    flex-wrap: nowrap;
  }

  .nav-links,
  .header-actions {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid rgba(238, 163, 2, 0.35);
    background-color: rgba(36, 26, 52, 0.75);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f2fa' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 32px 32px;
    color: var(--text-primary);
    cursor: pointer;
    margin-left: auto;
  }

  .nav-toggle[aria-expanded="true"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f2fa' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
  }

  .nav-toggle:focus-visible {
    outline: 2px solid var(--surface-card);
    outline-offset: 3px;
  }

  .mobile-nav-overlay[hidden] {
    display: none;
  }

  .mobile-nav-overlay {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 1000;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--primary-dark);
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
      env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
  }

  .nav-close {
    position: fixed;
    top: max(0.5rem, env(safe-area-inset-top));
    right: max(0.5rem, env(safe-area-inset-right));
    z-index: 1001;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .nav-close:focus-visible {
    outline: 2px solid var(--surface-card);
    outline-offset: 3px;
  }

  .mobile-nav-panel {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 1.75rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    pointer-events: none;
  }

  .mobile-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    list-style: none;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
    width: 100%;
    pointer-events: auto;
  }

  .mobile-nav-links li {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .mobile-nav-links a {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 0;
    border: none;
    border-radius: 0;
    background: none;
    text-align: center;
    text-decoration: none;
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    box-sizing: border-box;
  }

  .mobile-nav-links a:hover,
  .mobile-nav-links a:focus-visible {
    color: var(--surface-card);
  }

  .mobile-nav-links a.active {
    color: var(--surface-card);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.35rem;
  }

  /* Match desktop header .btn-header + .btn-header-cv */
  .mobile-nav-links a.mobile-nav-cv {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    padding: 0.65rem 1.15rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    border: 2px solid var(--surface-card);
    border-radius: 8px;
    background-color: transparent;
    color: var(--text-primary);
  }

  .mobile-nav-links a.mobile-nav-cv:hover,
  .mobile-nav-links a.mobile-nav-cv:focus-visible {
    background-color: var(--surface-card);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  }

  body.nav-open {
    overflow: hidden;
  }

  .viewport-top main {
    justify-content: flex-start;
    /* padding-bottom: 1rem; */
  }

  /* Index home hero: no inner scroll (fits within viewport band) */
  main.hero.dot-texture-bg {
    overflow: hidden;
  }

  .hero {
    justify-content: flex-start;
    padding: 0.25rem 0.75rem 0.85rem;
  }

  .hero .container {
    padding: 0.25rem 0.75rem 0.5rem;
  }

  /* Image + heading stack in one row (stack vertically centered like desktop); body + buttons below */
  .hero-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.85rem;
    row-gap: 0.65rem;
    align-items: start;
    text-align: left;
  }

  .hero-image-wrapper {
    grid-column: 1;
    grid-row: 1;
    width: min(180px, 40vw);
    height: min(180px, 40vw);
    margin: 0;
    align-self: center;
  }

  .hero-text {
    display: contents;
  }

  .hero-heading-stack {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 0;
  }

  .hero h1 {
    font-size: clamp(3.5rem, 10.5vw, 4.5rem);
    margin: 0;
    line-height: 1.02;
    text-align: left;
  }

  .hero-subtitle {
    font-size: clamp(1.85rem, 5vw, 2.15rem);
    font-weight: 600;
    margin: 0;
    text-align: left;
  }

  .hero-description {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 1.2rem;
    line-height: 1.65;
    margin: 1.1rem 0 0;
    padding-bottom: 1.35rem;
    text-align: left;
  }

  .hero-buttons {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    gap: 0.5rem;
    padding-bottom: 2rem;
  }

  .hero-buttons .btn {
    width: auto;
    max-width: 320px;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.9rem;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .btn-header {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 0.65rem;
  }

  .footer-section {
    gap: 0.05rem;
  }

  .footer-section h3 {
    font-size: 0.8rem;
    margin-bottom: 0;
  }

  .footer-section p {
    font-size: 0.8rem;
  }

  .footer-section .linkedin-link {
    font-size: 1rem;
  }

  .footer-section a {
    overflow-wrap: anywhere;
  }

  .footer-copyright {
    text-align: left;
    justify-content: flex-start;
  }

  /* Portfolio carousel: fills main band; no outer vertical scroll */
  main.dot-texture-bg > .container {
    justify-content: flex-start;
    padding: 0.65rem 1rem 0.65rem;
    box-sizing: border-box;
  }

  .portfolio-carousel {
    --carousel-arrow-gap: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
    margin: 0 0.5rem 0;
    overflow-x: clip;
    overflow-y: visible;
    box-sizing: border-box;
  }

  .portfolio-carousel__btn {
    display: none;
  }

  .portfolio-list {
    --portfolio-gap: 1.25rem;
    scroll-padding-inline: 0.25rem;
    flex: 1 1 0;
    min-height: 0;
    align-self: stretch;
    padding: 0.25rem 0 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  /* Narrower slides; body text tightened below; cqw for image sizing */
  .portfolio-item {
    container-type: inline-size;
    flex: 0 0 calc(100% * 0.88);
    width: calc(100% * 0.88);
    min-height: 0;
    max-height: 100%;
  }

  /* +20px vs previous 92% × 5:2 band; cqw matches card width */
  .portfolio-item-image-wrapper {
    border-radius: 8px 8px 0 0;
    width: min(100cqw, calc(92cqw + 60px));
    height: calc(min(100cqw, 92cqw + 20px) / 2.5 + 35px);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: unset;
  }

  .portfolio-item-content {
    padding: 1rem 0.95rem 1.35rem;
  }

  .portfolio-item-overview {
    font-size: 0.775rem;
    line-height: 1.6;
  }

  .portfolio-item-highlights {
    font-size: 0.775rem;
    line-height: 1.45;
  }

  .portfolio-item-meta {
    font-size: 0.8125rem;
  }

  .btn {
    width: 100%;
  }

  header {
    padding: 0 1rem;
  }

  footer {
    padding: 0.4rem 1rem;
    height: var(--footer-height);
    overflow: visible;
    align-items: flex-start;
  }

  .container {
    padding: 1rem;
  }

  .contact-section {
    padding: 3rem 1rem;
  }

  .contact-cta h2 {
    font-size: 2rem;
  }

  .contact-cta-button {
    width: 100%;
    justify-content: center;
  }

  .contact-form-wrapper h2 {
    font-size: 2rem;
  }

  .contact-form .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero-content {
    column-gap: 0.65rem;
  }

  .hero-image-wrapper {
    width: min(180px, 40vw);
    height: min(180px, 40vw);
  }

  .hero h1 {
    font-size: clamp(3.15rem, 11vw, 4rem);
  }

  .hero-subtitle {
    font-size: clamp(1.65rem, 5.2vw, 1.95rem);
  }

  .hero-description {
    font-size: 1.12rem;
    line-height: 1.62;
    margin-top: 1.2rem;
    margin-bottom: 0;
    padding-bottom: 1.5rem;
  }

  .page-title {
    font-size: 2rem;
  }

  .contact-cta h2 {
    font-size: 1.75rem;
  }

  .contact-form-wrapper h2 {
    font-size: 1.75rem;
  }

  /* Same 2×2 grid; a touch tighter on very narrow screens */
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem 0.55rem;
    text-align: left;
  }

  .footer-copyright {
    text-align: left;
    justify-content: flex-start;
  }
}

/* Compact phones (iPhone 14 class ~390px); tweak max-width to exclude 430px-wide models if needed */
@media (max-width: 430px) {
  html {
    zoom: 0.95;
  }
}
