/* ===== Variables (repo color scheme) ===== */
:root {
    --bg: #FFF4BC;
    --card-bg: #fff;
    --accent: #FFB7B2;
    --accent-strong: #4E342E;
    --text: #222;
    --border: #000;
    --shadow: 8px 8px 0px #000;
    --shadow-sm: 4px 4px 0px #000;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    font-family: 'Nunito', 'Comic Sans MS', system-ui, sans-serif;
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== Skip link (accessibility) ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--accent-strong);
    color: #fff;
    padding: 0.5rem 1rem;
    font-weight: 700;
    border: 3px solid var(--border);
    z-index: 200;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0.5rem;
}

/* ===== Layout (space for multiple pages) ===== */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page main {
    flex: 1;
}

/* ===== Header ===== */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border);
}

.brand {
    font-weight: 800;
    font-size: 1.25rem;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text);
}

.nav-toggle-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.nav {
    display: flex;
    gap: 1.25rem;
}

.nav a {
    font-weight: 600;
    padding: 0.25rem 0;
}

.nav a:hover {
    text-decoration: underline;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--accent-strong);
    color: white;
    padding: 0.75rem 1.5rem;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 1rem;
    border-radius: 0;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px var(--border);
}

.btn:active {
    box-shadow: 0 0 0 var(--border);
    transform: translate(4px, 4px);
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--accent-strong);
    border: 3px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

/* ===== Card (repo signature style) ===== */
.card {
    background: var(--card-bg);
    border: 4px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.accent {
    background-color: var(--accent);
}

/* ===== Hero ===== */
.hero {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.25rem 4rem;
    text-align: center;
}

.hero-kicker {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.75rem;
    color: var(--accent-strong);
}

.hero-title {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 1rem;
}

.hero-accent {
    display: inline-block;
    background: var(--accent);
    padding: 0.1em 0.35em;
    border: 2px solid var(--border);
    box-shadow: 3px 3px 0 var(--border);
}

.hero-sub {
    font-size: 1.1rem;
    margin: 0 0 1.75rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Sections ===== */
.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem;
}

.section-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    text-align: center;
    margin: 0 0 0.5rem;
}

.section-sub {
    text-align: center;
    margin: 0 0 2rem;
    font-size: 1.05rem;
}

/* ===== Features grid (Shadcn-style cards) ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.feature-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    transition: transform 0.15s ease;
}

.feature-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 10px 10px 0 var(--border);
}

.feature-card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--accent-strong);
}

.feature-card-icon svg {
    width: 100%;
    height: 100%;
}

.feature-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.feature-card-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    opacity: 0.95;
}

/* ===== Steps grid (How it works) ===== */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    counter-reset: step;
}

.step-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    padding-top: 2.5rem;
}

.step-number {
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: 3px solid var(--border);
    box-shadow: 2px 2px 0 var(--border);
    font-weight: 800;
    font-size: 1.1rem;
}

.step-card-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
    color: var(--accent-strong);
}

.step-card-icon svg {
    width: 100%;
    height: 100%;
}

.step-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.step-card-text {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.95;
}

/* ===== Pillars table ===== */
.pillars-table {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 4px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--card-bg);
    overflow: hidden;
}

.pillars-row {
    display: contents;
}

.pillar-cell {
    padding: 1.25rem 1rem;
    border-right: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pillar-cell:last-child {
    border-right: none;
}

.pillars-header .pillar-cell {
    font-weight: 800;
    font-size: 1.05rem;
    background: var(--bg);
    border-bottom: 4px solid var(--border);
}

.pillar-cell-highlight {
    background: var(--accent);
}

.pillars-header .pillar-cell-highlight {
    background: var(--accent);
}

.pillar-icon {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.5rem;
    color: var(--accent-strong);
}

.pillar-icon svg {
    width: 100%;
    height: 100%;
}

.pillar-cell p {
    margin: 0;
    font-size: 0.95rem;
}

/* ===== Testimonials ===== */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.testimonial-card {
    display: flex;
    flex-direction: column;
    margin: 0;
    position: relative;
}

.testimonial-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.testimonial-text {
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.6;
    margin: 0 0 1rem;
    flex: 1;
}

.testimonial-footer {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.testimonial-footer strong {
    color: var(--accent-strong);
}

.testimonial-footer span {
    opacity: 0.8;
    font-size: 0.85rem;
}

/* ===== CTA section ===== */
.cta-section {
    padding-bottom: 4rem;
}

.cta-card {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.cta-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
}

.cta-text {
    margin: 0 0 1.5rem;
    font-size: 1rem;
}


/* ===== Footer ===== */
.footer {
    padding: 2.5rem 1.25rem 1.5rem;
    font-size: 0.9rem;
    border-top: 3px solid var(--border);
    background: var(--card-bg);
    box-shadow: 0 -4px 0 var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-heading {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.25rem;
    color: var(--accent-strong);
}

.footer-col a {
    font-size: 0.9rem;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.footer-col a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-copy {
    text-align: center;
    margin: 0;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
    opacity: 0.8;
}

/* ===== Scroll animations ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ===== Back to top ===== */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-strong);
    color: #fff;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.1s ease, box-shadow 0.1s ease;
    z-index: 100;
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px var(--border);
}

.back-to-top svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .features-grid,
    .steps-grid,
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

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

    .pillar-cell {
        border-right: none;
        border-bottom: 2px solid var(--border);
    }

    .pillar-cell:last-child {
        border-bottom: 2px solid var(--border);
    }

    .pillars-header .pillar-cell {
        display: none;
    }

    .pillar-cell[role="cell"]::before {
        font-weight: 800;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .pillar-cell[role="cell"]:nth-child(4)::before {
        content: "Coffee Exploration";
    }

    .pillar-cell[role="cell"]:nth-child(5)::before {
        content: "Community Education";
    }

    .pillar-cell[role="cell"]:nth-child(6)::before {
        content: "Coffee Excellence";
    }
}

@media (max-width: 600px) {
    .main-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .nav-toggle {
        display: block;
        order: 1;
        margin-left: auto;
    }

    .nav {
        display: none;
        flex-direction: column;
        width: 100%;
        order: 2;
        gap: 0;
        border-top: 2px solid var(--border);
        padding-top: 0.75rem;
        margin-top: 0.5rem;
    }

    .nav.open {
        display: flex;
    }

    .nav a {
        padding: 0.5rem 0;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .hero {
        padding: 2rem 1rem 3rem;
    }

    .section {
        padding: 2rem 1rem;
    }

    .btn {
        width: 100%;
        max-width: 280px;
    }
}

/* ===== Splits page ===== */
.splits-layout {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.splits-layout .card {
    margin-bottom: 1.5rem;
}

.splits-heading {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
}

.splits-intro {
    margin: 0 0 1.5rem;
    font-size: 1rem;
}

/* Tabs */
.splits-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.splits-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--card-bg);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    border-right: 3px solid var(--border);
    cursor: pointer;
    transition: background 0.15s ease;
}

.splits-tab:last-child {
    border-right: none;
}

.splits-tab.active {
    background: var(--accent);
    color: var(--accent-strong);
}

.splits-tab:hover:not(.active) {
    background: var(--bg);
}

.splits-tab-icon {
    width: 1rem;
    height: 1rem;
}

/* Form shared */
.splits-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.splits-form input[type="number"],
.splits-form input[type="text"] {
    width: 100%;
    max-width: 16rem;
    padding: 0.5rem 0.75rem;
    font: inherit;
    font-size: 1rem;
    border: 3px solid var(--border);
    box-shadow: 2px 2px 0 var(--border);
    margin-bottom: 1rem;
    border-radius: 0;
}

.splits-form input:focus {
    outline: none;
    box-shadow: 2px 2px 0 var(--accent-strong);
}

/* Gram-based fields */
.grams-base-fields {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.grams-field-group {
    flex: 1;
    min-width: 8rem;
}

.grams-rate {
    margin: -0.5rem 0 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-strong);
}

.grams-people-fieldset {
    border: 2px solid var(--border);
    padding: 1rem;
    margin: 0 0 1rem;
}

.grams-people-fieldset legend {
    font-weight: 800;
    font-size: 0.95rem;
    padding: 0 0.5rem;
}

.grams-people-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.grams-person-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.grams-person-row input[type="text"] {
    flex: 2;
    min-width: 6rem;
    max-width: none;
    margin-bottom: 0;
}

.grams-person-row input[type="number"] {
    flex: 1;
    min-width: 5rem;
    max-width: 8rem;
    margin-bottom: 0;
}

.grams-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: var(--card-bg);
    border: 2px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.1s ease;
}

.grams-remove-btn:hover {
    background: var(--accent);
}

.grams-remove-btn svg {
    width: 1rem;
    height: 1rem;
}

.grams-remove-btn[hidden] {
    display: none;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

/* Breakdown table */
.grams-breakdown {
    margin-top: 1rem;
    overflow-x: auto;
}

.grams-table {
    width: 100%;
    border-collapse: collapse;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.grams-table th,
.grams-table td {
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    text-align: left;
    font-size: 0.95rem;
}

.grams-table th {
    background: var(--bg);
    font-weight: 800;
}

.grams-table tbody tr:nth-child(even) {
    background: #fdf9e0;
}

/* Result */
.splits-result {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 1rem;
}

@keyframes resultPop {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.splits-result.result-pop {
    animation: resultPop 0.35s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
    .splits-result.result-pop {
        animation: none;
    }
}

.splits-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.splits-actions[hidden] {
    display: none;
}

/* Log */
.splits-log-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 0.35rem;
}

.splits-log-desc {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    opacity: 0.9;
}

.splits-log-empty {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.85;
}

#splits-log-empty[hidden] {
    display: none;
}

.splits-log {
    list-style: none;
    padding: 0;
    margin: 0;
}

.splits-log li {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.splits-log li:last-child {
    border-bottom: none;
}

.splits-log .splits-log-meta {
    font-size: 0.9rem;
    color: var(--text);
    opacity: 0.9;
}

.splits-log .splits-log-amount {
    font-weight: 700;
}

.nav a.active {
    text-decoration: underline;
}
