/* ============================================================================
   RESPONSIVE CSS
   Tablet and Mobile Optimization
   ============================================================================ */

/* ============================================================================
   TABLET LAYOUT (768px - 1024px)
   ============================================================================ */

@media (max-width: 1024px) {
    :root {
        font-size: 15px;
    }

    .section-container {
        padding: 0 var(--spacing-lg);
    }

    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }

    .chalk-title {
        font-size: 2.5rem;
    }

    /* Navigation */
    .nav-menu {
        gap: var(--spacing-md);
    }

    .nav-link {
        font-size: 0.85rem;
    }

    /* Hero */
    .hero-title {
        font-size: 3rem;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .chalk-button {
        width: 100%;
        max-width: 250px;
    }

    /* Skills Grid */
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    /* Experience Timeline */
    .timeline-line {
        display: none;
    }

    .experience-item {
        grid-template-columns: 1fr;
        margin-bottom: var(--spacing-lg);
    }

    .experience-item:nth-child(odd) .experience-content,
    .experience-item:nth-child(even) .experience-content {
        text-align: left;
        padding: var(--spacing-md);
        border: 1px solid var(--chalk-primary);
        border-radius: var(--border-radius-md);
        background: rgba(21, 25, 23, 0.3);
    }

    .experience-item:nth-child(odd) .experience-content {
        border-right: 1px solid var(--chalk-primary);
    }

    .timeline-dot {
        display: none;
    }

    /* Projects Grid */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Architecture */
    .architecture-svg {
        max-height: 400px;
    }

    /* AI Topics */
    .ai-topics {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Education */
    .education-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-text {
        font-size: 0.85rem;
    }
}

/* ============================================================================
   MOBILE LAYOUT (480px - 767px)
   ============================================================================ */

@media (max-width: 767px) {
    :root {
        font-size: 14px;
    }

    /* General Layout */
    .section {
        min-height: auto;
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .section:first-of-type {
        padding-top: calc(var(--spacing-xl) + 100px);
    }

    .section-container {
        padding: 0;
    }

    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .chalk-title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    /* Header & Navigation */
    .navbar-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: rgba(17, 20, 18, 0.99);
        width: 100%;
        text-align: center;
        transition: left var(--transition-medium) var(--transition-easing);
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.3);
        padding: var(--spacing-lg) 0;
        gap: var(--spacing-md);
        z-index: 99;
        border-bottom: 1px solid rgba(242, 240, 230, 0.1);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-link {
        font-size: 1rem;
        padding: var(--spacing-sm) 0;
        display: block;
    }

    .nav-link::after {
        display: none;
    }

    /* Hero Section */
    .hero-section {
        padding-top: calc(var(--spacing-xl) + 80px);
    }

    .hero-title {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-sm);
    }

    .title-line {
        display: block;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-description {
        flex-direction: column;
        gap: 0;
        font-size: 0.9rem;
    }

    .tech-line {
        display: block;
        margin-bottom: var(--spacing-xs);
    }

    .hero-tagline {
        font-size: 0.95rem;
        margin: var(--spacing-md) 0;
    }

    .hero-cta {
        flex-direction: column;
        gap: var(--spacing-sm);
        margin: var(--spacing-lg) 0;
    }

    .chalk-button {
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
    }

    .hero-social {
        gap: var(--spacing-md);
        margin-top: var(--spacing-lg);
    }

    .social-link {
        font-size: 0.85rem;
    }

    .chalk-scroll-indicator {
        font-size: 1.5rem;
        bottom: 20px;
    }

    /* Section Title */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-lg);
    }

    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .about-text {
        font-size: 1rem;
    }

    .about-highlight .chalk-card {
        max-width: 100%;
    }

    /* Skills */
    .skills-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .skill-category {
        padding: var(--spacing-md);
    }

    .category-title {
        font-size: 1.3rem;
    }

    .skill-tags {
        gap: var(--spacing-xs);
    }

    .skill-tag {
        font-size: 0.75rem;
        padding: 3px 6px;
    }

    /* Experience */
    .experience-timeline {
        padding: var(--spacing-lg) 0;
    }

    .experience-item {
        grid-template-columns: 1fr;
        margin-bottom: var(--spacing-md);
    }

    .experience-item:nth-child(odd) .experience-content,
    .experience-item:nth-child(even) .experience-content {
        text-align: left;
        padding: var(--spacing-md);
        border: 1px solid var(--chalk-primary);
        border-radius: var(--border-radius-md);
        background: rgba(21, 25, 23, 0.3);
    }

    .experience-title {
        font-size: 1.1rem;
    }

    .experience-role {
        font-size: 0.95rem;
    }

    .experience-dates {
        font-size: 0.85rem;
    }

    .experience-highlights {
        font-size: 0.9rem;
        margin-bottom: var(--spacing-sm);
    }

    .experience-highlights li {
        padding-left: 16px;
        margin-bottom: var(--spacing-xs);
    }

    .timeline-dot {
        display: none;
    }

    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .project-card .chalk-card {
        padding: var(--spacing-md);
    }

    .project-title {
        font-size: 1.2rem;
    }

    .project-description {
        font-size: 0.95rem;
        margin-bottom: var(--spacing-sm);
    }

    .project-tech {
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-sm);
    }

    .tech-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .card-footer {
        padding-top: var(--spacing-sm);
    }

    .chalk-button.small {
        width: 100%;
    }

    /* Architecture */
    .architecture-svg {
        max-height: 300px;
    }

    .architecture-description {
        font-size: 0.95rem;
        padding: 0 var(--spacing-sm);
    }

    /* AI Section */
    .ai-intro {
        font-size: 1rem;
        margin-bottom: var(--spacing-lg);
    }

    .ai-topics {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .ai-topic {
        padding: var(--spacing-md);
    }

    .ai-topic h3 {
        font-size: 1.1rem;
    }

    .ai-topic p {
        font-size: 0.9rem;
    }

    /* Education */
    .education-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .education-item {
        padding: var(--spacing-md);
    }

    .education-item h3 {
        font-size: 1.1rem;
    }

    .education-issuer {
        font-size: 0.9rem;
    }

    .education-date {
        font-size: 0.8rem;
    }

    /* Contact */
    .contact-content {
        padding: 0 var(--spacing-md);
    }

    .contact-description {
        font-size: 1rem;
        margin-bottom: var(--spacing-lg);
    }

    .contact-links {
        gap: var(--spacing-md);
    }

    .floating-contact-stack {
        right: 10px;
        top: 44%;
    }

    .floating-email-btn {
        width: 52px;
        height: 52px;
        font-size: 1.25rem;
    }

    .floating-social-link {
        width: 52px;
        height: 52px;
        font-size: 0.9rem;
        padding: 0;
    }

    .contact-modal-panel {
        width: calc(100% - 1.25rem);
        margin: 2vh auto;
        padding: var(--spacing-lg);
        max-height: calc(100dvh - 4vh);
    }

    .contact-modal .chalk-title {
        font-size: 1.55rem;
        padding-right: 2rem;
    }

    .contact-link {
        font-size: 0.95rem;
    }

    /* Footer */
    .footer {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .footer-text {
        font-size: 0.8rem;
    }

    .footer-credit {
        font-size: 1rem;
    }

    .chalk-divider {
        width: 150px;
    }

    /* Buttons */
    .chalk-button {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================================================
   SMALL MOBILE (< 480px)
   ============================================================================ */

@media (max-width: 479px) {
    :root {
        font-size: 13px;
    }

    /* Hero */
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    /* Section Title */
    .section-title {
        font-size: 1.5rem;
    }

    .chalk-divider {
        width: 120px;
    }

    /* Skills Grid - Single Column */
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .skill-category {
        padding: var(--spacing-md) var(--spacing-sm);
    }

    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Spacing adjustments */
    .section {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .section:first-of-type {
        padding-top: calc(var(--spacing-lg) + 100px);
    }

    .contact-modal {
        padding: max(0.5rem, env(safe-area-inset-top)) 0 max(0.5rem, env(safe-area-inset-bottom));
    }

    .contact-modal-panel {
        width: calc(100% - 0.75rem);
        margin: 0 auto;
        padding: var(--spacing-md);
        border-radius: var(--border-radius-md);
        max-height: calc(100dvh - 1rem);
    }

    .contact-modal .chalk-title {
        font-size: 1.35rem;
    }
}

/* ============================================================================
   TOUCH DEVICE SPECIFIC
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .chalk-button:hover {
        color: var(--chalk-primary);
        border-color: var(--chalk-primary);
    }

    .chalk-button:hover::before {
        transform: translateX(-100%);
        background: transparent;
    }

    .skill-category:hover {
        background: rgba(21, 25, 23, 0.3);
    }

    .chalk-card:hover {
        border-color: var(--chalk-primary);
        background: rgba(21, 25, 23, 0.5);
        box-shadow: none;
    }

    /* Ensure touch targets are large enough */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Disable custom cursor on touch devices */
    #cursor-canvas {
        display: none;
    }

    /* Simplify hover states */
    .project-card:hover {
        transform: none;
    }

    .experience-content:hover {
        transform: none;
    }
}

/* ============================================================================
   LANDSCAPE ORIENTATION
   ============================================================================ */

@media (max-height: 600px) and (orientation: landscape) {
    .section {
        min-height: auto;
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .hero-section {
        padding: var(--spacing-lg);
    }

    .hero-social {
        gap: var(--spacing-sm);
    }

    .chalk-scroll-indicator {
        display: none;
    }

    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.2rem; }
}

/* ============================================================================
   HIGH DPI SCREENS
   ============================================================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chalk-title {
        text-shadow: 
            1px 1px 0 rgba(0, 0, 0, 0.3),
            2px 2px 3px rgba(0, 0, 0, 0.2),
            4px 4px 8px rgba(0, 0, 0, 0.15);
    }

    .chalk-button {
        border-width: 1px;
    }

    .chalk-card {
        border-width: 1px;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .header,
    .footer,
    .chalk-scroll-indicator,
    .menu-toggle,
    .chalk-button,
    .hero-cta,
    .hero-social {
        display: none;
    }

    .section {
        min-height: auto;
        page-break-inside: avoid;
    }

    a {
        text-decoration: underline;
    }

    body {
        background: white;
        color: black;
    }

    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
    }
}

/* ============================================================================
   PREFERS COLOR SCHEME DARK
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    /* Already dark by default, so no changes needed */
}

/* ============================================================================
   PREFERS COLOR SCHEME LIGHT
   ============================================================================ */

@media (prefers-color-scheme: light) {
    /* Provide light mode alternative if needed */
    /* For now, keeping the dark blackboard aesthetic */
}
