/*-----------------------------------*\
  #CUSTOM PROPERTY
\*-----------------------------------*/
:root {
    --bg-gradient-onyx: linear-gradient(to bottom right, hsl(240, 1%, 25%) 3%, hsl(0, 0%, 19%) 97%);
    --bg-gradient-jet: linear-gradient(to bottom right, hsla(240, 1%, 18%, 0.251) 0%, hsla(240, 2%, 11%, 0) 100%), hsl(240, 2%, 13%);
    --bg-gradient-yellow-1: linear-gradient(to bottom right, hsl(45, 100%, 71%) 0%, hsla(36, 100%, 69%, 0) 50%);
    --bg-gradient-yellow-2: linear-gradient(135deg, hsla(45, 100%, 71%, 0.251) 0%, hsla(35, 100%, 68%, 0) 59.86%), hsl(240, 2%, 13%);
    --text-gradient-yellow: linear-gradient(to right, hsl(45, 100%, 72%), hsl(35, 100%, 68%));
    --jet: hsl(0, 0%, 22%);
    --eerie-black-1: hsl(240, 2%, 13%);
    --eerie-black-2: hsl(240, 2%, 12%);
    --smoky-black: hsl(0, 0%, 7%);
    --white-2: hsl(0, 0%, 98%);
    --orange-yellow-crayola: hsl(45, 100%, 72%);
    --light-gray: hsl(0, 0%, 84%);
    --light-gray-70: hsla(0, 0%, 84%, 0.7);
    --ff-main-font: 'Poppins', sans-serif;

    --fs-1: 32px;
    --fs-6: 16px;

    --fw-300: 300;
    --fw-400: 400;
    --fw-500: 500;
    --fw-600: 600;

    --shadow-3: 0 16px 40px hsla(0, 0%, 0%, 0.25);
    --transition-1: 0.25s ease;
}

/*-----------------------------------*\
  #RESET & BASE
\*-----------------------------------*/
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

button {
    font: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

input,
textarea {
    display: block;
    width: 100%;
    background: none;
    font: inherit;
}

::selection {
    background: var(--orange-yellow-crayola);
    color: var(--smoky-black);
}

:focus {
    outline-color: var(--orange-yellow-crayola);
}

html {
    font-family: var(--ff-main-font);
}

body {
    background: var(--smoky-black);
    position: relative;
}

/* Fading Top Grid */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    background-image: linear-gradient(var(--jet) 1px, transparent 1px), linear-gradient(90deg, var(--jet) 1px, transparent 1px);
    background-size: 50px 50px;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 80%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 80%);
    opacity: 0.3;
}

/*-----------------------------------*\
  #LAYOUT & TYPOGRAPHY
\*-----------------------------------*/
main {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    min-width: 259px;
}

.main-content {
    width: 100%;
    max-width: 800px;
}

article {
    display: block;
    background: transparent;
    padding: 15px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

.h2 {
    color: var(--white-2);
    text-transform: capitalize;
}

.article-title {
    display: inline-block;
    font-size: 42px;
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.article-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 4px;
    background: var(--text-gradient-yellow);
    border-radius: 4px;
}

.section-description-wrapper {
    text-align: center;
    margin-bottom: 35px;
}

.section-description {
    color: var(--light-gray);
    font-size: 22px;
    font-weight: var(--fw-300);
    line-height: 1.6;
}

/*-----------------------------------*\
  #FORM & TEXTAREA
\*-----------------------------------*/
.form-input {
    color: var(--white-2);
    font-weight: var(--fw-400);
    border: 1px solid var(--jet);
    border-radius: 14px;
    outline: none;
    background: var(--eerie-black-2);
    transition: var(--transition-1);
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.2);
}

.form-input::placeholder {
    font-weight: var(--fw-500);
    color: rgba(255, 255, 255, 0.2);
}

.form-input:focus {
    border-color: var(--orange-yellow-crayola);
}

.textarea-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.textarea-wrapper textarea.form-input {
    min-height: 250px;
    font-size: 26px;
    padding: 25px;
    padding-bottom: 40px !important;
    line-height: 1.5;
    overflow: hidden;
    resize: none;
    max-height: none !important;
}

.char-count {
    position: absolute;
    font-size: 16px;
    bottom: 15px;
    right: 25px;
    color: var(--light-gray-70);
    pointer-events: none;
    transition: color 0.2s ease;
}

.char-count.limit-reached {
    color: #ff5e5e;
    font-weight: bold;
}

/*-----------------------------------*\
  #BUTTONS
\*-----------------------------------*/
/* --- PRIMARY ACTION BUTTON --- */
.form-btn {
    position: relative;
    width: 100%;
    background: linear-gradient(to right, hsl(0, 0%, 25%) 0%, hsl(0, 0%, 15%) 100%);
    color: var(--orange-yellow-crayola);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-radius: 14px;
    font-size: 24px;
    font-weight: var(--fw-600);
    box-shadow: var(--shadow-3);
    z-index: 1;
    transition: var(--transition-1);
}

.form-btn::before {
    content: "";
    position: absolute;
    inset: 1px;
    background: var(--eerie-black-2);
    border-radius: inherit;
    z-index: -1;
    transition: var(--transition-1);
}

.form-btn ion-icon {
    font-size: 26px;
}

.form-btn:hover {
    background: linear-gradient(to right, hsl(45, 100%, 72%) 0%, hsl(35, 100%, 68%) 100%);
    color: var(--smoky-black);
}

.form-btn:hover ion-icon {
    color: var(--smoky-black);
}

.form-btn:hover::before {
    opacity: 0;
}

.form-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-btn:disabled:hover {
    background: linear-gradient(to right, hsl(0, 0%, 25%) 0%, hsl(0, 0%, 15%) 100%);
    color: var(--orange-yellow-crayola);
}

.form-btn:disabled:hover::before {
    opacity: 1;
}

.form-btn:disabled:hover ion-icon {
    color: var(--orange-yellow-crayola);
}

/* --- SECONDARY NAVIGATION LINK --- */
.secondary-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    color: var(--light-gray);
    font-size: 16px;
    font-weight: var(--fw-500);
    margin-top: 25px;
    text-decoration: none;
    transition: var(--transition-1);
}

.secondary-btn:hover {
    color: var(--orange-yellow-crayola);
}

.secondary-btn ion-icon {
    font-size: 20px;
}

/*-----------------------------------*\
  #TOAST NOTIFICATION
\*-----------------------------------*/
.toast {
    position: fixed;
    bottom: 25px;
    right: -400px;
    background: var(--eerie-black-2);
    color: var(--white-2);
    padding: 16px 24px;
    border-radius: 12px;
    border-left: 4px solid var(--orange-yellow-crayola);
    box-shadow: var(--shadow-3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--fs-6);
    font-weight: var(--fw-500);
    z-index: 100;
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    right: 25px;
}

.toast ion-icon {
    color: var(--orange-yellow-crayola);
    font-size: 24px;
}

/* Hide default scrollbars */
html,
body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

::-webkit-scrollbar {
    display: none !important;
}

/*-----------------------------------*\
  #DASHBOARD & ANIMATIONS
\*-----------------------------------*/

/* 1. Widen the main container so 3 columns can fit comfortably */
.main-content {
    width: 100%;
    max-width: 1100px;
    /* Increased from 800px */
}

/* 2. The Auto-Adjusting Grid */
.messages-grid {
    display: grid;
    /* THE MAGIC FORMULA: 
       Creates columns of at least 320px. 
       Large screen = 3 columns. 
       Tablet = 2 columns. 
       Phone = 1 column. */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
    align-items: start;
    /* Prevents short cards from stretching to match tall neighbors */
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 3. The Standard Card */
.message-card {
    background: var(--eerie-black-2);
    border: 1px solid var(--jet);
    padding: 20px;
    border-radius: 14px;
    color: var(--white-2);
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.2);

    /* Let the grid handle the width naturally */
    width: 100%;
    height: auto;

    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.message-date {
    font-size: 12px;
    color: var(--orange-yellow-crayola);
    margin-bottom: 10px;
    display: block;
}

/* Animate the headers */
.main-content>header,
article.contact {
    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/*-----------------------------------*\
  #RESPONSIVE TYPOGRAPHY & LAYOUT
\*-----------------------------------*/
@media (max-width: 768px) {
    .article-title {
        font-size: 28px;
    }

    .section-description {
        font-size: 16px;
    }

    .textarea-wrapper textarea.form-input {
        min-height: 180px;
        font-size: 18px;
        padding: 15px;
    }

    .char-count {
        font-size: 14px;
        bottom: 10px;
        right: 15px;
    }

    .form-btn {
        font-size: 18px;
        padding: 15px;
    }

    .form-btn ion-icon {
        font-size: 20px;
    }

    .toast {
        right: 50%;
        bottom: -100px;
        transform: translateX(50%);
        width: 90%;
        max-width: 350px;
        justify-content: center;
        transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .toast.show {
        bottom: 20px;
        right: 50%;
    }
}

/*-----------------------------------*\
  #CARD DOWNLOAD BUTTON
\*-----------------------------------*/
.card-dl-btn {
    background: none;
    border: none;
    color: var(--light-gray-70);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition-1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-dl-btn:hover {
    color: var(--orange-yellow-crayola);
    transform: translateY(-2px);
}