/**
 * Mobile / tablet responsive overlay for nalankara.de portfolio.
 * Loads after the Vite-hashed CSS; keeps tokens/content unchanged.
 */

/* ---- Tablet: tighten hero + sections ---- */
@media (max-width: 1024px) {
  .profile-view .hero {
    padding-inline: clamp(1rem, 3vw, 1.75rem);
  }

  .profile-view .hero-layout {
    gap: 2.25rem;
    width: min(920px, 100%);
  }

  .profile-view .section-inner {
    padding: 3.25rem 1.5rem;
    margin-inline: 0.75rem;
    max-width: calc(100% - 1.5rem);
  }

  .profile-view .card-grid,
  .profile-view .skills-grid,
  .profile-view .supporting-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

/* ---- Phone / small tablet ---- */
@media (max-width: 768px) {
  .profile-view {
    overflow-x: clip;
  }

  .profile-view .nav-island {
    top: auto;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    width: min(calc(100% - 1.25rem), 28rem);
    max-width: none;
    padding: 0.3rem;
    gap: 0.15rem;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .profile-view .nav-island::-webkit-scrollbar {
    display: none;
  }

  .profile-view .nav-link {
    white-space: nowrap;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    font-size: 0.72rem;
  }

  .profile-view .hero {
    min-height: 100dvh;
    min-height: 100svh;
    padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
  }

  .profile-view .hero-layout {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: start;
    gap: 1.75rem;
    width: 100%;
  }

  /* Portrait first on mobile (visual lead), copy below */
  .profile-view .portrait-card {
    order: -1;
    justify-self: center;
    width: min(100%, 16.5rem);
    /* room for glass panel opening below the photo */
    margin-bottom: 0.25rem;
  }

  .profile-view .portrait-frame {
    border-radius: 1.35rem;
    outline-width: 0.35rem;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  .profile-view .portrait-image {
    width: 100%;
    border-radius: inherit;
    flex: 0 0 auto;
  }

  /* Eckdaten: closed by default; expand below photo in-flow so the image stays clear */
  .profile-view .portrait-glass {
    position: relative;
    inset: auto;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 0.65rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-0.35rem);
    max-height: 0;
    overflow: hidden;
    padding: 0 1rem;
    border-radius: 1.15rem;
    width: 100%;
    box-sizing: border-box;
    transition:
      opacity 0.35s var(--ease-out, cubic-bezier(0.32, 0.72, 0, 1)),
      transform 0.35s var(--ease-out, cubic-bezier(0.32, 0.72, 0, 1)),
      max-height 0.4s var(--ease-out, cubic-bezier(0.32, 0.72, 0, 1)),
      padding 0.35s var(--ease-out, cubic-bezier(0.32, 0.72, 0, 1)),
      margin 0.35s var(--ease-out, cubic-bezier(0.32, 0.72, 0, 1)),
      visibility 0.35s;
    z-index: 5;
  }

  .profile-view .portrait-card.is-glass-open .portrait-glass,
  .profile-view .portrait-frame:focus-within .portrait-glass {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    max-height: 16rem;
    padding: 0.9rem 1rem;
    margin-top: 0.65rem;
  }
  .profile-view .hero-inner {
    text-align: center;
    justify-self: center;
    max-width: 100%;
    width: 100%;
  }

  .profile-view .hero-title {
    font-size: clamp(2.55rem, 14vw, 3.75rem);
    margin-bottom: 1rem;
  }

  .profile-view .hero-lede {
    font-size: 0.98rem;
    margin-bottom: 0.85rem;
  }

  .profile-view .hero-summary {
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
    max-width: 34rem;
  }

  .profile-view .eyebrow {
    display: inline-block;
    margin-bottom: 1.1rem;
    font-size: 0.6rem;
    padding: 0.3rem 0.75rem;
  }

  .profile-view .hero-ctas {
    justify-content: center;
    width: 100%;
    gap: 0.65rem;
  }

  .profile-view .hero-ctas .btn-primary,
  .profile-view .hero-ctas .btn-ghost {
    flex: 1 1 auto;
    min-width: min(100%, 9.5rem);
    justify-content: center;
  }

  .profile-view .hero-scroll {
    display: none; /* conflicts with bottom nav island */
  }

  .profile-view .section-shell,
  .profile-view .section-shell--soft {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .profile-view .section-inner {
    padding: 2.25rem 1.15rem;
    margin-inline: 0.65rem;
    max-width: calc(100% - 1.3rem);
    border-radius: 1.35rem;
  }

  .profile-view .section-title {
    font-size: clamp(1.75rem, 7vw, 2.4rem);
    margin-bottom: 1.5rem;
  }

  .profile-view .section-title--sm {
    font-size: clamp(1.4rem, 5.5vw, 1.85rem);
  }

  .profile-view .about-text {
    font-size: 1.02rem;
  }

  .profile-view .card-grid,
  .profile-view .skills-grid,
  .profile-view .supporting-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .profile-view .timeline-card,
  .profile-view .content-card,
  .profile-view .skill-group {
    padding: 1.25rem;
    border-radius: 1.2rem;
  }

  .profile-view .timeline-title,
  .profile-view .content-card h3,
  .profile-view .skill-group h3 {
    font-size: clamp(1.35rem, 5vw, 1.55rem);
  }

  .profile-view .timeline-meta {
    gap: 0.4rem 0.85rem;
    font-size: 0.72rem;
  }

  .profile-view .site-footer {
    text-align: center;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 1rem calc(5.75rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ---- Very narrow phones ---- */
@media (max-width: 380px) {
  .profile-view .hero-title {
    font-size: clamp(2.2rem, 13vw, 2.85rem);
  }

  .profile-view .hero-ctas {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-view .hero-ctas .btn-primary,
  .profile-view .hero-ctas .btn-ghost {
    width: 100%;
    min-width: 0;
  }

  .profile-view .portrait-card {
    width: min(100%, 14.5rem);
  }

  .profile-view .nav-link {
    padding: 0.5rem 0.7rem;
    font-size: 0.68rem;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .profile-view .hero-layout,
  .profile-view .portrait-image,
  .profile-view .hero-scroll {
    animation: none !important;
    transition: none !important;
  }
}
