/**
 * ============================================================
 * KCGF Website - Global Responsive Stylesheet
 * File: assets/css/responsive.css
 * Version: 1.0.0
 *
 * Purpose:
 * 1. Global responsive adjustments
 * 2. Tablet and mobile layouts
 * 3. Responsive typography and spacing
 * 4. Responsive grids and media
 * 5. Accessibility and touch improvements
 *
 * Note:
 * Component-specific styles belong in their own CSS files.
 * ============================================================
 */


/* ============================================================
   1. RESPONSIVE FOUNDATION
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: clip;
    scroll-padding-top: 100px;
}

body {
    width: 100%;
    min-width: 320px;
    overflow-x: clip;
}

img,
picture,
video,
canvas,
iframe,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

iframe {
    width: 100%;
    border: 0;
}

table {
    max-width: 100%;
}

pre,
code {
    overflow-wrap: anywhere;
}

p,
li,
td,
th,
a,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

.kcgf-container,
.kcgf-container-wide,
.kcgf-container-narrow {
    width: min(100% - 40px, 1200px);
    margin-inline: auto;
}

.kcgf-container-wide {
    max-width: 1400px;
}

.kcgf-container-narrow {
    max-width: 850px;
}


/* ============================================================
   2. RESPONSIVE TYPOGRAPHY
   ============================================================ */

.kcgf-display-title {
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    line-height: 1.12;
}

.kcgf-page-title {
    font-size: clamp(2rem, 4vw, 3.75rem);
    line-height: 1.18;
}

.kcgf-section-title {
    font-size: clamp(1.7rem, 3vw, 2.75rem);
    line-height: 1.25;
}

.kcgf-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.65;
}

.kcgf-content {
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    line-height: 1.85;
}

.kcgf-content h2 {
    font-size: clamp(1.5rem, 2.5vw, 2.1rem);
}

.kcgf-content h3 {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
}


/* ============================================================
   3. RESPONSIVE GRID SYSTEM
   ============================================================ */

.kcgf-grid,
.kcgf-grid-2,
.kcgf-grid-3,
.kcgf-grid-4,
.kcgf-grid-5,
.kcgf-grid-6 {
    min-width: 0;
}

.kcgf-grid > *,
.kcgf-grid-2 > *,
.kcgf-grid-3 > *,
.kcgf-grid-4 > *,
.kcgf-grid-5 > *,
.kcgf-grid-6 > * {
    min-width: 0;
}

.kcgf-responsive-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 250px), 1fr)
    );
    gap: clamp(16px, 2vw, 28px);
}

.kcgf-responsive-grid-small {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 180px), 1fr)
    );
    gap: 18px;
}

.kcgf-responsive-grid-large {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 320px), 1fr)
    );
    gap: 28px;
}


/* ============================================================
   4. RESPONSIVE SECTION SPACING
   ============================================================ */

.kcgf-section,
.kcgf-section-sm,
.kcgf-section-lg {
    min-width: 0;
}

.kcgf-section {
    padding-block: clamp(48px, 7vw, 90px);
}

.kcgf-section-sm {
    padding-block: clamp(32px, 4vw, 55px);
}

.kcgf-section-lg {
    padding-block: clamp(60px, 9vw, 120px);
}

.kcgf-section-header {
    max-width: 800px;
    margin-inline: auto;
}

.kcgf-section-header p {
    max-width: 700px;
    margin-inline: auto;
}


/* ============================================================
   5. RESPONSIVE FLEX UTILITIES
   ============================================================ */

.kcgf-flex-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.kcgf-flex-responsive > * {
    min-width: 0;
}

.kcgf-responsive-center {
    text-align: center;
}

.kcgf-responsive-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kcgf-responsive-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}


/* ============================================================
   6. RESPONSIVE IMAGES AND MEDIA
   ============================================================ */

.kcgf-image-responsive {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.kcgf-image-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kcgf-media-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--kcgf-radius-lg, 16px);
}

.kcgf-media-16-9 {
    aspect-ratio: 16 / 9;
}

.kcgf-media-4-3 {
    aspect-ratio: 4 / 3;
}

.kcgf-media-square {
    aspect-ratio: 1 / 1;
}

.kcgf-media-wrapper img,
.kcgf-media-wrapper video,
.kcgf-media-wrapper iframe {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ============================================================
   7. RESPONSIVE TABLES
   ============================================================ */

.kcgf-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.kcgf-table-wrapper table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.kcgf-table-wrapper th,
.kcgf-table-wrapper td {
    padding: 12px 14px;
    vertical-align: top;
}

.kcgf-table-scroll-hint {
    display: none;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--kcgf-text-muted, #777);
}


/* ============================================================
   8. RESPONSIVE FORMS
   ============================================================ */

.kcgf-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.kcgf-form-grid .kcgf-form-full {
    grid-column: 1 / -1;
}

.kcgf-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.kcgf-form-actions .kcgf-btn {
    min-width: 130px;
}


/* ============================================================
   9. RESPONSIVE BUTTONS
   ============================================================ */

.kcgf-button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.kcgf-button-group .kcgf-btn {
    flex-shrink: 0;
}

.kcgf-btn-responsive {
    max-width: 100%;
    white-space: normal;
}


/* ============================================================
   10. RESPONSIVE CONTENT
   ============================================================ */

.kcgf-content img {
    max-width: 100%;
    height: auto;
}

.kcgf-content figure {
    max-width: 100%;
    margin-inline: 0;
}

.kcgf-content blockquote {
    max-width: 100%;
}

.kcgf-content ul,
.kcgf-content ol {
    padding-inline-start: 1.5rem;
}

.kcgf-content pre {
    max-width: 100%;
    overflow-x: auto;
}

.kcgf-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
}


/* ============================================================
   11. RESPONSIVE EMBEDS
   ============================================================ */

.kcgf-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--kcgf-radius-lg, 16px);
}

.kcgf-embed iframe,
.kcgf-embed video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}


/* ============================================================
   12. LARGE DESKTOP
   ============================================================ */

@media (min-width: 1440px) {

    .kcgf-container {
        max-width: 1280px;
    }

    .kcgf-container-wide {
        max-width: 1500px;
    }

    .kcgf-section {
        padding-block: 100px;
    }

}


/* ============================================================
   13. LAPTOP
   ============================================================ */

@media (max-width: 1199px) {

    .kcgf-container,
    .kcgf-container-wide,
    .kcgf-container-narrow {
        width: min(100% - 36px, 1100px);
    }

    .kcgf-responsive-grid-large {
        grid-template-columns: repeat(
            auto-fit,
            minmax(min(100%, 280px), 1fr)
        );
    }

}


/* ============================================================
   14. TABLET LANDSCAPE
   ============================================================ */

@media (max-width: 991px) {

    html {
        scroll-padding-top: 80px;
    }

    .kcgf-container,
    .kcgf-container-wide,
    .kcgf-container-narrow {
        width: min(100% - 32px, 900px);
    }

    .kcgf-grid-5,
    .kcgf-grid-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .kcgf-section {
        padding-block: 65px;
    }

    .kcgf-section-lg {
        padding-block: 80px;
    }

    .kcgf-responsive-between {
        align-items: flex-start;
    }

}


/* ============================================================
   15. TABLET PORTRAIT
   ============================================================ */

@media (max-width: 767px) {

    html {
        scroll-padding-top: 70px;
    }

    .kcgf-container,
    .kcgf-container-wide,
    .kcgf-container-narrow {
        width: calc(100% - 30px);
    }

    /* Typography */

    .kcgf-display-title {
        font-size: clamp(2rem, 8vw, 3.2rem);
    }

    .kcgf-page-title {
        font-size: clamp(1.9rem, 7vw, 2.8rem);
    }

    .kcgf-section-title {
        font-size: clamp(1.65rem, 5.5vw, 2.2rem);
    }

    .kcgf-subtitle {
        font-size: 1rem;
    }

    /* Grids */

    .kcgf-grid-3,
    .kcgf-grid-4,
    .kcgf-grid-5,
    .kcgf-grid-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kcgf-grid-2 {
        grid-template-columns: 1fr;
    }

    .kcgf-responsive-grid-large {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Sections */

    .kcgf-section {
        padding-block: 55px;
    }

    .kcgf-section-sm {
        padding-block: 35px;
    }

    .kcgf-section-lg {
        padding-block: 65px;
    }

    /* Flex */

    .kcgf-flex-responsive {
        gap: 15px;
    }

    .kcgf-responsive-between {
        flex-direction: column;
        align-items: stretch;
    }

    /* Forms */

    .kcgf-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .kcgf-form-grid .kcgf-form-full {
        grid-column: auto;
    }

    /* Buttons */

    .kcgf-button-group {
        gap: 10px;
    }

    /* Tables */

    .kcgf-table-scroll-hint {
        display: block;
    }

    /* Content */

    .kcgf-content ul,
    .kcgf-content ol {
        padding-inline-start: 1.25rem;
    }

}


/* ============================================================
   16. MOBILE
   ============================================================ */

@media (max-width: 575px) {

    html {
        scroll-padding-top: 60px;
    }

    body {
        font-size: 15px;
    }

    .kcgf-container,
    .kcgf-container-wide,
    .kcgf-container-narrow {
        width: calc(100% - 28px);
    }

    /* Typography */

    .kcgf-display-title {
        font-size: clamp(1.85rem, 9vw, 2.6rem);
        line-height: 1.15;
    }

    .kcgf-page-title {
        font-size: clamp(1.75rem, 8vw, 2.4rem);
    }

    .kcgf-section-title {
        font-size: clamp(1.5rem, 7vw, 1.9rem);
    }

    .kcgf-content {
        font-size: 0.96rem;
        line-height: 1.8;
    }

    /* Grids */

    .kcgf-grid,
    .kcgf-grid-2,
    .kcgf-grid-3,
    .kcgf-grid-4,
    .kcgf-grid-5,
    .kcgf-grid-6 {
        grid-template-columns: 1fr;
    }

    .kcgf-responsive-grid,
    .kcgf-responsive-grid-large {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .kcgf-responsive-grid-small {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    /* Sections */

    .kcgf-section {
        padding-block: 44px;
    }

    .kcgf-section-sm {
        padding-block: 28px;
    }

    .kcgf-section-lg {
        padding-block: 55px;
    }

    /* Cards */

    .kcgf-card {
        max-width: 100%;
    }

    /* Buttons */

    .kcgf-button-group {
        width: 100%;
    }

    .kcgf-button-group .kcgf-btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .kcgf-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kcgf-form-actions .kcgf-btn {
        width: 100%;
    }

    /* Media */

    .kcgf-media-wrapper {
        border-radius: 12px;
    }

    /* Content */

    .kcgf-content blockquote {
        margin-inline: 0;
        padding: 16px;
    }

    /* Table */

    .kcgf-table-wrapper table {
        min-width: 520px;
    }

}


/* ============================================================
   17. SMALL MOBILE
   ============================================================ */

@media (max-width: 380px) {

    .kcgf-container,
    .kcgf-container-wide,
    .kcgf-container-narrow {
        width: calc(100% - 24px);
    }

    .kcgf-display-title {
        font-size: 1.8rem;
    }

    .kcgf-page-title {
        font-size: 1.65rem;
    }

    .kcgf-section-title {
        font-size: 1.45rem;
    }

    .kcgf-responsive-grid-small {
        grid-template-columns: 1fr;
    }

    .kcgf-button-group .kcgf-btn {
        flex-basis: 100%;
    }

}


/* ============================================================
   18. TOUCH DEVICE IMPROVEMENTS
   ============================================================ */

@media (hover: none) and (pointer: coarse) {

    .kcgf-hover-lift:hover,
    .kcgf-hover-scale:hover,
    .kcgf-hover-rotate:hover,
    .kcgf-hover-3d:hover {
        transform: none;
    }

    .kcgf-btn,
    button,
    .kcgf-card a,
    .kcgf-nav-link {
        -webkit-tap-highlight-color: transparent;
    }

    button,
    .kcgf-btn,
    input,
    select,
    textarea {
        touch-action: manipulation;
    }

}


/* ============================================================
   19. LANDSCAPE MOBILE
   ============================================================ */

@media (max-height: 500px) and (orientation: landscape) {

    .kcgf-section {
        padding-block: 35px;
    }

    .kcgf-section-lg {
        padding-block: 45px;
    }

}


/* ============================================================
   20. ACCESSIBILITY
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}

@media (forced-colors: active) {

    .kcgf-btn,
    .kcgf-card,
    .kcgf-form-control {
        border: 1px solid ButtonText;
    }

}


/* ============================================================
   END OF RESPONSIVE STYLESHEET
   ============================================================ */
