/* ================ Responsive Styles ================ */

/* ================ Large Screens (1400px+) ================ */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .hero-content {
    gap: 6rem;
  }
  
  .hero-3d-card {
    width: 400px;
    height: 500px;
  }
}

/* ================ Desktop (1024px - 1399px) ================ */
@media (max-width: 1399px) {
  .container {
    max-width: 1140px;
  }
  
  .hero-content {
    gap: 4rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================ Tablet Landscape (992px - 1023px) ================ */
@media (max-width: 1023px) {
  .container {
    max-width: 960px;
  }
  
  /* Navigation */
  .nav-container {
    padding: 0 1rem;
  }
  
  .nav-link span {
    display: none;
  }
  
  .nav-link {
    padding: 0.5rem;
  }
  
  .nav-link i {
    font-size: 1.25rem;
  }
  
  /* Hero */
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 3rem;
  }
  
  .hero-text {
    order: 1;
  }
  
  .hero-visual {
    order: 0;
  }
  
  .hero-description {
    margin: 0 auto 2rem;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .hero-3d-card {
    width: 280px;
    height: 360px;
  }
  
  .hero-stats {
    justify-content: center;
  }
  
  /* Sections */
  .section {
    padding: 4rem 0;
  }
  
  .section-header {
    margin-bottom: 2rem;
  }
  
  /* Grid */
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Featured Project */
  .featured-project {
    grid-template-columns: 1fr;
  }
  
  .featured-image {
    min-height: 200px;
  }
  
  /* Profile */
  .profile-header {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .profile-avatar {
    margin: 0 auto;
  }
  
  .profile-badges {
    justify-content: center;
  }
  
  /* Skills */
  .skills-grid {
    grid-template-columns: 1fr;
  }
  
  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
  }
  
  /* Footer - Tablet */
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
  
  .footer-clock .clock-time {
    font-size: 2rem;
  }
}

/* ================ Tablet Portrait (768px - 991px) ================ */
@media (max-width: 991px) {
  .container {
    max-width: 720px;
  }
  
  /* Navigation */
  .nav-logo .logo-text {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
  }
  
  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-link {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }
  
  .nav-link span {
    display: inline;
  }
  
  .nav-divider {
    width: 100%;
    height: 1px;
    margin: 0.5rem 0;
  }
  
  .theme-toggle,
  .music-toggle {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }
  
  /* Hero */
  .hero {
    min-height: auto;
    padding: 6rem 1.5rem 4rem;
  }
  
  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  
  .hero-description {
    font-size: 1.1rem;
  }
  
  /* Cards */
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  /* Timeline */
  .timeline::before {
    left: 20px;
  }
  
  .timeline-item {
    flex-direction: column !important;
  }
  
  .timeline-content {
    width: calc(100% - 50px);
    margin-left: 50px !important;
  }
  
  .timeline-dot {
    left: 20px;
  }
  
  /* Blog */
  .blog-filters {
    gap: 0.5rem;
  }
  
  .filter-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }
  
  /* Kanban */
  .kanban-wrapper {
    display: none;
  }
}

/* ================ Mobile Large (576px - 767px) ================ */
@media (max-width: 767px) {
  .container {
    max-width: 540px;
    padding: 0 1rem;
  }
  
  /* Navigation */
  :root {
    --nav-height: 60px;
  }
  
  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  /* Hero */
  .hero {
    padding: 5rem 1rem 3rem;
  }
  
  .hero-badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-description {
    font-size: 1rem;
  }
  
  .hero-typing {
    font-size: 0.85rem;
    padding: 0.75rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .hero-3d-card {
    width: 240px;
    height: 300px;
  }
  
  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
  
  .float-element {
    font-size: 1.5rem;
  }
  
  /* Sections */
  .section {
    padding: 3rem 0;
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .section-description {
    font-size: 0.95rem;
  }
  
  /* Cards */
  .feature-card {
    padding: 1.5rem;
  }
  
  .feature-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1.5rem 1rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .stat-icon {
    width: 48px;
    height: 48px;
  }
  
  /* Grid */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
  }
  
  /* Blog */
  .blog-hero {
    padding: 4rem 0 2rem;
  }
  
  .blog-card-image {
    height: 160px;
  }
  
  .blog-card-content {
    padding: 1rem;
  }
  
  .blog-card-title {
    font-size: 1.1rem;
  }
  
  .blog-card-excerpt {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  
  /* Article */
  .article-hero-image {
    height: 200px;
  }
  
  .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .article-title {
    font-size: 1.5rem;
  }
  
  .article-content {
    font-size: 1rem;
  }
  
  /* Project */
  .project-card {
    padding: 1.5rem;
  }
  
  .project-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
  
  /* Profile */
  .profile-hero {
    padding: 4rem 0 2rem;
  }
  
  .profile-avatar {
    width: 150px;
    height: 150px;
  }
  
  .profile-info h1 {
    font-size: 1.75rem;
  }
  
  .profile-title {
    font-size: 1rem;
  }
  
  .profile-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* Tools */
  .tools-hero {
    padding: 4rem 0 2rem;
  }
  
  .tool-card {
    padding: 1.5rem;
  }
  
  .tool-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  /* Timeline */
  .timeline-hero {
    padding: 4rem 0 2rem;
  }
  
  .timeline-content {
    padding: 1rem;
  }
  
  .timeline-title {
    font-size: 1rem;
  }
  
  /* Footer - Mobile */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0 1.5rem 2rem;
  }
  
  .footer-brand {
    text-align: center;
    align-items: center;
  }
  
  .footer-logo {
    justify-content: center;
  }
  
  .footer-bio {
    justify-content: center;
  }
  
  .github-stats {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }
  
  .social-links {
    justify-content: center;
  }
  
  .footer-nav,
  .footer-stats,
  .footer-clock {
    text-align: center;
  }
  
  .footer-nav h4,
  .footer-stats h4,
  .footer-clock h4 {
    justify-content: center;
  }
  
  .footer-links {
    align-items: center;
  }
  
  .footer-links li a {
    justify-content: center;
  }
  
  .stats-grid {
    max-width: 300px;
    margin: 0 auto;
  }
  
  .clock-time {
    font-size: 2rem;
  }
  
  .footer-bottom {
    padding: 1.5rem 1rem;
  }
  
  .footer-badges {
    gap: 0.5rem;
  }
  
  .badge-item {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
  }
  
  /* Contact */
  .contact-form {
    padding: 1.5rem;
  }
  
  .contact-item {
    padding: 1rem;
  }
  
  .contact-icon {
    width: 44px;
    height: 44px;
  }
  
  /* Guestbook */
  .guestbook-form {
    padding: 1.5rem;
  }
  
  .guestbook-message {
    padding: 1rem;
  }
  
  /* Toast */
  .toast {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Music Player Full */
  .player-cover-large {
    width: 150px;
    height: 150px;
  }
  
  .player-controls {
    gap: 1rem;
  }
  
  .player-controls button {
    width: 40px;
    height: 40px;
  }
  
  .player-controls .play-btn {
    width: 56px;
    height: 56px;
  }
}

/* ================ Mobile Small (320px - 575px) ================ */
@media (max-width: 575px) {
  .container {
    max-width: 100%;
    padding: 0 0.75rem;
  }
  
  /* Hero */
  .hero {
    padding: 4.5rem 0.75rem 2rem;
  }
  
  .hero-badge {
    font-size: 0.7rem;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .hero-description {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }
  
  .hero-3d-card {
    width: 200px;
    height: 260px;
  }
  
  /* Sections */
  .section {
    padding: 2.5rem 0;
  }
  
  .section-tag {
    font-size: 0.7rem;
    padding: 0.35rem 0.75rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  /* Cards */
  .card {
    padding: 1.25rem;
  }
  
  .feature-card {
    padding: 1.25rem;
  }
  
  .feature-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
  
  .feature-title {
    font-size: 1.1rem;
  }
  
  .feature-description {
    font-size: 0.9rem;
  }
  
  /* Stats */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem 0.5rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
  
  /* Blog */
  .blog-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }
  
  .filter-btn {
    flex-shrink: 0;
  }
  
  .blog-search {
    margin-bottom: 2rem;
  }
  
  .blog-card-image {
    height: 140px;
  }
  
  /* Project */
  .project-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .project-tags {
    gap: 0.35rem;
  }
  
  .project-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
  
  .project-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  /* Profile */
  .profile-avatar {
    width: 120px;
    height: 120px;
  }
  
  .profile-info h1 {
    font-size: 1.5rem;
  }
  
  /* Skill */
  .skill-category {
    padding: 1.5rem;
  }
  
  .skill-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  /* Tools */
  .tool-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  /* Footer */
  .footer-bottom {
    padding-top: 1.5rem;
    margin-top: 2rem;
  }
  
  .footer-bottom p {
    font-size: 0.85rem;
  }
  
  /* Pagination */
  .pagination {
    gap: 0.35rem;
  }
  
  .page-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  /* Toast */
  .toast-container {
    left: 1rem;
    right: 1rem;
  }
  
  .toast {
    width: 100%;
  }
}

/* ================ Extra Small ( < 320px) ================ */
@media (max-width: 319px) {
  html {
    font-size: 14px;
  }
  
  .hero-title {
    font-size: 1.35rem;
  }
  
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ================ Landscape Mode on Mobile ================ */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 4rem 1rem 2rem;
  }
  
  .hero-content {
    flex-direction: row;
    gap: 2rem;
  }
  
  .hero-text {
    text-align: left;
  }
  
  .hero-3d-card {
    width: 180px;
    height: 240px;
  }
}

/* ================ Print Styles ================ */
@media print {
  .main-nav,
  .bg-effects,
  .kanban-wrapper,
  .toast-container,
  .main-footer {
    display: none !important;
  }
  
  .main-content {
    padding-top: 0;
  }
  
  body {
    background: white;
    color: black;
  }
  .card,
  .blog-card,
  .project-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ================ Reduced Motion ================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-reveal,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .scroll-reveal-scale {
    opacity: 1;
    transform: none;
  }
  
  .float-element {
    animation: none;
  }
  
  .glow-orb {
    animation: none;
  }
  
  .particle {
    animation: none;
  }
}

/* ================ High Contrast Mode ================ */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --text-secondary: #333;
  }
  
  .card,
  .blog-card,
  .project-card {
    border-width: 2px;
  }
  
  .btn-primary {
    border: 2px solid currentColor;
  }
}

/* ================ Dark Mode System Preference ================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.9);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --border-light: #1e293b;
    
    --shadow-glow: 0 0 60px rgba(102, 126, 234, 0.4);
  }
}

/* ================ Touch Device Optimizations ================ */
@media (hover: none) and (pointer: coarse) {
  .hover-lift:hover,
  .hover-grow:hover,
  .hover-bounce:hover {
    transform: none;
  }
  
  .card:active {
    transform: scale(0.98);
  }
  
  .btn:active {
    transform: scale(0.95);
  }
  
  /* Remove hover effects that don't work on touch */
  .hover-shake:hover,
  .hover-wiggle:hover {
    animation: none;
  }
  
  /* Increase touch targets */
  .nav-link,
  .btn,
  .filter-btn,
  .page-btn {
    min-height: 44px;
  }
}
