/* =========================================================================
   RESPONSIVE
   ========================================================================= */

/* Show decorative rails only when there's room for them */
@media (min-width: 1180px) {
  .rail { display: flex; }
}

/* Tablet */
@media (max-width: 960px) {
  .navbar__nav { display: none; }
  .navbar__toggle { display: flex; }

  .section { padding-left: 0; padding-right: 0; }
  .footer { padding-left: var(--gutter); padding-right: var(--gutter); }

  .hero__grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .hero__portrait-col { justify-content: center; }
  .terminal-card { max-width: 380px; }
  .hero__text-col { max-width: none; }

  .journey-pin {
    height: 100svh;
    padding: 0;
    overflow: hidden;
  }
  .journey-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 24px 0 24px;
    overflow: hidden;
    align-items: start;
    gap: 20px;
  }
  .journey-stage__media { order: -1; max-width: 420px; margin: 10px auto; }
  .journey-stage__list { max-width: none; }

  .project-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 640px) {
  :root { --nav-h: 64px; }

  .navbar { padding: 0 18px; }
  .navbar__mark-text { display: none; }

  .hero { padding-top: calc(var(--nav-h) + 32px); align-items: flex-start; }
  .hero__grid { padding: 0 20px; gap: 36px; }
  .hero__ascii-layer {
    top: auto;
    bottom: 0;           
    align-items: flex-end; 
    opacity: 0.5; 
  }

  .terminal-card { max-width: 100%; }
  .terminal-card__body { padding: 14px 12px; }

  .hero__name { font-size: clamp(40px, 13vw, 60px); }
  .hero__caption { max-width: none; }
  .hero__subcaption { max-width: none; }

  .hero__scroll { margin-top: 40px; }

  .about-statement__dot {
    width: clamp(8px, 2.5vw, 12px);
    height: clamp(8px, 2.5vw, 12px);
    margin-left: clamp(10px, 3vw, 18px);
    margin-right: clamp(10px, 3vw, 18px);
  }

  .tech-stack { margin-top: 48px; }
  .tech-stack__rows { margin-top: 24px; gap: 20px; }
  .tech-marquee__item { width: 92px; margin: 0 18px; }
  .tech-marquee__item img { width: 44px; height: 44px; }
  .tech-marquee__label { font-size: 10px; }

  .certs { margin-top: 52px; }
  .certs-carousel { margin-top: 28px; gap: 10px; }
  .certs-carousel__slide { margin: 0 8px; }
  .certs-lightbox__close { top: 14px; right: 14px; width: 34px; height: 34px; font-size: 22px; }

  .placeholder-section__inner { padding: 64px 20px; }
  .placeholder-section__title { font-size: clamp(30px, 10vw, 44px); }

  .journey-head { padding: 96px 20px 0; }
  .journey-head__title { font-size: clamp(26px, 7vw, 32px); }
  .journey-stage {
    padding: 14px 20px 12px;
    gap: 8px;
    align-content: start;
  }
  .journey-stage__title {
    font-size: clamp(24px, 7vw, 29px);
    line-height: 1.1;
    min-height: 1.2em;
  }
  .journey-stage__period { margin-top: 6px; }
  .journey-stage__role { margin-top: 4px; }
  .journey-stage__list {
    gap: 6px;
    margin-top: 12px;
  }
  .journey-pin[data-mobile-layout="tags"] .journey-stage__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .journey-pin[data-mobile-layout="tags"] .journey-stage__list li {
    padding: 5px 8px;
    border: 1px solid var(--line-strong);
    background: var(--accent-wash);
    font-size: 10px;
    line-height: 1.25;
    min-height: 0;
    overflow-wrap: anywhere;
  }
  .journey-pin[data-mobile-layout="tags"] .journey-stage__list li::before { display: none; }
  .journey-stage__media { max-width: 100%; gap: 5px; margin: 10px auto 0; }
  .journey-carousel { aspect-ratio: 16 / 8.5; }
  .journey-nav-btn { width: 36px; height: 24px; }
  .journey-progress { padding: 0 20px 24px; }

  @media (max-height: 720px) {
    .journey-carousel { aspect-ratio: 16 / 6; }
  }

  .footer {
    flex-direction: column;
    gap: 6px;
    padding: 24px 20px;
  }

  .project-modal__panel { padding: 24px; max-height: 92vh; }

  /* ---- Project section ---- */
  .project-section { padding-top: 64px; padding-bottom: 64px; }
  .project-head__title { font-size: clamp(30px, 10vw, 44px); }
  .project-head__note { font-size: 13px; }

  .project-catalog {
    margin-top: 40px;
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .project-catalog:not([data-expanded="true"]) .project-card:nth-child(n+3) {
    display: none;
  }
  .project-more-btn {
    display: flex;
    width: 100%;
  }
  .project-card__body { padding: 18px 18px 20px; gap: 8px; }
  .project-card__title { font-size: 18px; }
  .project-card__summary { font-size: 12.5px; }

  .project-modal__image { aspect-ratio: 4 / 3; margin-bottom: 20px; }
  .project-modal__image-nav {
    width: 40px;
    height: 40px;
    font-size: 11px;
  }
  .project-modal__title { font-size: 23px; }
  .project-modal__overview,
  .project-modal__description { font-size: 13.5px; }
  .project-modal__links { gap: 12px 20px; }

  .contact-grid {
    grid-template-columns: 1fr;
    margin-top: 32px;
    gap: 12px;
  }
  .contact-tag { padding: 16px 18px; }
  .contact-tag__value { font-size: 12.5px; }
}

/* Large desktop: give the composition more air */
@media (min-width: 1600px) {
  .hero__grid { max-width: 1520px; }
}