/* Country guide pages (study-in-*): long-form content sections. Loaded after study-in-usa.css only on
   pages that use the sg-* markup, so the other country pages keep their current layout. */

/* Tighter vertical rhythm for this content-heavy page (site default is 112px / 78px). */
main>.section {
    padding: 72px 0
}

.section-intro {
    margin-bottom: 32px
}

/* The two university sections use the same heading size as the guide sections. */
#top-universities .section-intro h2,
#states .section-intro h2 {
    max-width: 1000px;
    margin-bottom: 0;
    font-size: clamp(2rem, 4.2vw, 3rem);
    line-height: 1.25
}

.sg-head {
    margin-bottom: 28px
}

.sg-head .country-intro-title {
    max-width: 1000px
}

.sg-head p {
    max-width: 1000px;
    margin-top: 14px;
    font-size: 1.05rem;
    line-height: 1.75
}

.sg-reviewed {
    margin-bottom: 10px;
    color: var(--copy);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .02em
}

.sg-section-copy {
    max-width: 1000px;
    margin-top: 14px
}

.sg-copy p,
.sg-section-copy p {
    font-size: 1.02rem;
    line-height: 1.75
}

.sg-copy p+p,
.sg-copy p+.sg-list,
.sg-copy .sg-list+p,
.sg-copy .sg-steps+p {
    margin-top: 16px
}

.sg-copy h3 {
    margin: 0 0 12px;
    font-size: 1.12rem
}

.sg-copy p strong {
    color: var(--ink);
    font-weight: 620
}

/* Two columns of content side by side; stacks on tablets and phones. */
.sg-split {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 48px;
    align-items: start
}

.sg-split>p {
    margin-top: 0 !important
}

.sg-after {
    margin-top: 28px
}

.sg-text-cols {
    column-count: 2;
    column-gap: 48px
}

.sg-text-cols p {
    break-inside: avoid
}

.sg-list {
    margin: 12px 0 0;
    padding: 0;
    list-style: none
}

.sg-list li {
    position: relative;
    padding-left: 22px;
    color: var(--copy);
    font-size: 1rem;
    line-height: 1.7;
    break-inside: avoid
}

.sg-list li+li {
    margin-top: 8px
}

.sg-list li::before {
    content: "";
    position: absolute;
    top: .72em;
    left: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red)
}

.sg-list strong {
    color: var(--ink);
    font-weight: 620
}

/* Short lists flow into two columns inside their panel. */
.sg-list.sg-cols {
    column-count: 2;
    column-gap: 28px
}

.sg-list.sg-cols li {
    margin: 0 0 8px
}

/* Why Australia: 3 cards then 2 wider cards, so the grid has no empty cell */
.sg-card-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line)
}

.sg-card-grid article {
    grid-column: span 2;
    padding: 28px 26px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff
}

.sg-card-grid article:nth-child(n+4) {
    grid-column: span 3
}

.sg-card-grid h3 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    line-height: 1.4
}

.sg-card-grid p {
    font-size: .95rem;
    line-height: 1.7
}

/* Popular study areas */
.sg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none
}

.sg-chips li {
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.4
}

.sg-note {
    margin-top: 16px;
    color: var(--copy);
    font-size: .875rem;
    line-height: 1.7
}

/* Top universities: 5 across, so the 10 institutions fill two full rows */
#top-universities .country-university-grid {
    grid-template-columns: repeat(5, 1fr)
}

#top-universities .country-university-grid article {
    min-height: 0;
    padding: 26px 22px
}

/* Panels (eligibility, budget, Why KPGE…) */
.sg-panels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px
}

.sg-panel {
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff
}

.sg-panel h3 {
    margin: 0 0 6px;
    font-size: 1.12rem
}

.sg-panel>p:first-child {
    margin-top: 0
}

.sg-tagline {
    color: var(--red);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5
}

/* Fees table */
.sg-table-wrap {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff
}

.sg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
    line-height: 1.65
}

.sg-table th,
.sg-table td {
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top
}

.sg-table thead th {
    background: var(--soft);
    color: var(--ink);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase
}

.sg-table tbody th {
    width: 18%;
    color: var(--ink);
    font-weight: 620
}

.sg-table td {
    color: var(--copy)
}

.sg-table tbody tr:last-child th,
.sg-table tbody tr:last-child td {
    border-bottom: 0
}

/* Application steps: two columns, numbered down the first column then the second */
.sg-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: sg-step;
    column-count: 2;
    column-gap: 48px
}

.sg-steps li {
    position: relative;
    margin: 0 0 14px;
    padding: 0 0 0 46px;
    color: var(--copy);
    font-size: 1rem;
    line-height: 1.7;
    counter-increment: sg-step;
    break-inside: avoid
}

.sg-steps li::before {
    content: counter(sg-step);
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1
}

/* FAQ: same look as the /faq page accordion */
.sg-faq-cols {
    gap: 10px 22px
}

.sg-faq-list {
    display: grid;
    gap: 10px
}

.sg-faq-item {
    border: 1px solid var(--line);
    background: #fff;
    overflow: hidden;
    transition: border-color .2s
}

.sg-faq-item:hover {
    border-color: #c9c4c2
}

.sg-faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    list-style: none;
    color: var(--ink);
    font-weight: 620;
    font-size: .95rem;
    line-height: 1.5;
    cursor: pointer
}

.sg-faq-question::-webkit-details-marker {
    display: none
}

.sg-faq-question:hover {
    background: var(--soft)
}

.sg-faq-question .plus {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    background: var(--soft);
    color: var(--red);
    font-size: 1.25rem;
    line-height: 1;
    transition: transform .2s, background .2s
}

.sg-faq-item[open] .sg-faq-question {
    color: var(--red);
    background: var(--soft)
}

.sg-faq-item[open] .plus {
    transform: rotate(45deg);
    background: #ece7e6
}

.sg-faq-answer {
    padding: 0 20px 20px;
    color: var(--copy);
    font-size: .95rem;
    line-height: 1.75
}

.sg-faq-answer p {
    margin: 0
}

/* Why KPGE: the 11-item list gets the wider panel and three columns so both panels end level */
#why-kpge .sg-panels {
    grid-template-columns: 1fr 2fr
}

#why-kpge .sg-panel:last-child .sg-list.sg-cols {
    column-count: 3
}

@media(max-width:1200px) {
    #why-kpge .sg-panel:last-child .sg-list.sg-cols {
        column-count: 2
    }

    #top-universities .country-university-grid {
        grid-template-columns: repeat(3, 1fr)
    }
}

@media(max-width:1000px) {
    #why-kpge .sg-panels {
        grid-template-columns: 1fr
    }

    #why-kpge .sg-panel:last-child .sg-list.sg-cols {
        column-count: 2
    }

    main>.section {
        padding: 56px 0
    }

    .sg-split,
    .sg-panels {
        grid-template-columns: 1fr
    }

    .sg-text-cols {
        column-count: 1
    }

    .sg-card-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .sg-card-grid article,
    .sg-card-grid article:nth-child(n+4) {
        grid-column: span 1
    }

    .sg-card-grid article:nth-child(5) {
        grid-column: span 2
    }

    #top-universities .country-university-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:767px) {
    .sg-steps {
        column-count: 1
    }

    /* Stack the fees table: each level becomes a block with labelled cells */
    .sg-table thead {
        display: none
    }

    .sg-table,
    .sg-table tbody,
    .sg-table tr,
    .sg-table th,
    .sg-table td {
        display: block;
        width: 100%
    }

    .sg-table tbody tr {
        border-bottom: 1px solid var(--line)
    }

    .sg-table tbody tr:last-child {
        border-bottom: 0
    }

    .sg-table tbody th {
        width: 100%;
        padding: 16px 20px 4px;
        border: 0;
        color: var(--red)
    }

    .sg-table td {
        padding: 6px 20px 12px;
        border: 0
    }

    .sg-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        color: var(--ink);
        font-size: .75rem;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase
    }
}

@media(max-width:680px) {
    main>.section {
        padding: 44px 0
    }

    .section-intro,
    .sg-head {
        margin-bottom: 20px
    }

    .sg-after {
        margin-top: 20px
    }

    .sg-card-grid {
        grid-template-columns: 1fr
    }

    .sg-card-grid article:nth-child(5) {
        grid-column: span 1
    }

    .sg-card-grid article {
        padding: 22px 20px
    }

    #top-universities .country-university-grid {
        grid-template-columns: 1fr
    }

    .sg-list.sg-cols,
    #why-kpge .sg-panel:last-child .sg-list.sg-cols {
        column-count: 1
    }

    .sg-panel {
        padding: 22px 20px
    }

    .sg-faq-question {
        padding: 16px
    }

    .sg-faq-answer {
        padding: 0 16px 16px
    }
}

/* Top universities with 9 institutions (Georgia): 3 x 3, so no empty cell */
#top-universities .country-university-grid.sg-grid-3 {
    grid-template-columns: repeat(3, 1fr)
}

@media(max-width:767px) {
    #top-universities .country-university-grid.sg-grid-3 {
        grid-template-columns: 1fr
    }
}

/* University list with an odd count (Mauritius, 5): cards share each row, so no row ends in an empty slot */
#states .country-uni-grid.sg-uni-flex {
    display: flex;
    flex-wrap: wrap
}

#states .country-uni-grid.sg-uni-flex>article {
    flex: 1 1 220px
}

/* Top universities with a count that doesn't fill a fixed grid (New Zealand, 11): about 4 per row on desktop,
   and the last row's cards widen to fill the width instead of leaving empty cells */
#top-universities .country-university-grid.sg-grid-flex {
    display: flex;
    flex-wrap: wrap
}

#top-universities .country-university-grid.sg-grid-flex>article {
    flex: 1 1 260px
}

/* Top universities with 10 institutions (UK): 5 + 5 on desktop, pairs on tablet, so no row ends half-empty */
#top-universities .country-university-grid.sg-grid-10 {
    grid-template-columns: repeat(5, 1fr)
}

@media(max-width:1200px) {
    #top-universities .country-university-grid.sg-grid-10 {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:680px) {
    #top-universities .country-university-grid.sg-grid-10 {
        grid-template-columns: 1fr
    }
}
