/*
 * Responsive layer for Aayush Premium Portfolio
 * Keeps the existing visual design intact while making the layout fluid
 * from large desktop screens down to 320px phones.
 */

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

main,
section,
.container,
.hero-grid,
.hero-content,
.hero-visual,
.about-grid,
.about-content,
.skills-grid,
.skills-copy,
.contact-grid,
.contact-copy,
.service-grid,
.project-grid,
.process-timeline,
.footer-inner {
  min-width: 0;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.hero-title,
.section-heading h2,
.about-content h2,
.skills-copy h2,
.contact-copy h2,
.cta-card h2,
.project-thumb span,
.contact-card strong {
  overflow-wrap: anywhere;
}

/* Large laptops / smaller desktop screens */
@media (max-width: 1280px) {
  :root {
    --container: 1120px;
  }

  .container {
    width: min(var(--container), calc(100% - 48px));
  }

  .section-pad {
    padding-block: 96px;
  }

  .nav {
    gap: 14px;
    padding-inline: 16px;
  }

  .nav-menu {
    gap: 4px;
  }

  .nav-menu a {
    padding-inline: 11px;
    font-size: 0.9rem;
  }

  .nav-cta {
    padding-inline: 14px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.82fr);
    gap: 42px;
  }

  .hero-title {
    font-size: clamp(3rem, 5.2vw, 4.45rem);
  }

  .about-grid,
  .skills-grid,
  .contact-grid {
    gap: 44px;
  }
}

/* Tablet landscape / compact laptops */
@media (max-width: 1024px) {
  .container {
    width: min(100% - 40px, 900px);
  }

  .section-pad {
    padding-block: 84px;
  }

  .hero {
    min-height: auto;
    padding-top: 126px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .hero-content {
    max-width: 820px;
  }

  .hero-title {
    max-width: 780px;
    font-size: clamp(3rem, 7.2vw, 4.4rem);
  }

  .hero-subtitle {
    max-width: 760px;
  }

  .hero-visual,
  .visual-shell {
    width: 100%;
    max-width: 760px;
    margin-inline: auto;
  }

  .about-grid,
  .skills-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .portrait-card {
    width: min(100%, 560px);
    margin-inline: auto;
  }

  .skills-copy,
  .contact-copy {
    max-width: 760px;
  }

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

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

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

  .footer-inner {
    gap: 18px;
  }
}

/* Switch navigation before it starts getting cramped */
@media (max-width: 960px) {
  .site-header {
    top: 10px;
  }

  .nav {
    height: 68px;
    border-radius: 24px;
  }

  .nav-toggle {
    display: block;
    flex: 0 0 auto;
  }

  .nav-cta {
    display: none;
  }

  .nav-menu {
    position: fixed;
    top: 88px;
    left: max(20px, calc((100vw - 900px) / 2));
    right: max(20px, calc((100vw - 900px) / 2));
    display: grid;
    gap: 6px;
    max-height: calc(100dvh - 108px);
    overflow-y: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(5, 8, 22, 0.96);
    backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  }

  .nav-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-menu a {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.96rem;
  }
}

/* Tablet portrait */
@media (max-width: 820px) {
  .hero {
    padding-top: 118px;
  }

  .hero-grid {
    gap: 40px;
  }

  .hero-title {
    font-size: clamp(2.7rem, 8vw, 3.8rem);
  }

  .quick-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 100%;
  }

  .project-thumb {
    min-height: clamp(210px, 33vw, 250px);
  }

  .service-card {
    min-height: 0;
  }

  .cta-card {
    padding: clamp(30px, 7vw, 54px);
  }

  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .footer-links {
    width: 100%;
  }
}

/* Large phones / small tablets */
@media (max-width: 700px) {
  .container {
    width: calc(100% - 32px);
  }

  .section-pad {
    padding-block: 72px;
  }

  .service-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-thumb {
    min-height: clamp(210px, 56vw, 280px);
  }

  .project-body,
  .service-card,
  .process-step {
    padding: 22px;
  }

  .section-heading {
    margin-bottom: 34px;
  }

  .contact-card a {
    padding: 19px;
  }
}

@media (max-width: 620px) {
  .process-timeline {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    gap: 9px;
  }

  .quick-stats div {
    padding: 14px 12px;
    border-radius: 18px;
  }

  .quick-stats strong {
    font-size: 1.25rem;
  }

  .quick-stats span {
    font-size: 0.76rem;
    line-height: 1.35;
  }
}

/* Standard phones */
@media (max-width: 540px) {
  .container {
    width: calc(100% - 28px);
  }

  .site-header {
    top: 8px;
  }

  .nav {
    height: 62px;
    padding-inline: 10px;
    border-radius: 20px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 0.86rem;
  }

  .brand-text {
    display: inline;
    font-size: 0.95rem;
  }

  .nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .nav-menu {
    top: 78px;
    left: 14px;
    right: 14px;
    max-height: calc(100dvh - 92px);
    border-radius: 20px;
  }

  .section-pad {
    padding-block: 64px;
  }

  .hero {
    padding-top: 104px;
  }

  .hero-grid {
    gap: 34px;
  }

  .eyebrow,
  .section-kicker {
    gap: 8px;
    font-size: 0.7rem;
    letter-spacing: 0.13em;
    line-height: 1.45;
  }

  .eyebrow::before,
  .section-kicker::before {
    width: 24px;
    flex: 0 0 24px;
  }

  .hero-title {
    margin-top: 14px;
    font-size: clamp(2.2rem, 10.8vw, 3rem);
    letter-spacing: -0.05em;
  }

  .hero-subtitle {
    margin-top: 18px;
    font-size: 0.98rem;
    line-height: 1.68;
  }

  .hero-actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 26px;
  }

  .btn {
    width: 100%;
    min-height: 52px;
    padding-inline: 18px;
  }

  .quick-stats {
    margin-top: 30px;
  }

  .visual-shell {
    border-radius: 22px;
  }

  .visual-topbar {
    padding: 12px 14px;
  }

  .visual-topbar p {
    font-size: 0.72rem;
  }

  .code-window {
    padding: 16px 14px 13px;
  }

  .code-window pre {
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: clamp(0.63rem, 2.7vw, 0.76rem);
    line-height: 1.5;
  }

  .visual-footer {
    padding: 0 14px 16px;
  }

  .visual-footer span {
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  .about-content h2,
  .skills-copy h2,
  .contact-copy h2,
  .cta-card h2,
  .section-heading h2 {
    font-size: clamp(2rem, 10.6vw, 2.75rem);
    letter-spacing: -0.05em;
  }

  .about-content p,
  .section-heading p,
  .skills-copy p,
  .contact-copy p,
  .cta-card p {
    font-size: 0.96rem;
    line-height: 1.7;
  }

  .portrait-card,
  .service-card,
  .project-card,
  .process-step,
  .cta-card,
  .contact-card {
    border-radius: 22px;
  }

  .availability-pill {
    left: 12px;
    right: 12px;
    bottom: 12px;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .about-points,
  .skill-cloud {
    gap: 9px;
  }

  .about-points span {
    padding: 9px 11px;
    font-size: 0.8rem;
  }

  .skill-cloud span {
    min-height: 46px;
    padding-inline: 14px;
    font-size: 0.84rem;
  }

  .project-thumb {
    min-height: 220px;
    padding: 20px;
  }

  .project-thumb span {
    font-size: clamp(1.7rem, 9vw, 2.5rem);
  }

  .project-body,
  .service-card,
  .process-step {
    padding: 20px;
  }

  .cta-card {
    padding: 26px 20px;
  }

  .contact-card {
    padding: 10px;
  }

  .contact-card a {
    padding: 16px 14px;
    border-radius: 16px;
  }

  .contact-card strong {
    font-size: 0.95rem;
  }

  .footer-inner {
    padding: 18px;
    border-radius: 22px;
  }

  .footer-brand {
    width: 100%;
  }

  .footer-brand-block p {
    font-size: 0.86rem;
    line-height: 1.5;
  }

  .footer-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .footer-links a {
    min-width: 0;
    padding: 9px 8px;
    font-size: 0.78rem;
    text-align: center;
  }
}

/* Narrow phones */
@media (max-width: 420px) {
  .container {
    width: calc(100% - 24px);
  }

  .brand-text {
    font-size: 0.9rem;
  }

  .hero-title {
    font-size: clamp(2rem, 10.7vw, 2.65rem);
  }

  .hero-subtitle {
    font-size: 0.93rem;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }

  .quick-stats div {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    text-align: left;
  }

  .quick-stats span {
    margin-top: 0;
  }

  .visual-topbar p {
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-thumb {
    min-height: 200px;
  }

  .footer-links {
    grid-template-columns: 1fr;
  }
}

/* 360px and 320px devices */
@media (max-width: 360px) {
  .container {
    width: calc(100% - 20px);
  }

  .nav {
    padding-inline: 8px;
  }

  .brand {
    gap: 7px;
  }

  .brand-text {
    font-size: 0.82rem;
  }

  .hero {
    padding-top: 98px;
  }

  .section-pad {
    padding-block: 58px;
  }

  .hero-title {
    font-size: clamp(1.9rem, 10.8vw, 2.35rem);
  }

  .about-content h2,
  .skills-copy h2,
  .contact-copy h2,
  .cta-card h2,
  .section-heading h2 {
    font-size: clamp(1.85rem, 10.3vw, 2.3rem);
  }

  .eyebrow,
  .section-kicker {
    font-size: 0.64rem;
  }

  .service-card h3,
  .project-card h3,
  .process-step h3 {
    font-size: 1.18rem;
  }

  .project-thumb {
    min-height: 185px;
  }

  .visual-footer {
    gap: 6px;
  }

  .visual-footer span {
    font-size: 0.66rem;
  }
}

@media (max-width: 320px) {
  .container {
    width: calc(100% - 16px);
  }

  .brand-text {
    display: none;
  }

  .nav-menu {
    left: 8px;
    right: 8px;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .btn {
    min-height: 50px;
    font-size: 0.9rem;
  }

  .code-window {
    padding-inline: 11px;
  }

  .code-window pre {
    font-size: 0.61rem;
  }

  .project-thumb {
    min-height: 175px;
  }

  .project-body,
  .service-card,
  .process-step {
    padding: 18px;
  }

  .contact-card strong {
    font-size: 0.88rem;
  }
}

/* Touch devices should not keep desktop-only hover/cursor effects alive. */
@media (hover: none), (pointer: coarse) {
  .cursor-glow {
    display: none;
  }

  .service-card:hover,
  .project-card:hover,
  .process-step:hover,
  .nav-cta:hover,
  .btn:hover,
  .footer-links a:hover {
    transform: none;
  }
}

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

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