:root {
    --bg:        #fdfcf9; /* Updated to warm archival paper */
    --surface:   #1a1a1a; /* Ink / Cream */
    --border:    #e0ddd5; /* Updated to muted archival line */
    --border-hi: #ffffff;
    --text:      #1a1a1a; /* Updated for deep archival contrast */
    --text-dim:  #555555;
    --text-mid:  #888888; /* Updated to standard muted grey */
    
    /* Reds */
    --ferrari-red: #D22630; 
    --ferrari-hover: #AF1E27; /* A slightly deeper shade for interaction */
}

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

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── HEADER ── */

header {
    border-bottom: 1px solid var(--ferrari-hover);
    padding: 60px 60px 40px;
    
    /*transition: border-color 0.3s ease;*/
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3rem, 8vw, 6.5rem);
    letter-spacing: 0.08em;
    color: var(--text);
    line-height: 1;
    margin: 0 0 12px;
}

.tagline {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-mid);
    margin: 0;
}

/* Create the style for the class you used in page.html */
.page-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    margin-bottom: 0;   /* Removes the gap below the title */
    line-height: 0.8;   /* Shrinks the vertical 'box' of the letters */
}

.page-subtitle {
    font-size: 0.8rem;
    margin-top: 0;      /* Ensures no extra gap above the subtitle */
    display: block;
}

/* ── FOOTNOTES ── */

.footnote-definition {
    margin-bottom: 0.25em;
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.footnote-definition p {
    margin: 0;
    display: inline;
}

/* ── MAIN LANDING GRID (INDEX.HTML) ── */

main {
    flex: 1;
    padding: 60px 60px;
    max-width: 1220px;
    margin: 0 auto;
    width: 100%;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 1px solid var(--border);
}

.card {
    padding: 48px 40px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background 0.2s ease;
    cursor: default;
}

.card:last-child {
    border-right: none;
}

/* ── CONTRAST FIX: HOVER STATES OVER RED ── */

.card:hover {
    background: var(--surface); /* Turns red */
}

/* Ink / Cream hover text */
.card:hover h2,
.card:hover .btn,
.card:hover .card-num {
    color: #ffffff !important;
}

.card:hover p {
    color: rgba(255, 255, 255, 0.6) !important;
}

.card:hover .btn {
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--text);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: scaleX(1);
    background: #ffffff; /* top bar stays white on dark */
}

.card-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    color: var(--text-mid);
    margin-bottom: 32px;
    display: block;
}

.card h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.05;
    margin: 0 0 20px;
    color: var(--text);
}

.card p {
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.75;
    margin: 0 0 36px;
    flex: 1;
}

.btn {
    display: inline-block;
    color: var(--text);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    width: fit-content;
    transition: all 0.2s ease;
}

/* ── SECTION PAGE LAYOUT (SECTION.HTML) ── */

.section-main {
    padding: 60px 60px;
    max-width: 1220px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-bottom: 40px;
    margin-top: 0;
}

/* ── SUB-SECTION CARDS (SECTION.HTML) ── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #111111;
    background: #fffdf6;
    border: 1px solid #e0ddd5;
    border-radius: 18px;
    padding: 28px;
    min-height: 200px;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.tool-card:hover {
    background: #111111;
    color: #fffdf6;
    border-color: #111111;
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.tool-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0.04em;
    line-height: 1;
    font-weight: 400;
    margin: 0;
    color: #111111;
    transition: color 0.3s ease;
}

.tool-card:hover .tool-label { color: #fffdf6; }

.icon-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.icon-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
}

.tool-desc {
    font-size: 0.88rem;
    font-weight: 300;
    line-height: 1.6;
    color: #7a756a;
    flex: 1;
    margin: 0;
    transition: color 0.3s ease;
}

.tool-card:hover .tool-desc { color: rgba(255, 253, 246, 0.65); }

.open-label {
    margin-top: 24px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #7a756a;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.3s ease;
}

.tool-card:hover .open-label {
    opacity: 1;
    transform: translateX(0);
    color: #fffdf6;
}

/* ── BACK BUTTON (SECTION.HTML) ── */

.back-nav {
    padding: 16px 60px 0;
    max-width: 1220px;
    margin: 0 auto;
    width: 100%;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    color: var(--text-mid);
    padding: 4px 10px 4px 6px;
    border-radius: 980px;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    text-decoration: none;
}

.back-btn:hover {
    color: var(--text);
    transform: translateX(-2px);
    text-decoration: none;
}

.back-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ── FOOTER ── */

footer {
    border-top: 1px solid var(--border);
    padding: 28px 60px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ── RESPONSIVE ── */

@media (max-width: 900px) {
    header, main, .back-nav, .section-main, footer {
        padding-left: 30px;
        padding-right: 30px;
    }

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

    .card {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .card:last-child {
        border-bottom: none;
    }

    .footer-inner {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}