/**
 * Responsive Design Stylesheet
 * Additional responsive styles for mobile and tablet devices
 */

/* ============================================
   EXTRA LARGE SCREENS (1440px and above)
   ============================================ */

@media (min-width: 1440px) {
    .container {
        padding: 0 48px;
    }
    
    .hero h1 {
        font-size: 64px;
    }
    
    .section {
        padding: 64px 48px;
    }
}

/* ============================================
   LANDSCAPE TABLETS (1024px to 1199px)
   ============================================ */

@media (max-width: 1199px) {
    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
    
    h1 { font-size: 36px; }
    h2 { font-size: 28px; }
    h3 { font-size: 22px; }
    
    .hero h1 {
        font-size: 40px;
    }
    
    .section {
        padding: 48px 24px;
    }
}

/* ============================================
   TABLET SCREENS (768px to 1023px)
   ============================================ */

@media (max-width: 1023px) {
    :root {
        font-size: 15px;
    }
    
    /* Navigation */
    .nav-menu {
        gap: 16px;
    }
    
    .header-inner {
        padding: 12px 16px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    /* Typography */
    h1 { font-size: 32px; }
    h2 { font-size: 26px; }
    h3 { font-size: 20px; }
    
    .hero h1 {
        font-size: 36px;
    }
    
    .hero .subtitle {
        font-size: 18px;
    }
    
    .hero-buttons {
        gap: 12px;
    }
    
    /* Grid adjustments */
    .grid-4,
    .grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .main-sidebar-layout {
        grid-template-columns: 1fr;
    }
    
    /* Sections */
    .section {
        padding: 40px 16px;
    }
    
    .section-title h2 {
        font-size: 28px;
    }
    
    /* Cards */
    .card-image {
        height: 160px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .card-title {
        font-size: 18px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
    
    .footer-bottom {
        flex-direction: column;
    }
    
    /* Post page */
    .post-title {
        font-size: 32px;
    }
    
    .post-meta {
        font-size: 13px;
    }
    
    /* Forms */
    .form-control {
        padding: 10px 14px;
        font-size: 15px;
    }
}

/* ============================================
   LARGE MOBILE SCREENS (576px to 767px)
   ============================================ */

@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    /* Header and Navigation */
    .header {
        padding: 12px 0;
    }
    
    .header-inner {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .logo {
        font-size: 18px;
        flex: 1;
    }
    
    .logo img {
        max-width: 32px;
    }
    
    .search-btn {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    /* Navigation Menu */
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100vw;
        flex-direction: column;
        gap: 0;
        background-color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-menu.mobile-active {
        max-height: 500px;
    }
    
    .nav-menu > li {
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu > li > a {
        display: block;
        padding: 14px 16px;
        text-decoration: none;
    }
    
    .nav-menu > li > a:after {
        bottom: 50%;
        transform: translateY(50%);
    }
    
    .nav-submenu {
        position: static;
        display: none;
        background-color: var(--bg-light);
        box-shadow: none;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-submenu.active {
        display: block;
        max-height: 500px;
    }
    
    .nav-submenu li a {
        padding-left: 32px;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    
    /* Hero Section */
    .hero {
        padding: 40px 16px;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero h1 {
        font-size: 28px;
        margin-bottom: 16px;
    }
    
    .hero .subtitle {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .hero .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 16px;
    }
    
    /* Typography */
    h1 { font-size: 26px; }
    h2 { font-size: 22px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    
    /* Sections and Layout */
    .section {
        padding: 32px 16px;
    }
    
    .section-title h2 {
        font-size: 22px;
        margin-bottom: 12px;
    }
    
    .section-subtitle {
        font-size: 14px;
    }
    
    /* Grid */
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .main-sidebar-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    /* Cards */
    .card {
        box-shadow: var(--shadow-sm);
    }
    
    .card:hover {
        transform: translateY(-4px);
    }
    
    .card-image {
        height: 150px;
    }
    
    .card-body {
        padding: 14px;
    }
    
    .card-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .card-footer {
        padding: 0 14px 14px;
        gap: 8px;
    }
    
    .card-meta {
        gap: 6px;
    }
    
    .meta-item {
        font-size: 12px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .btn-large {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .btn-small {
        padding: 6px 14px;
        font-size: 12px;
    }
    
    /* Category Cards */
    .category-card {
        padding: 20px 16px;
    }
    
    .category-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    
    /* Search Box */
    .search-box {
        padding: 12px;
    }
    
    .search-box form {
        gap: 8px;
    }
    
    .search-box input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* Newsletter */
    .newsletter {
        padding: 24px 16px;
    }
    
    .newsletter h2 {
        font-size: 22px;
    }
    
    .newsletter-form {
        max-width: 100%;
    }
    
    .newsletter-form input {
        padding: 12px 14px;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    /* Sidebar */
    .sidebar-widget {
        margin-bottom: 20px;
        padding: 16px;
    }
    
    .sidebar-widget h3 {
        font-size: 16px;
    }
    
    /* Tables */
    .info-table {
        font-size: 13px;
        margin: 20px 0;
    }
    
    .info-table td {
        padding: 12px;
    }
    
    /* Post Page */
    .post-header {
        margin-bottom: 24px;
    }
    
    .post-title {
        font-size: 24px;
        margin-bottom: 16px;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 8px;
        font-size: 13px;
    }
    
    .post-content {
        margin: 0;
    }
    
    .post-content h2 {
        margin-top: 24px;
        margin-bottom: 16px;
    }
    
    .featured-image {
        max-height: 300px;
        margin-bottom: 24px;
    }
    
    /* Footer */
    .footer {
        padding: 32px 16px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .footer-column h4 {
        margin-bottom: 16px;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .footer-legal {
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-copyright,
    .footer-legal a {
        font-size: 12px;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 12px;
        margin-bottom: 16px;
    }
    
    /* Utility Classes */
    .container {
        padding: 0 12px;
    }
    
    /* Social Links */
    [style*="display: flex"][style*="justify-content: center"] {
        gap: 8px !important;
    }
}

/* ============================================
   SMALL MOBILE SCREENS (Under 576px)
   ============================================ */

@media (max-width: 575px) {
    :root {
        font-size: 13px;
    }
    
    body {
        font-size: 13px;
    }
    
    /* Header adjustments */
    .header-inner {
        padding: 10px;
    }
    
    .logo {
        font-size: 16px;
    }
    
    .logo img {
        max-width: 28px;
    }
    
    /* Typography */
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    
    .hero h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }
    
    .hero .subtitle {
        font-size: 14px;
        margin-bottom: 16px;
    }
    
    /* Sections */
    .section {
        padding: 24px 12px;
    }
    
    .hero {
        padding: 32px 12px;
    }
    
    /* Cards */
    .card-image {
        height: 120px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .card-meta {
        font-size: 12px;
        gap: 4px;
        margin: 8px 0;
    }
    
    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .hero .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .btn-small {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    /* Forms */
    .form-control {
        padding: 9px 10px;
        font-size: 13px;
    }
    
    /* Newsletter */
    .newsletter {
        padding: 20px 12px;
    }
    
    .newsletter h2 {
        font-size: 18px;
    }
    
    /* Footer */
    .footer {
        padding: 24px 12px;
    }
    
    .footer-column h4 {
        font-size: 14px;
    }
    
    /* Post Page */
    .post-title {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .post-meta {
        font-size: 12px;
    }
    
    .info-table {
        font-size: 12px;
    }
    
    .info-table td {
        padding: 8px;
    }
    
    /* Table of contents */
    .sidebar-widget {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .sidebar-widget h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 11px;
        gap: 4px;
    }
    
    /* Spacing adjustments */
    .mb-1 { margin-bottom: 6px; }
    .mb-2 { margin-bottom: 10px; }
    .mb-3 { margin-bottom: 14px; }
    
    .mt-1 { margin-top: 6px; }
    .mt-2 { margin-top: 10px; }
    .mt-3 { margin-top: 14px; }
    
    /* Social buttons row */
    .social-buttons {
        gap: 6px;
    }
}

/* ============================================
   VERY SMALL DEVICES (Landscape Mobile)
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 20px 16px;
    }
    
    .hero h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .hero .subtitle {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .hero .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .header-inner {
        padding: 8px 12px;
    }
}

/* ============================================
   ORIENTATION-SPECIFIC ADJUSTMENTS
   ============================================ */

@media (orientation: portrait) {
    /* Portrait specific styles */
}

@media (orientation: landscape) {
    /* Landscape specific styles */
    .grid-4,
    .grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .header,
    .footer,
    .sidebar,
    .mobile-menu-btn,
    .search-btn,
    .btn,
    .newsletter {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: none;
    }
    
    .container {
        max-width: 100%;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: more) {
    :root {
        --text-color: #000;
        --bg-light: #f0f0f0;
    }
    
    .btn-primary {
        border: 2px solid var(--primary-color);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --bg-light: #2a2a2a;
        --text-color: #e0e0e0;
        --text-light: #b0b0b0;
        --border-color: #333;
    }
    
    .card {
        background-color: #2a2a2a;
    }
    
    .category-card {
        background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    }
}

/* ============================================
   CSCSTUDY HEADER + HOMEPAGE RESPONSIVE OVERRIDES
   ============================================ */

@media (max-width: 1100px) {
    .header-nav-tier .nav-menu > li > a {
        padding-left: 10px;
        padding-right: 10px;
        font-size: 12px;
    }

    .category-post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .recent-post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .header-top-tier {
        padding: 10px 0;
    }

    .header-branding {
        min-height: 44px;
    }

    .site-logo-image {
        max-width: 140px;
        max-height: 42px;
    }

    .site-title {
        font-size: 23px;
    }

    .header-nav-tier,
    .nav-container {
        min-height: 44px;
    }

    .nav-container {
        position: relative;
        align-items: center;
    }

    .mobile-menu-btn {
        width: 44px;
        height: 44px;
        display: inline-flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0;
        background: transparent;
        border: 0;
        color: #fff;
        cursor: pointer;
    }

    .menu-icon-line {
        display: block;
        width: 19px;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
    }

    .main-nav {
        flex: 0 0 auto;
    }

    .header-nav-tier .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1200;
        width: 100%;
        max-height: none;
        display: none;
        flex-direction: column;
        align-items: stretch;
        overflow: visible;
        background: #fff;
        border: 1px solid #dfe7ef;
        border-top: 0;
        box-shadow: 0 14px 28px rgba(22, 50, 78, 0.14);
    }

    .header-nav-tier .nav-menu.mobile-active {
        display: flex;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
    }

    .header-nav-tier .nav-menu > li {
        display: block;
        border-bottom: 1px solid #edf1f5;
    }

    .header-nav-tier .nav-menu > li:last-child {
        border-bottom: 0;
    }

    .header-nav-tier .nav-menu > li > a {
        min-height: 44px;
        justify-content: space-between;
        padding: 11px 15px;
        color: #243b53;
        background: #fff;
        font-size: 13px;
    }

    .header-nav-tier .nav-menu > li > a:hover,
    .header-nav-tier .nav-menu > li.current-menu-item > a,
    .header-nav-tier .nav-menu > li.current-menu-ancestor > a {
        background: #f2f7fc;
        color: var(--primary-color);
    }

    .header-nav-tier .menu-item-has-children > a::before {
        border-color: currentColor;
        margin-left: auto;
    }

    .header-nav-tier .sub-menu,
    .header-nav-tier .menu-item-has-children:hover > .sub-menu,
    .header-nav-tier .menu-item-has-children:focus-within > .sub-menu {
        position: static;
        display: none;
        min-width: 0;
        padding: 4px 0;
        background: #f7f9fc;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .header-nav-tier .menu-item-has-children.submenu-open > .sub-menu {
        display: block;
    }

    .header-nav-tier .sub-menu a {
        padding: 10px 26px;
        color: #40566b;
        font-size: 13px;
    }

    .header-search .search-btn {
        width: 44px;
        min-height: 44px;
        display: inline-flex !important;
    }

    .search-box {
        padding: 12px 0;
    }

    .section-heading-row {
        margin-bottom: 18px;
    }

    .section-heading-copy h2 {
        font-size: 23px;
    }

    .category-post-grid,
    .recent-post-grid {
        grid-template-columns: 1fr;
    }

    .category-post-card {
        grid-template-columns: 118px minmax(0, 1fr);
    }

    .recent-post-content {
        padding: 15px 16px 18px;
    }

    .recent-post-title {
        font-size: 17px;
    }
}

@media (max-width: 420px) {
    .site-title {
        font-size: 21px;
    }

    .category-post-card {
        grid-template-columns: 105px minmax(0, 1fr);
    }

    .category-post-content {
        padding: 11px 12px;
    }

    .category-post-title {
        font-size: 14px;
    }
}
