/* responsive.css — Modern cross-platform responsive breakpoints */

/* ============================================================
   Mobile Topbar (hidden on desktop, shown on mobile/tablet)
   ============================================================ */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  gap: 0.75rem;
}

.mobile-brand {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-primary);
  flex-shrink: 0;
}

.mobile-brand span {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mobile-section-name {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.25rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 300ms var(--ease-out);
}

.mobile-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ============================================================
   Small Mobile (<=374px) — iPhone SE, Galaxy S8 etc.
   ============================================================ */
@media (max-width: 374px) {
  .portfolio-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    display: none !important;
  }

  .content-area {
    grid-column: 1;
    padding: 0;
  }

  .status-bar {
    grid-column: 1;
  }

  .mobile-topbar {
    display: flex;
    padding: 0.5rem 0.75rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    gap: 0.5rem;
  }

  .mobile-brand {
    font-size: 0.85rem;
  }

  .mobile-section-name {
    font-size: 0.62rem;
    padding: 0.2rem 0.5rem;
  }

  .theme-toggle-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.6rem;
  }

  .page-container {
    padding: 1.25rem 1rem;
  }

  /* Hero */
  .hero-page {
    min-height: auto;
    padding-top: 0.5rem;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-name {
    font-size: 1.75rem;
  }

  .hero-role {
    font-size: 1rem;
  }

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

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.65rem;
  }

  .hero-contacts {
    gap: 0.4rem;
  }

  .contact-chip {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .cta-btn {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    font-size: 0.85rem;
  }

  /* About */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .about-card {
    padding: 1.25rem;
  }

  /* Projects */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .skill-tile {
    padding: 1.25rem;
  }

  .skill-chip {
    font-size: 0.72rem;
    padding: 0.3rem 0.65rem;
  }

  /* Certs */
  .certs-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .cert-badge-card {
    padding: 1.25rem;
    gap: 1rem;
  }

  /* News */
  .news-controls {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Timeline */
  .timeline {
    padding-left: 1.25rem;
  }

  .timeline-dot {
    left: -1.25rem;
    width: 10px;
    height: 10px;
  }

  .timeline-header {
    flex-direction: column;
    gap: 0.4rem;
  }

  .timeline-period {
    align-self: flex-start;
  }

  .timeline-card {
    padding: 1.25rem;
  }

  .timeline-title {
    font-size: 0.9rem;
  }

  /* Page header */
  .page-title {
    font-size: 1.6rem;
  }

  .page-description {
    font-size: 0.9rem;
  }

  .page-header-eyebrow {
    font-size: 0.65rem;
  }

  /* Status bar */
  .status-bar {
    grid-column: 1;
    padding-inline: 0.75rem;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    font-size: 0.62rem;
    gap: 0.5rem;
  }

  .status-left,
  .status-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }

  /* Panel */
  .panel-body {
    padding: 1.25rem 1rem;
  }

  .panel-titlebar {
    padding: 0.75rem 1rem;
  }

  /* Edu items */
  .edu-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .edu-meta {
    flex-wrap: wrap;
  }

  /* Lang cards */
  .lang-card {
    min-width: 120px;
    padding: 0.6rem 0.9rem;
  }
}

/* ============================================================
   Mobile (375px - 767px)
   ============================================================ */
@media (min-width: 375px) and (max-width: 767px) {
  .portfolio-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    display: none !important;
  }

  .content-area {
    grid-column: 1;
    padding: 0;
  }

  .status-bar {
    grid-column: 1;
  }

  .mobile-topbar {
    display: flex;
  }

  .theme-toggle-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.64rem;
  }

  .page-container {
    padding: 1.5rem 1.25rem;
  }

  /* Hero */
  .hero-page {
    min-height: auto;
    padding-top: 1rem;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-name {
    font-size: 2.25rem;
  }

  .hero-role {
    font-size: 1.1rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .cta-btn {
    width: 100%;
    justify-content: center;
  }

  /* About */
  .about-grid {
    grid-template-columns: 1fr;
  }

  /* Projects */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: 1fr;
  }

  /* Certs */
  .certs-grid {
    grid-template-columns: 1fr;
  }

  /* News */
  .news-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  /* Timeline */
  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-dot {
    left: -1.5rem;
    width: 12px;
    height: 12px;
  }

  .timeline-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .timeline-period {
    align-self: flex-start;
  }

  /* Page header */
  .page-title {
    font-size: 1.85rem;
  }

  /* Status bar */
  .status-bar {
    grid-column: 1;
    padding-inline: 1rem;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
  }

  .status-left,
  .status-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* ============================================================
   Large Mobile / Small Tablet landscape (480px-767px) overrides
   ============================================================ */
@media (min-width: 480px) and (max-width: 767px) {
  .hero-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .hero-cta {
    flex-direction: row;
  }

  .cta-btn {
    width: auto;
  }

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

  .about-card.full-width {
    grid-column: 1 / -1;
  }

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

/* ============================================================
   Tablet Portrait (768px - 1023px) — NO sidebar, topbar only
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .portfolio-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    display: none !important;
  }

  .content-area {
    grid-column: 1;
  }

  .status-bar {
    grid-column: 1;
  }

  .mobile-topbar {
    display: flex;
  }

  .page-container {
    padding: 2rem 2rem;
  }

  .hero-name {
    font-size: 2.75rem;
  }

  .hero-content {
    grid-template-columns: 1fr auto;
    gap: 2.5rem;
  }

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

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

  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .certs-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

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

/* ============================================================
   Tablet Landscape / Small Desktop (1024px - 1199px)
   ============================================================ */
@media (min-width: 1024px) and (max-width: 1199px) {
  .portfolio-shell {
    grid-template-columns: 240px 1fr;
  }

  .sidebar-nav {
    width: 240px;
  }

  .mobile-topbar {
    display: none;
  }

  .page-container {
    padding: 2.25rem 2.5rem;
  }

  .hero-page .page-container {
    padding-top: 1.25rem;
  }

  .hero-name {
    font-size: 3rem;
  }

  .hero-content {
    grid-template-columns: 1fr auto;
    gap: 3rem;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

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

/* ============================================================
   Desktop (>=1200px)
   ============================================================ */
@media (min-width: 1200px) {
  .portfolio-shell {
    grid-template-columns: 260px 1fr;
  }

  .mobile-topbar {
    display: none;
  }

  .hero-page .page-container {
    padding-top: 1rem;
  }
}

/* ============================================================
   Large Desktop (>=1600px) — better use of space
   ============================================================ */
@media (min-width: 1600px) {
  .page-container {
    max-width: 1280px;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

/* ============================================================
   Landscape orientation on phones
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-page {
    min-height: auto;
    padding-top: 0.5rem;
  }

  .scroll-section:first-child {
    min-height: auto;
  }

  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .hero-name {
    font-size: 2rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.75rem;
  }

  .page-container {
    padding: 1rem 1.5rem;
  }
}

/* ============================================================
   Hover-capable devices only (prevent sticky hover on touch)
   ============================================================ */
@media (hover: none) {
  .nav-item:hover {
    background: transparent;
    transform: none;
  }

  .nav-item.active {
    background: var(--accent-soft);
  }

  .stat-card:hover,
  .about-card:hover,
  .skill-tile:hover,
  .project-card:hover,
  .cert-badge-card:hover,
  .news-card:hover,
  .timeline-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }

  .contact-chip:hover,
  .cta-btn.primary:hover,
  .cta-btn.secondary:hover {
    transform: none;
  }

  .edu-item:hover {
    transform: none;
  }

  .skill-chip:hover,
  .timeline-project-tag:hover,
  .project-tech-tag:hover {
    transform: none;
  }

  .theme-toggle-btn:hover {
    transform: none;
  }

  .load-more-btn:hover:not(:disabled) {
    transform: none;
  }
}

/* ============================================================
   Reduced motion preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .stagger-children > * {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ============================================================
   Print styles
   ============================================================ */
@media print {
  .sidebar-nav,
  .mobile-topbar,
  .status-bar,
  .theme-toggle-btn,
  .hero-cta,
  .news-load-more {
    display: none !important;
  }

  .portfolio-shell {
    grid-template-columns: 1fr;
    display: block;
  }

  .content-area {
    padding: 0;
  }

  .page-container {
    padding: 1rem 0;
    max-width: none;
  }

  .hero-name {
    font-size: 2rem;
    -webkit-text-fill-color: initial;
    background: none;
    color: #000;
  }

  .section-panel,
  .stat-card,
  .about-card,
  .skill-tile,
  .project-card,
  .cert-badge-card,
  .news-card,
  .timeline-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
