/**
 * The Constellation - Interactive Portfolio
 * Stylesheet: Responsive Design
 * Purpose: Media queries for tablet, mobile, and small phone breakpoints
 */

/* Safe area insets for notched devices (iPhone X+, etc.) */
:root {
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
}

/* Touch devices */
@media (pointer: coarse) {
  html, body { cursor: default; }

  /* Reduced glow effects on mobile for performance */
  .identity h1 {
    text-shadow: 0 0 10px rgba(255,255,255,0.2) !important;
  }

  .quick-links a:hover,
  .contact-node a:hover,
  .social-orbit a:hover {
    text-shadow: 0 0 10px currentColor !important;
  }

  .bio-header h2 {
    text-shadow: 0 0 10px rgba(255,255,255,0.2) !important;
  }

  #tooltip {
    backdrop-filter: blur(8px) !important;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  header, footer {
    padding: 1.75rem 2rem;
    padding-top: calc(1.75rem + var(--safe-area-top));
    padding-left: calc(2rem + var(--safe-area-left));
    padding-right: calc(2rem + var(--safe-area-right));
  }
  .quick-links { gap: 1rem; }

  /* Improved touch targets for tablet */
  .quick-links a {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 16px;
  }
}

/* Mobile Portrait */
@media (max-width: 768px) {
  header, footer {
    padding: 1.5rem;
    padding-top: calc(1.5rem + var(--safe-area-top));
    padding-bottom: calc(1.5rem + var(--safe-area-bottom));
    padding-left: calc(1.5rem + var(--safe-area-left));
    padding-right: calc(1.5rem + var(--safe-area-right));
  }

  .identity h1 {
    font-size: 1rem;
    letter-spacing: 0.2em;
  }

  .identity .tagline {
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .coords {
    font-size: 0.7rem;
    line-height: 1.3;
  }

  .center-content {
    padding-top: 10vh;
  }

  .quick-links {
    gap: 0.75rem;
  }

  .quick-links a {
    font-size: 0.75rem;
    padding: 12px 16px;
    min-height: 48px;
    min-width: 48px;
  }

  footer {
    flex-direction: column;
    gap: 2rem;
    align-items: center;
  }

  .contact-node {
    align-items: center;
    gap: 1rem;
  }

  .contact-node a {
    min-height: 48px;
    font-size: 1rem;
  }

  .social-orbit {
    justify-content: center;
    gap: 1rem;
  }

  .social-orbit a {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  #tooltip {
    max-width: 280px;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(8px);
  }

  #tooltip h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  #tooltip p {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  #tooltip .hint {
    font-size: 0.75rem;
    margin-top: 0.75rem;
  }

  /* Bio and projects sections - optimized for mobile */
  #projects-index {
    padding: 3rem 1.5rem 2rem;
    padding-left: calc(1.5rem + var(--safe-area-left));
    padding-right: calc(1.5rem + var(--safe-area-right));
  }

  .project-group {
    padding: 1.5rem 1.25rem;
  }

  .project-list li {
    padding: 0.6rem 0;
    line-height: 1.5;
  }

  .project-link {
    font-size: 0.9rem;
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
  }

  .project-note {
    display: block;
    margin-left: 0;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  #bio-section {
    padding: 3rem 1.5rem;
    padding-left: calc(1.5rem + var(--safe-area-left));
    padding-right: calc(1.5rem + var(--safe-area-right));
    padding-bottom: calc(3rem + var(--safe-area-bottom));
  }

  .bio-header h2 {
    font-size: 1.6rem;
    letter-spacing: 0.2em;
  }

  .bio-header .subtitle {
    font-size: 0.95rem;
  }

  .bio-poem {
    font-size: 1.05rem;
    line-height: 1.8;
    padding: 1.75rem 1.5rem;
  }

  .verse-line {
    margin-left: 1em;
    line-height: 1.7;
  }

  .scroll-indicator {
    bottom: calc(2rem + var(--safe-area-bottom));
  }
}

/* Landscape mode optimization for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  header {
    padding: 1rem 1.5rem;
    padding-top: calc(1rem + var(--safe-area-top));
  }

  footer {
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + var(--safe-area-bottom));
    flex-direction: row;
    gap: 1.5rem;
  }

  .identity h1 {
    font-size: 0.9rem;
  }

  .identity .tagline {
    font-size: 0.7rem;
  }

  .coords {
    font-size: 0.65rem;
  }

  .quick-links a {
    padding: 8px 12px;
    font-size: 0.7rem;
  }

  #bio-section {
    padding: 2rem 1.5rem;
  }

  .bio-header h2 {
    font-size: 1.4rem;
  }

  .bio-poem {
    font-size: 0.95rem;
    padding: 1.5rem;
  }
}

/* Small phones */
@media (max-width: 375px) {
  header, footer {
    padding: 1.25rem;
    padding-top: calc(1.25rem + var(--safe-area-top));
    padding-bottom: calc(1.25rem + var(--safe-area-bottom));
    padding-left: calc(1.25rem + var(--safe-area-left));
    padding-right: calc(1.25rem + var(--safe-area-right));
  }

  .identity h1 {
    font-size: 0.95rem;
    letter-spacing: 0.18em;
  }

  .identity .tagline {
    font-size: 0.7rem;
  }

  .quick-links a {
    padding: 10px 12px;
    font-size: 0.7rem;
    min-width: 48px;
  }

  .bio-poem {
    font-size: 1rem;
    padding: 1.25rem;
  }

  .project-note {
    font-size: 0.75rem;
  }
}

/* Very small phones */
@media (max-width: 320px) {
  .identity h1 {
    font-size: 0.85rem;
    letter-spacing: 0.15em;
  }

  .quick-links {
    gap: 0.5rem;
  }

  .bio-poem {
    font-size: 0.95rem;
    padding: 1rem;
  }
}
