

/* =========================================================
   FULL RESPONSIVE SYSTEM — MOBILE / TABLET / LAPTOP / DESKTOP
   ========================================================= */

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

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

.container {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
}

main,
section,
.section,
.hero-section,
.contact-section {
  min-width: 0;
}

.hero-grid,
.about-layout,
.skills-layout,
.projects-grid,
.hosting-cards,
.contact-details-grid,
.contact-message-layout,
.contact-form-panel,
.contact-envelope-card {
  min-width: 0;
}

.hero-title,
.section-heading h2,
.contact-envelope-card h3,
.contact-info h2 {
  overflow-wrap: anywhere;
}

.nav-shell,
.hero-grid,
.about-layout,
.skills-layout,
.contact-message-layout {
  min-width: 0;
}

.nav-links a,
.btn,
.theme-toggle,
.mobile-menu-btn,
.contact-social-links a,
.mobile-contact-bar a {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- ULTRA-WIDE / LARGE DESKTOP ---------- */
@media (min-width: 1440px) {
  .container {
    width: min(1280px, calc(100% - 80px));
  }

  .hero-grid {
    gap: 72px;
  }

  .hero-title {
    font-size: clamp(72px, 5.5vw, 96px);
  }

  .hero-visual {
    min-height: 590px;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    transform-origin: center;
  }

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

/* ---------- DESKTOP / STANDARD LAPTOP ---------- */
@media (min-width: 1200px) and (max-width: 1439px) {
  .container {
    width: min(1160px, calc(100% - 48px));
  }

  .hero-grid {
    gap: 46px;
  }

  .hero-title {
    font-size: clamp(60px, 6vw, 84px);
  }
}

/* ---------- LAPTOP / SMALL DESKTOP ---------- */
@media (min-width: 992px) and (max-width: 1199px) {
  .container {
    width: min(1040px, calc(100% - 40px));
  }

  .nav-links a {
    padding-inline: 7px !important;
    font-size: 11px !important;
  }

  .hero-grid {
    grid-template-columns: 1.05fr .95fr !important;
    gap: 30px !important;
  }

  .hero-title {
    font-size: clamp(54px, 6vw, 72px) !important;
  }

  .hero-description {
    font-size: 14px !important;
  }

  .hero-stats {
    gap: 10px !important;
  }

  .hero-visual {
    min-height: 470px !important;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    max-width: 330px !important;
    max-height: 330px !important;
  }

  .projects-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .contact-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .contact-message-layout {
    grid-template-columns: .9fr 1.1fr !important;
  }
}

/* ---------- TABLET LANDSCAPE ---------- */
@media (min-width: 768px) and (max-width: 991px) {
  .container {
    width: min(900px, calc(100% - 36px));
  }

  .section {
    padding: 92px 0 !important;
  }

  .nav-shell {
    height: 68px !important;
  }

  .mobile-menu-btn {
    display: grid !important;
    place-items: center;
  }

  .nav-links {
    position: absolute !important;
    top: 66px !important;
    left: 18px !important;
    right: 18px !important;
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    padding: 12px !important;
    border-radius: 14px !important;
    background: rgba(4, 18, 38, .97) !important;
    border: 1px solid var(--line) !important;
    box-shadow: 0 22px 60px rgba(0,0,0,.28) !important;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
  }

  .nav-links.open {
    display: flex !important;
  }

  .nav-links a {
    padding: 12px !important;
    font-size: 12px !important;
  }

  .hero-section {
    padding-top: 110px !important;
  }

  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
  }

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

  .hero-title {
    font-size: clamp(52px, 8vw, 72px) !important;
  }

  .typing-row {
    font-size: 20px !important;
  }

  .hero-description {
    max-width: 720px !important;
  }

  .hero-stats {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .hero-visual {
    min-height: 430px !important;
    height: auto !important;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    width: 320px !important;
    height: 320px !important;
    max-width: 100% !important;
  }

  .about-layout,
  .skills-layout,
  .contact-message-layout {
    grid-template-columns: 1fr !important;
  }

  .stats-board {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .skill-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

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

  .hosting-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .contact-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .contact-envelope-card {
    min-height: auto !important;
  }
}

/* ---------- TABLET PORTRAIT / LARGE MOBILE ---------- */
@media (min-width: 600px) and (max-width: 767px) {
  .container {
    width: calc(100% - 32px);
  }

  .section {
    padding: 82px 0 !important;
  }

  .hero-section {
    padding-top: 100px !important;
  }

  .hero-grid,
  .about-layout,
  .skills-layout,
  .contact-message-layout {
    grid-template-columns: 1fr !important;
  }

  .hero-title {
    font-size: clamp(48px, 10vw, 64px) !important;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .hero-visual {
    min-height: 390px !important;
    height: auto !important;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    width: 290px !important;
    height: 290px !important;
  }

  .stats-board {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .skill-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

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

  .hosting-cards {
    grid-template-columns: 1fr !important;
  }

  .contact-details-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .contact-form-panel .contact-form {
    grid-template-columns: 1fr !important;
  }

  .contact-form-panel .full-field {
    grid-column: auto !important;
  }
}

/* ---------- MOBILE ---------- */
@media (max-width: 599px) {
  :root {
    --header-h: 64px !important;
  }

  .container {
    width: calc(100% - 24px) !important;
  }

  .section {
    padding: 72px 0 !important;
  }

  .site-header {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .nav-shell {
    height: 64px !important;
    gap: 10px !important;
  }

  .brand {
    min-width: 0;
  }

  .brand-text {
    font-size: 13px !important;
    white-space: nowrap;
  }

  .brand-mark {
    font-size: 8px !important;
    padding: 6px !important;
  }

  .mobile-menu-btn,
  .theme-toggle {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px;
  }

  .mobile-menu-btn {
    display: grid !important;
    place-items: center;
  }

  .nav-links {
    position: absolute !important;
    top: 62px !important;
    left: 12px !important;
    right: 12px !important;
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    padding: 10px !important;
    border-radius: 14px !important;
    background: rgba(4, 18, 38, .98) !important;
    border: 1px solid var(--line) !important;
    max-height: calc(100dvh - 82px);
    overflow-y: auto;
  }

  .nav-links.open {
    display: flex !important;
  }

  .nav-links a {
    padding: 12px !important;
    font-size: 12px !important;
  }

  .hero-section {
    min-height: auto !important;
    padding-top: 96px !important;
  }

  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .availability-pill {
    font-size: 9px !important;
    padding: 7px 10px !important;
  }

  .hero-title {
    font-size: clamp(42px, 13vw, 56px) !important;
    line-height: 1 !important;
    letter-spacing: -2.5px !important;
  }

  .typing-row {
    font-size: 17px !important;
    min-height: 28px !important;
  }

  .hero-description {
    font-size: 13px !important;
    line-height: 1.75 !important;
  }

  .hero-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .hero-actions .btn {
    width: 100% !important;
    min-height: 46px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-top: 28px !important;
  }

  .hero-stats article {
    min-width: 0;
  }

  .hero-visual {
    min-height: 325px !important;
    height: auto !important;
    overflow: visible !important;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    width: min(270px, 88vw) !important;
    height: min(270px, 88vw) !important;
    max-width: 270px !important;
    max-height: 270px !important;
  }

  .tech-badge {
    font-size: 8px !important;
    padding: 6px 7px !important;
    gap: 4px !important;
  }

  .tech-badge i {
    font-size: 13px !important;
  }

  .section-heading {
    margin-bottom: 30px !important;
  }

  .section-heading h2 {
    font-size: clamp(28px, 9vw, 36px) !important;
    letter-spacing: -1.2px !important;
  }

  .section-heading p {
    font-size: 12px !important;
  }

  .about-layout,
  .skills-layout,
  .contact-message-layout {
    grid-template-columns: 1fr !important;
  }

  .stats-board {
    grid-template-columns: 1fr !important;
  }

  .skill-orbit-wrap {
    min-height: 330px !important;
  }

  .skill-orbit {
    width: 250px !important;
    height: 250px !important;
  }

  .skill-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 7px !important;
  }

  .skill-tabs button {
    min-height: 42px;
  }

  .skill-grid {
    grid-template-columns: 1fr !important;
  }

  .timeline {
    padding-left: 38px !important;
  }

  .timeline-line {
    left: 11px !important;
  }

  .timeline-dot {
    left: -35px !important;
  }

  .timeline-card {
    padding: 20px !important;
  }

  .timeline-number {
    font-size: 22px !important;
  }

  /* Mobile project slider rather than squeezed cards */
  .projects-grid {
    display: flex !important;
    overflow-x: auto !important;
    gap: 14px !important;
    scroll-snap-type: x mandatory;
    padding: 4px 2px 14px;
    -webkit-overflow-scrolling: touch;
  }

  .project-card {
    min-width: 86% !important;
    width: 86% !important;
    flex: 0 0 86% !important;
    scroll-snap-align: start;
  }

  .project-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .project-filters {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .project-filters button {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .project-search {
    width: 100% !important;
  }

  .project-search input {
    width: 100% !important;
    font-size: 16px !important;
  }

  .hosting-cards {
    grid-template-columns: 1fr !important;
  }

  .server-visual {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .server-stage {
    justify-content: flex-start !important;
    min-width: max-content !important;
    overflow: visible;
  }

  .design-showcase {
    width: min(300px, 88vw) !important;
    height: min(300px, 88vw) !important;
  }

  .contact-details-grid {
    grid-template-columns: 1fr !important;
  }

  .contact-detail-card {
    min-height: auto !important;
    padding: 18px !important;
  }

  .contact-message-layout {
    grid-template-columns: 1fr !important;
  }

  .contact-envelope-card,
  .contact-form-panel {
    padding: 20px !important;
  }

  .contact-envelope-card {
    min-height: auto !important;
  }

  .envelope-stage {
    width: 135px !important;
    height: 135px !important;
  }

  .envelope-main-icon {
    width: 72px !important;
    height: 72px !important;
    font-size: 26px !important;
  }

  .contact-form-panel .contact-form {
    grid-template-columns: 1fr !important;
  }

  .contact-form-panel .full-field {
    grid-column: auto !important;
  }

  .form-field input,
  .form-field textarea,
  .form-field select {
    font-size: 16px !important; /* prevents iOS zoom */
    min-height: 46px;
  }

  .form-field textarea {
    min-height: 130px !important;
  }

  .mobile-contact-bar {
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }

  .mobile-contact-bar a {
    min-height: 50px;
    display: grid;
    place-items: center;
  }

  .site-footer {
    padding-bottom: 78px !important;
  }

  #cursorDot,
  #cursorRing,
  #spotlight {
    display: none !important;
  }
}

/* ---------- SMALL MOBILE 320–389 ---------- */
@media (max-width: 389px) {
  .container {
    width: calc(100% - 18px) !important;
  }

  .hero-title {
    font-size: 40px !important;
  }

  .typing-row {
    font-size: 15px !important;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr !important;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    width: 240px !important;
    height: 240px !important;
  }

  .skill-orbit {
    width: 225px !important;
    height: 225px !important;
  }

  .design-showcase {
    width: 270px !important;
    height: 270px !important;
  }

  .project-card {
    min-width: 90% !important;
    width: 90% !important;
    flex-basis: 90% !important;
  }

  .contact-detail-icon {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }
}

/* ---------- LANDSCAPE MOBILE ---------- */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 900px) {
  .hero-section {
    padding-top: 88px !important;
  }

  .hero-grid {
    grid-template-columns: 1.08fr .92fr !important;
    align-items: center !important;
  }

  .hero-visual {
    min-height: 300px !important;
  }

  .developer-orbit,
  .hero-orbit,
  .orbit-system,
  .orbit-wrapper {
    width: 240px !important;
    height: 240px !important;
  }

  .hero-stats {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* ---------- TOUCH DEVICES ---------- */
@media (hover: none), (pointer: coarse) {
  .tilt-card,
  .project-card,
  .contact-detail-card {
    transform: none !important;
  }

  .btn:hover,
  .contact-social-links a:hover,
  .contact-detail-card:hover {
    transform: none !important;
  }

  .btn,
  button,
  a {
    touch-action: manipulation;
  }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

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