/* =========================================================
   CASPA Character Counter
   File: caspa.css
   ========================================================= */


/* =========================================================
   RESET / BASE
   ========================================================= */

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: #f3f4f6;
    color: #202124;
    font-family: "Poppins", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.65;
}

main {
    display: block;
}

p {
    margin-top: 0;
    margin-bottom: 1.15rem;
}

a {
    color: inherit;
}

button,
textarea {
    font-family: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}


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

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* =========================================================
   MAIN PAGE
   ========================================================= */

.caspa-section {
    width: 100%;
    padding-top: 110px;
    padding-right: 20px;
    padding-bottom: 70px;
    padding-left: 20px;
}

.caspa-container {
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
}


/* =========================================================
   PAGE HEADING
   ========================================================= */

.caspa-heading {
    width: 100%;
    max-width: 850px;
    margin: 0 auto 26px;
    text-align: center;
}

.caspa-heading h1 {
    margin: 0 0 10px;
    color: #202124;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.caspa-intro {
    max-width: 800px;
    margin: 0 auto;
    color: #5c616a;
    font-size: 18px;
    line-height: 1.6;
}


/* =========================================================
   COUNTER WRAPPER
   ========================================================= */

.counter-wrapper {
    width: 100%;
    margin: 0 auto 40px;
    padding: 24px;
    background-color: #ffffff;
    border: 1px solid #dfe2e6;
    border-radius: 14px;
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.025),
        0 8px 22px rgba(0, 0, 0, 0.045);
}


/* =========================================================
   CHARACTER METRICS
   ========================================================= */

.counter-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.counter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 94px;
    padding: 13px 16px;
    background-color: #f7f8fa;
    border: 1px solid #dfe2e6;
    border-radius: 10px;
    text-align: center;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.counter-label {
    display: block;
    margin-bottom: 2px;
    color: #5f6570;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.counter-number {
    color: #202124;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.counter-limit {
    color: #777d86;
    font-size: 19px;
    font-weight: 500;
}

#typed,
#remaining {
    transition: color 0.2s ease;
}


/* =========================================================
   OVER CHARACTER LIMIT
   ========================================================= */

.counter-card.over-limit {
    background-color: #fff3f3;
    border-color: #d93025;
}

.counter-card.over-limit .counter-number,
.counter-card.over-limit #typed,
.counter-card.over-limit #remaining {
    color: #c5221f;
}


/* =========================================================
   TEXTAREA
   ========================================================= */

.textarea-wrapper {
    width: 100%;
}

#userWord {
    display: block;
    width: 100%;
    height: 370px;
    min-height: 170px;
    margin: 0;
    padding: 17px 18px;
    resize: vertical;
    overflow-y: auto;
    background-color: #ffffff;
    color: #202124;
    border: 2px solid #c8ccd2;
    border-radius: 10px;
    outline: none;
    font-family: "Poppins", Arial, sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.6;
    caret-color: #202124;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#userWord::placeholder {
    color: #8b9098;
    opacity: 1;
}

#userWord:hover {
    border-color: #9da3ac;
}

#userWord:focus {
    border-color: #4f5968;
    box-shadow: 0 0 0 3px rgba(79, 89, 104, 0.12);
}

#userWord[aria-invalid="true"] {
    border-color: #d19a38;
}


/* =========================================================
   COPY / CLEAR / UNDO BUTTONS
   ========================================================= */

.counter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 10px;
    margin-bottom: 0;
}

.copyButton,
.clearButton {
    min-width: 105px;
    padding: 9px 16px;
    border: 0;
    border-radius: 7px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.1s ease;
}

.copyButton {
    background-color: #287a39;
}

.copyButton:hover {
    background-color: #216a31;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.clearButton {
    background-color: #c6403b;
}

.clearButton:hover {
    background-color: #ae342f;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.copyButton:active,
.clearButton:active {
    transform: translateY(1px);
}

.copyButton:focus-visible,
.clearButton:focus-visible {
    outline: 3px solid rgba(41, 89, 155, 0.25);
    outline-offset: 2px;
}

#copyButton,
#clearUndoButton {
    min-width: 105px;
}


/* =========================================================
   COPY BUTTON STATES
   ========================================================= */

#copyButton.copied {
    background-color: #1f6f30;
}

#copyButton.no-text {
    background-color: #6c727b;
}

#copyButton.copied:hover {
    background-color: #1f6f30;
}

#copyButton.no-text:hover {
    background-color: #6c727b;
}


/* =========================================================
   UNDO STATE
   ========================================================= */

#clearUndoButton.undo-active {
    background-color: #5d6470;
}

#clearUndoButton.undo-active:hover {
    background-color: #4f5660;
}


/* =========================================================
   COUNTER HELP
   ========================================================= */

.counter-help {
    margin: 13px 2px 0;
    color: #666c75;
    font-size: 14px;
    line-height: 1.55;
}

.counter-help strong {
    color: #454a52;
    font-weight: 600;
}


/* =========================================================
   COMPATIBILITY CHECKER
   ========================================================= */

.compatibility-wrapper {
    width: 100%;
    margin-top: 14px;
}


/* =========================================================
   COMPATIBILITY MESSAGES
   ========================================================= */

.compatibility-message {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.55;
}

.compatibility-message + .compatibility-message {
    margin-top: 10px;
}

.compatibility-message p {
    margin: 7px 0 0;
}

.compatibility-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-right: 5px;
    font-weight: 700;
}

.compatibility-warning-heading {
    display: flex;
    align-items: flex-start;
    gap: 2px;
}

.compatibility-warning-heading strong {
    font-weight: 650;
}


/* =========================================================
   ALL CLEAR
   ========================================================= */

.compatibility-ok {
    color: #266436;
    background-color: #f1f8f2;
    border: 1px solid #bfdec5;
}


/* =========================================================
   EMOJI / INVALID CHARACTER WARNING
   ========================================================= */

.compatibility-warning {
    color: #754300;
    background-color: #fff8ea;
    border: 1px solid #e6ca92;
}


/* =========================================================
   NORMALIZATION WARNING
   ========================================================= */

.compatibility-info {
    color: #315372;
    background-color: #f1f6fb;
    border: 1px solid #bed1e4;
}


/* =========================================================
   HIDDEN WARNINGS
   ========================================================= */

.compatibility-message[hidden] {
    display: none !important;
}


/* =========================================================
   INVALID / EMOJI CHARACTER LIST
   ========================================================= */

.invalid-character-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
}

.invalid-character-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    background-color: #ffffff;
    color: #842029;
    border: 1px solid #e2b6b9;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.invalid-character-symbol {
    font-size: 18px;
    line-height: 1;
}

.invalid-character-code {
    color: #6d727a;
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
}


/* =========================================================
   INFORMATIONAL CONTENT
   ========================================================= */

.caspa-content {
    width: 100%;
    padding: 34px 38px;
    background-color: #ffffff;
    border: 1px solid #dfe2e6;
    border-radius: 14px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.04);
}


/* =========================================================
   CONTENT SECTIONS
   ========================================================= */

.content-section {
    margin: 0 0 30px;
    padding: 0 0 30px;
    border-bottom: 1px solid #e7e9ec;
}

.content-section:last-of-type {
    margin-bottom: 0;
}

.content-section h2 {
    margin: 0 0 14px;
    color: #282c33;
    font-size: 25px;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -0.2px;
}

.content-section h3 {
    margin: 22px 0 8px;
    color: #333840;
    font-size: 19px;
    font-weight: 650;
    line-height: 1.4;
}

.content-section p {
    color: #474d56;
}


/* =========================================================
   BULLET LISTS
   ========================================================= */

.caspa-guidelines {
    margin: 15px 0 20px;
    padding-left: 27px;
    list-style-type: disc;
}

.caspa-guidelines li {
    display: list-item;
    margin-bottom: 9px;
    padding-left: 2px;
    color: #474d56;
    list-style-type: disc;
}

.caspa-guidelines li:last-child {
    margin-bottom: 0;
}

.caspa-guidelines li::marker {
    color: #555c66;
}


/* =========================================================
   GUIDELINE NOTE
   ========================================================= */

.guideline-note {
    margin-top: 18px;
    margin-bottom: 17px;
    padding: 13px 15px;
    background-color: #f6f7f8;
    color: #51565f;
    border-left: 4px solid #7a818b;
    border-radius: 4px;
}


/* =========================================================
   CONTENT LINKS
   ========================================================= */

.internal-link,
.official-source-link {
    display: inline;
    color: #155cb6;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.internal-link:hover,
.official-source-link:hover {
    color: #0d458d;
}

.internal-link:focus-visible,
.official-source-link:focus-visible {
    outline: 2px solid #4b79b5;
    outline-offset: 3px;
    border-radius: 2px;
}


/* =========================================================
   TESTED CHARACTER SECTION
   ========================================================= */

.character-testing-content {
    width: 100%;
}

.character-testing-content h3 {
    margin-top: 22px;
    margin-bottom: 9px;
}

.character-testing-content h3:first-child {
    margin-top: 4px;
}


/* =========================================================
   CHARACTER EXAMPLES
   ========================================================= */

.character-examples {
    width: 100%;
    margin-top: 9px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dedfe2;
    border-radius: 7px;
    font-size: 21px;
    line-height: 1.9;
    letter-spacing: 3px;
    overflow-wrap: anywhere;
    word-break: normal;
}


/* Rejected examples = red */

.character-examples.invalid-examples {
    border-left: 4px solid #c6403b !important;
}


/* Accepted examples = green */

.character-examples.valid-examples {
    border-left: 4px solid #39814b !important;
}


.testing-disclaimer {
    margin-top: 4px !important;
    margin-bottom: 0 !important;
    color: #686e76 !important;
    font-size: 13px;
    line-height: 1.55;
}


/* =========================================================
   HOW-TO LIST
   ========================================================= */

.how-to-list {
    margin: 15px 0 0;
    padding-left: 27px;
}

.how-to-list li {
    margin-bottom: 10px;
    padding-left: 3px;
    color: #474d56;
}

.how-to-list li:last-child {
    margin-bottom: 0;
}


/* =========================================================
   FAQ
   ========================================================= */

.faq-section {
    border-bottom: 0;
}

.faq-item {
    padding: 19px 0;
    border-bottom: 1px solid #e9eaec;
}

.faq-item:first-of-type {
    padding-top: 5px;
}

.faq-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.faq-item h3 {
    margin: 0 0 8px;
    color: #30343b;
    font-size: 18px;
    font-weight: 650;
    line-height: 1.45;
}

.faq-item p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   PRIVACY / DISCLOSURES
   ========================================================= */

.caspa-disclosures {
    width: 100%;
    padding: 20px 22px;
    background-color: #f6f7f8;
    border: 1px solid #dfe2e6;
    border-radius: 9px;
}

.caspa-disclosures p {
    margin: 0 0 10px;
    color: #5f646d;
    font-size: 13px;
    line-height: 1.6;
}

.caspa-disclosures p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   HEADER OVERRIDES
   ========================================================= */

#search-icon,
#search-form-container,
#theme-toggle-btn {
    display: none !important;
}

#menu-toggle-icon {
    border: 0;
    cursor: pointer;
}


/* =========================================================
   LARGE DESKTOP
   ========================================================= */

@media only screen and (min-width: 1400px) {

    .caspa-container {
        max-width: 1040px;
    }

    #userWord {
        height: 390px;
        min-height: 170px;
    }

}


/* =========================================================
   TABLET / SMALL DESKTOP
   ========================================================= */

@media only screen and (max-width: 1024px) {

    .caspa-section {
        padding-right: 18px;
        padding-left: 18px;
    }

    .caspa-container {
        max-width: 900px;
    }

    .caspa-content {
        padding: 30px 31px;
    }

}


/* =========================================================
   TABLET
   ========================================================= */

@media only screen and (max-width: 768px) {

    body {
        font-size: 16px;
    }

    .caspa-section {
        padding-top: 98px;
        padding-bottom: 50px;
    }

    .caspa-heading {
        margin-bottom: 21px;
    }

    .caspa-heading h1 {
        font-size: 31px;
    }

    .caspa-intro {
        max-width: 680px;
        font-size: 16px;
    }

    .counter-wrapper {
        margin-bottom: 30px;
        padding: 18px;
    }

    .counter-card {
        min-height: 86px;
        padding: 11px 12px;
    }

    .counter-label {
        font-size: 13px;
    }

    .counter-number {
        font-size: 31px;
    }

    .counter-limit {
        font-size: 17px;
    }

    #userWord {
        height: 330px;
        min-height: 160px;
        padding: 15px;
        font-size: 16px;
    }

    .counter-actions {
        margin-top: 9px;
    }

    .caspa-content {
        padding: 27px 24px;
    }

    .content-section {
        margin-bottom: 26px;
        padding-bottom: 26px;
    }

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

    .content-section h3 {
        font-size: 18px;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media only screen and (max-width: 600px) {

    .caspa-section {
        padding-top: 88px;
        padding-right: 12px;
        padding-bottom: 40px;
        padding-left: 12px;
    }

    .caspa-heading {
        margin-bottom: 18px;
    }

    .caspa-heading h1 {
        margin-bottom: 8px;
        font-size: 28px;
        line-height: 1.25;
    }

    .caspa-intro {
        font-size: 15px;
        line-height: 1.55;
    }

    .counter-wrapper {
        padding: 14px;
        border-radius: 11px;
    }

    .counter-metrics {
        gap: 8px;
        margin-bottom: 12px;
    }

    .counter-card {
        min-height: 78px;
        padding: 9px 7px;
        border-radius: 8px;
    }

    .counter-label {
        font-size: 12px;
        letter-spacing: 0.2px;
    }

    .counter-number {
        font-size: 27px;
    }

    .counter-limit {
        font-size: 14px;
    }

    #userWord {
        height: 290px;
        min-height: 145px;
        padding: 13px;
        border-radius: 8px;
        font-size: 16px;
        line-height: 1.55;
    }

    .counter-actions {
        gap: 8px;
        margin-top: 8px;
    }

    .copyButton,
    .clearButton {
        min-width: 95px;
        padding: 9px 14px;
        font-size: 13px;
    }

    .counter-help {
        margin-top: 12px;
        font-size: 13px;
    }

    .compatibility-wrapper {
        margin-top: 12px;
    }

    .compatibility-message {
        padding: 11px 12px;
        font-size: 13px;
    }

    .invalid-character-list {
        gap: 6px;
    }

    .invalid-character-item {
        padding: 5px 8px;
    }

    .caspa-content {
        padding: 23px 17px;
        border-radius: 11px;
    }

    .content-section {
        margin-bottom: 24px;
        padding-bottom: 24px;
    }

    .content-section h2 {
        margin-bottom: 12px;
        font-size: 21px;
    }

    .content-section h3,
    .faq-item h3 {
        font-size: 17px;
    }

    .caspa-guidelines,
    .how-to-list {
        padding-left: 24px;
    }

    .guideline-note {
        padding: 12px 13px;
    }

    .character-examples {
        padding: 11px 12px;
        font-size: 20px;
        line-height: 1.8;
        letter-spacing: 2px;
    }

    .caspa-disclosures {
        padding: 17px;
    }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media only screen and (max-width: 400px) {

    .caspa-section {
        padding-right: 9px;
        padding-left: 9px;
    }

    .caspa-heading h1 {
        font-size: 25px;
    }

    .counter-wrapper {
        padding: 11px;
    }

    .counter-card {
        min-height: 73px;
    }

    .counter-label {
        font-size: 11px;
    }

    .counter-number {
        font-size: 24px;
    }

    .counter-limit {
        font-size: 13px;
    }

    #userWord {
        height: 270px;
        min-height: 130px;
    }

    .counter-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .copyButton,
    .clearButton {
        min-width: 90px;
        padding: 8px 12px;
    }

    .caspa-content {
        padding: 20px 14px;
    }

    .content-section h2 {
        font-size: 20px;
    }

    .character-examples {
        font-size: 19px;
        letter-spacing: 1.5px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@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;
    }

}