/* =========================
   CSS Custom Properties
   ========================= */
:root {
    --red-dark: #991b1b;
    --red-main: #dc2626;
    --red-hover: #b91c1c;
    --red-light: #fee2e2;
    --red-bg: #fee0e0;
    --text-dark: #1f2937;
    --text-body: #4b5563;
    --text-muted: #830909;
    --bg-page: #f8fafc;
    --white: #ffffff;

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;

    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-red: 0 12px 32px rgba(185, 28, 28, 0.22);
}

/* =========================
   Reset & Base
   ========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Inter", sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
    margin: 0;
}

p {
    margin: 0;
    line-height: 1.7;
}

a {
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* =========================
   Navigation Bar
   ========================= */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;

    background-color: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(153, 27, 27, 0.3);
    border-radius: var(--radius-lg);

    margin: 10px 12px 28px 12px;
    padding: 10px 16px;

    position: sticky;
    top: 10px;
    z-index: 100;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
}

.nav-logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.nav-logo h1 {
    color: var(--red-dark);
    font-size: 22px;
    font-weight: 800;
    font-family: "Poppins", sans-serif;
}

/* Nav links */
.nav-links-ul {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links-ul a {
    display: block;
    color: var(--red-dark);
    font-size: 15px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: background-color 0.18s;
}

.nav-links-ul a:hover {
    background-color: #ffd6d6;
}

/* CTA button */
.nav-btn-a {
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    background-color: var(--red-main);
    border-radius: var(--radius-lg);
    padding: 9px 18px;
    transition: background-color 0.18s;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-btn-a:hover {
    background-color: var(--red-hover);
}

/* Hamburger button (hidden on desktop) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--red-dark);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* =========================
   Shared Section Headings
   ========================= */
.section-heading {
    color: var(--red-dark);
    font-size: clamp(24px, 5vw, 40px);
    font-weight: 700;
    text-align: center;
}

/* =========================
   Hero Section
   ========================= */
.hero-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px 40px;
}

.hero-text-container {
    display: flex;
    flex-direction: column;
    gap: 20px;

    background-color: #fee8e8;
    border: 1px solid rgb(226, 109, 109);
    border-radius: var(--radius-lg);
    padding: 48px 44px;
    width: 50%;
    flex-shrink: 0;
    min-width: 0;
    transition: background-color 0.2s;
}

.hero-text-container:hover {
    background-color: #fce1e1;
}

.hero-text-container h1 {
    color: var(--red-dark);
    font-size: clamp(28px, 4.5vw, 52px);
    font-weight: 500;
    font-family: "Poppins", sans-serif;
    line-height: 1.1;
    overflow-wrap: break-word;
}

.hero-text-container p {
    font-size: clamp(15px, 1.6vw, 18px);
    color: var(--text-body);
}

.btn-primary {
    display: inline-block;
    align-self: flex-start;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    background-color: var(--red-main);
    border-radius: var(--radius-lg);
    padding: 12px 22px;
    transition: background-color 0.18s;
}

.btn-primary:hover {
    background-color: var(--red-hover);
}

.hero-section img {
    flex: 1;
    width: 0;
    /* flex will size it */
    min-width: 0;
    border-radius: var(--radius-lg);
    object-fit: cover;
    max-height: 420px;
}

/* =========================
   What Section
   ========================= */
.what-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 72px 48px;
}

.what-section h1 {
    color: var(--red-dark);
    font-size: clamp(22px, 4vw, 40px);
    font-weight: 700;
    text-align: center;
}

.what-section p {
    max-width: 780px;
    text-align: center;
    font-size: clamp(15px, 1.5vw, 18px);
    color: var(--text-body);
}

/* =========================
   Why Section
   ========================= */
.why-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    background-color: var(--red-bg);
    padding: 64px 32px;
}

.why-section h1 {
    color: var(--red-dark);
    font-size: clamp(22px, 4vw, 40px);
    font-weight: 700;
    text-align: center;
}

.why-cards-container {
    display: flex;
    flex-direction: row;
    gap: 24px;
    width: 100%;
    max-width: 1100px;
    justify-content: center;
}

.why-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;

    background-color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 28px 24px;
    flex: 1;
    min-width: 0;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.why-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-red);
    background-color: rgba(255, 255, 255, 0.38);
    border-color: rgba(200, 20, 20, 0.3);
}

.why-icon {
    font-size: 36px;
    line-height: 1;
}

.why-card h2 {
    color: var(--red-dark);
    font-size: 18px;
    font-weight: 700;
}

.why-card p {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 500;
}

/* =========================
   Blood Type Compatibility
   ========================= */
.compatibility-table-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 72px 24px;
}

.compatibility-table-section h1 {
    color: var(--red-dark);
    font-size: clamp(22px, 4vw, 40px);
    font-weight: 700;
    text-align: center;
}

/* Horizontal scroll wrapper acts only as a safety net on tiny screens */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.compatibility-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
    /* desktop only; removed on small screens below */
}

.compatibility-table th {
    color: var(--white);
    background-color: var(--red-dark);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.compatibility-table td {
    color: rgb(43, 7, 7);
    background-color: rgb(255, 222, 222);
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.15s;
}

.compatibility-table th,
.compatibility-table td {
    text-align: center;
    border: 1px solid rgba(178, 178, 178, 0.5);
    padding: 12px 28px;
    overflow-wrap: break-word;
}

.compatibility-table td:hover {
    background-color: rgb(255, 205, 205);
}

/* =========================
   Footer
   ========================= */
footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background-color: var(--red-dark);
    padding: 40px 24px;
    text-align: center;
}

footer p {
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: break-word;
}

/* =========================
   RESPONSIVE — Tablet  (≤ 900px)
   ========================= */
@media (max-width: 900px) {

    /* Nav: hide desktop CTA, show only links + toggle */
    .nav-btn-a {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links-ul {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        width: 100%;
        padding: 8px 0 4px;
        border-top: 1px solid rgba(153, 27, 27, 0.2);
        margin-top: 4px;
    }

    .nav-links-ul.nav-open {
        display: flex;
    }

    .nav-links-ul li {
        width: 100%;
    }

    .nav-links-ul a {
        display: block;
        width: 100%;
        padding: 10px 14px;
        font-size: 16px;
    }

    /* Hero: stack vertically, image below */
    .hero-section {
        flex-direction: column;
        padding: 0 16px 40px;
        gap: 24px;
    }

    .hero-text-container {
        width: 100%;
        padding: 36px 28px;
        border-radius: var(--radius-md);
    }

    .btn-primary {
        align-self: stretch;
        text-align: center;
    }

    .hero-section img {
        width: 100%;
        max-height: 280px;
        object-fit: cover;
        border-radius: var(--radius-md);
    }

    /* Why cards: 2 across */
    .why-cards-container {
        flex-wrap: wrap;
    }

    .why-card {
        flex-basis: calc(50% - 12px);
        flex-grow: 0;
    }

    /* Padding adjustments */
    .what-section {
        padding: 56px 32px;
    }

    .why-section {
        padding: 56px 24px;
    }

    .compatibility-table-section {
        padding: 56px 16px;
    }
}

/* =========================
   RESPONSIVE — Mobile  (≤ 600px)
   ========================= */
@media (max-width: 600px) {

    nav {
        margin: 8px 8px 20px 8px;
        padding: 10px 14px;
        border-radius: var(--radius-md);
        top: 8px;
    }

    .nav-logo img {
        width: 34px;
        height: 34px;
    }

    .nav-logo h1 {
        font-size: 20px;
    }

    /* Hero section: small side gutter so text box never touches edges */
    .hero-section {
        padding: 0 16px 32px;
    }

    .hero-text-container {
        padding: 28px 20px;
        gap: 16px;
        border-radius: var(--radius-md);
    }

    .hero-text-container h1 {
        font-size: 28px;
    }

    .hero-text-container p {
        font-size: 15px;
    }

    .hero-section img {
        max-height: 220px;
        border-radius: var(--radius-md);
    }

    /* What section */
    .what-section {
        padding: 48px 20px;
        gap: 18px;
    }

    /* Why section: single column */
    .why-section {
        padding: 48px 16px;
        gap: 28px;
    }

    .why-cards-container {
        flex-direction: column;
        gap: 16px;
    }

    .why-card {
        flex-basis: auto;
        padding: 24px 20px;
        border-radius: var(--radius-md);
    }

    .why-icon {
        font-size: 32px;
    }

    .why-card h2 {
        font-size: 17px;
    }

    .why-card p {
        font-size: 14px;
    }

    /* Compatibility table: let it shrink to fit instead of scrolling */
    .compatibility-table-section {
        padding: 48px 12px;
        gap: 24px;
    }

    .compatibility-table {
        min-width: 0;
        table-layout: fixed;
    }

    .compatibility-table th,
    .compatibility-table td {
        padding: 9px 8px;
        font-size: 12.5px;
    }

    /* Footer */
    footer {
        padding: 32px 16px;
        gap: 6px;
    }

    footer p {
        font-size: 13px;
    }
}

/* =========================
   RESPONSIVE — Small Mobile (≤ 380px)
   ========================= */
@media (max-width: 380px) {
    .hero-text-container h1 {
        font-size: 24px;
    }

    .hero-text-container {
        padding: 22px 16px;
    }

    /* Tighten table further so all 3 columns fit on a 320px screen */
    .compatibility-table {
        min-width: 0;
        table-layout: fixed;
    }

    .compatibility-table th,
    .compatibility-table td {
        padding: 8px 5px;
        font-size: 11px;
    }
}

/* =========================
   Reduced Motion
   ========================= */
@media (prefers-reduced-motion: reduce) {

    .why-card,
    .nav-links-ul a,
    .btn-primary,
    .nav-btn-a,
    .hero-text-container {
        transition: none;
    }
}