/* ============================================================
   RESPONSIVE — Neural Interface
   ============================================================ */

/* --- Touch devices: disable custom cursor --- */
@media (pointer: coarse) {
  #cursorDot,
  #cursorRing {
    display: none !important;
  }
}

/* --- Tablet (< 1024px) --- */
@media (max-width: 1024px) {
  :root {
    --hud-padding: 16px;
    --section-padding: 60px;
  }

  .hud-top-right {
    gap: 16px;
  }

  .hud-nav-link {
    font-size: 10px;
  }

  .contact-links {
    flex-direction: column;
    gap: 16px;
  }

  .profile-name {
    font-size: clamp(36px, 10vw, 120px);
  }
}

/* --- Mobile (< 768px) --- */
@media (max-width: 768px) {
  :root {
    --hud-padding: 12px;
    --section-padding: 40px;
  }

  /* HUD simplification */
  .hud-top-left {
    display: none;
  }

  .hud-right {
    display: none;
  }

  .hud-top-right {
    top: 0;
    bottom: auto;
    right: 0;
    left: 0;
    transform: none;
    justify-content: center;
    gap: 0;
    background: rgba(19, 19, 19, 0.85);
    backdrop-filter: blur(12px);
    padding: 0;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid var(--ghost-border);
  }

  .hud-nav-link {
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    opacity: 0.4;
  }

  .hud-nav-link .nav-text,
  .hud-nav-link .nav-text-hover {
    /* Will be replaced by JS with numbers */
  }

  .hud-nav-link.active {
    opacity: 1;
  }

  /* Move bottom-right tools above new top nav */
  .hud-bottom-right {
    bottom: auto;
    top: 0;
    right: var(--hud-padding);
    padding-top: env(safe-area-inset-top);
    height: auto;
    align-items: center;
    z-index: 101;
  }

  .hud-bottom-left {
    display: none;
  }

  /* Profile section */
  .profile-name {
    font-size: clamp(28px, 14vw, 80px);
    white-space: normal;
    text-align: center;
  }

  .profile-definition {
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 260px;
    text-align: center;
  }

  .profile-bio {
    left: var(--hud-padding);
    right: var(--hud-padding);
    top: auto;
    bottom: 10%;
    transform: none;
    max-width: 100%;
    padding: 0 var(--hud-padding);
  }

  .profile-status {
    left: var(--hud-padding);
    bottom: auto;
    top: 15%;
    transform: scale(1);
    text-align: left;
  }

  /* Reduce keyword tickers on mobile */
  .keyword-ticker:nth-child(n+5) {
    display: none;
  }

  .keyword-ticker__track span {
    font-size: 20px;
  }

  /* Contact cards — full width, touch-friendly */
  .contact-card {
    padding: 20px 24px;
    min-height: 48px;
    width: 100%;
  }

  .contact-card span:last-child {
    font-size: 12px;
    word-break: break-all;
  }

  .contact-footer {
    text-align: center;
  }

  .contact-legacy {
    text-align: center;
  }

  /* General mobile rules */
  body {
    overflow-x: hidden;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Section numbers smaller */
  .section-number {
    font-size: 48px;
    top: 20px;
    left: 20px;
  }

  .section-number .section-label {
    font-size: 14px;
  }

  /* Skills radar — fit viewport */
  .skills-radar-wrap {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  #radarCanvas {
    width: 100% !important;
    height: auto !important;
  }

  .skills-legend {
    flex-direction: column;
    gap: 24px;
  }

  .skills-content {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  /* Boot screen popups — stack behind logo */
  .boot-popup {
    width: 70% !important;
    left: 15% !important;
    right: auto !important;
    font-size: 10px;
  }

  #bootPopup0 { top: 5% !important; }
  #bootPopup1 { top: auto !important; bottom: 25% !important; right: auto !important; }
  #bootPopup2 { bottom: 5% !important; }

  /* Boot CTA full width */
  #loginCTA {
    width: calc(100% - 48px);
    margin: 0 24px;
  }

  /* Boot logo smaller */
  #bootLogoScene {
    width: 250px !important;
    height: 250px !important;
  }

  /* Projects carousel — larger cards */
  .project-card-3d {
    width: 85vw;
    min-width: 85vw;
    flex-shrink: 0;
  }

  .card-3d-inner {
    padding: 28px 24px;
  }

  .card-3d-inner h3 {
    font-size: 20px;
  }

  .card-3d-inner p {
    font-size: 14px;
  }

  .project-tags {
    flex-wrap: wrap;
  }

  /* Reduce FX intensity */
  #scanlineOverlay {
    opacity: 0.05;
  }

  #fxCanvas {
    opacity: 0.3;
  }

  /* Neural map — accordion layout */
  .neural-content {
    flex-direction: column;
    gap: 0;
  }

  .neural-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .neural-item {
    padding: 14px var(--hud-padding);
    border-bottom: 1px solid var(--ghost-border);
  }

  .neural-item.is-open {
    color: var(--primary-container);
    border-bottom-color: var(--primary-dim);
  }

  .neural-item-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 var(--hud-padding);
    background: var(--surface-container-low);
  }

  .neural-item-detail.is-open {
    max-height: 200px;
    padding: 16px var(--hud-padding);
  }

  .neural-item-detail .neural-card__emoji {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .neural-item-detail .neural-card__title {
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--primary-container);
  }

  .neural-item-detail .neural-card__desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--on-surface-variant);
  }

  /* Hide the separate card on mobile */
  .neural-card {
    display: none !important;
  }
}

/* --- Small Mobile (< 480px) --- */
@media (max-width: 480px) {
  .profile-name {
    font-size: 28px;
  }

  .section-number {
    font-size: 36px;
  }

  .section-number .section-label {
    font-size: 11px;
  }

  .project-card-3d {
    width: 92vw;
    min-width: 92vw;
  }

  .hud-nav-link {
    padding: 10px 10px;
    font-size: 10px;
  }
}
