:root {
    --bg: #fbf6ee;
    --paper: #fffdf9;
    --ink: #211711;
    --muted: #6f6258;
    --line: rgba(33, 23, 17, 0.12);
    --clay: #bf6430;
    --clay-dark: #91451e;
    --teal: #1f6f78;
    --soft: #f2e5d7;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: "Poppins", Arial, sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 18%, rgba(191, 100, 48, 0.1), transparent 34%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.86) 0 42%, rgba(251, 246, 238, 0.72) 42% 100%);
    opacity: 1;
    z-index: -1;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px clamp(18px, 4vw, 52px);
    background: var(--bg);
    border-bottom: 0;
}

.brand,
.top-links {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    color: var(--clay-dark);
    font-weight: 800;
    text-decoration: none;
}

.brand img {
    width: 31px;
    height: 31px;
    object-fit: contain;
}

.top-links {
    gap: 8px;
}

.top-links a,
.primary-action,
.secondary-action,
.event-actions a,
.event-actions button,
.calendar-options button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
    background: #fff;
    color: var(--clay-dark);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    align-items: end;
    gap: clamp(24px, 8vw, 120px);
    padding: clamp(26px, 4vw, 54px) clamp(18px, 4vw, 52px) 36px;
}

.hero-copy {
    max-width: 860px;
}

.eyebrow,
.panel-label {
    margin: 0 0 12px;
    color: var(--teal);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 18px;
    color: var(--clay);
    font-size: clamp(1.65rem, 4.4vw, 3.3rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.lede {
    max-width: 760px;
    margin-bottom: 28px;
    color: var(--ink);
    font-size: clamp(0.72rem, 1.3vw, 0.92rem);
    line-height: 1.55;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.primary-action {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.hero-panel,
.stats,
.month-list,
.event-card {
    background: rgba(255, 253, 249, 0.92);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(92, 58, 31, 0.09);
}

.hero-panel {
    display: grid;
    gap: 12px;
    padding: 22px;
}

.hero-panel strong {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.hero-panel p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: hidden;
    margin: 0 clamp(18px, 4vw, 52px) 30px;
}

.stats div {
    padding: 24px;
    border-right: 1px solid var(--line);
}

.stats div:last-child {
    border-right: 0;
}

.stats span {
    display: block;
    color: var(--clay-dark);
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 800;
    line-height: 1;
}

.stats p {
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 800;
}

.controls {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: end;
    gap: 18px;
    padding: 0 clamp(18px, 4vw, 52px) 18px;
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--clay-dark);
    padding: 9px 14px;
    font-weight: 800;
    cursor: pointer;
}

.tab.is-active {
    background: var(--clay);
    border-color: var(--clay);
    color: #fff;
}

.search {
    display: grid;
    gap: 7px;
    width: min(100%, 320px);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.search input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    color: var(--ink);
}

.calendar-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 18px;
    padding: 0 clamp(18px, 4vw, 52px) 110px;
}

.month-list {
    align-self: start;
    position: sticky;
    top: 18px;
    overflow: hidden;
}

.month-list h2 {
    margin: 0;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    font-size: 1.1rem;
}

#monthList {
    display: grid;
}

.month-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    padding: 14px 18px;
    color: var(--muted);
    font-weight: 800;
    text-align: start;
    cursor: pointer;
}

.month-chip.is-active {
    color: var(--clay-dark);
    background: rgba(191, 100, 48, 0.08);
}

.event-list {
    display: grid;
    gap: 14px;
}

.event-card {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr) auto;
    gap: 20px;
    padding: 18px;
}

.event-thumb {
    margin: 0;
    width: 148px;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--soft);
}

.event-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.event-date-line {
    margin-bottom: 8px;
    color: var(--clay-dark);
    font-weight: 800;
}

.event-card h3 {
    margin-bottom: 9px;
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.meta span {
    border-radius: 999px;
    background: rgba(31, 111, 120, 0.1);
    color: var(--teal);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}

.meta .status.past {
    background: rgba(33, 23, 17, 0.08);
    color: var(--muted);
}

.event-card p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.event-actions {
    display: grid;
    align-content: center;
    gap: 8px;
    min-width: 150px;
}

.event-actions button {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.calendar-add-menu {
    position: relative;
}

.calendar-add-trigger {
    width: 100%;
    box-shadow: 0 8px 20px rgba(33, 23, 17, 0.12);
}

.calendar-add-trigger .material-icons {
    font-size: 20px;
}

.calendar-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    width: 236px;
    display: grid;
    gap: 2px;
    padding: 10px;
    border: 1px solid rgba(33, 23, 17, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 42px rgba(33, 23, 17, 0.18);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    visibility: hidden;
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.calendar-add-menu.is-open .calendar-options {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.calendar-options button {
    justify-content: flex-start;
    min-height: 38px;
    width: 100%;
    border: 0;
    background: transparent;
    color: #31313a;
    padding: 8px 9px;
    font-size: 15px;
    font-weight: 500;
    text-align: start;
}

.calendar-options button:hover,
.calendar-options button:focus-visible {
    background: rgba(31, 111, 120, 0.08);
    outline: 0;
}

.provider-icon {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 5px;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    flex: 0 0 auto;
}

.provider-icon.google {
    background: linear-gradient(135deg, #4285f4 0 50%, #34a853 50% 72%, #fbbc05 72% 86%, #ea4335 86%);
}

.provider-icon.outlook {
    background: #0a7bdc;
}

.provider-icon.yahoo {
    background: transparent;
    color: #5f01d1;
    font-size: 16px;
}

.provider-icon.apple {
    background: transparent;
    color: #9fa4aa;
    font-size: 20px;
}

.provider-icon.invite {
    background: #98a2ad;
}

.empty-state {
    padding: 28px;
    background: rgba(255, 253, 249, 0.92);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
}

.floating-nav {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(184, 132, 77, 0.08);
    backdrop-filter: blur(20px);
}

.fn-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    border-radius: 999px;
    padding: 9px 15px;
    color: #b8844d;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.fn-btn .material-icons {
    font-size: 18px;
}

.fn-btn.fn-active {
    color: #fff;
    background: linear-gradient(135deg, #b8844d, #8b6f47);
    box-shadow: 0 6px 20px rgba(184, 132, 77, 0.35);
}

.nav-separator {
    width: 1px;
    height: 20px;
    background: rgba(184, 132, 77, 0.2);
}

html[dir="rtl"] .stats div {
    border-right: 0;
    border-left: 1px solid var(--line);
}

html[dir="rtl"] .stats div:last-child {
    border-left: 0;
}

@media (max-width: 900px) {
    .calendar-header,
    .hero,
    .controls,
    .calendar-shell {
        grid-template-columns: 1fr;
    }

    .calendar-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero {
        padding-top: 36px;
    }

    h1 {
        font-size: clamp(2.45rem, 13vw, 4.6rem);
    }

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

    .stats div,
    html[dir="rtl"] .stats div {
        border-right: 0;
        border-left: 0;
        border-bottom: 1px solid var(--line);
    }

    .controls {
        align-items: stretch;
        flex-direction: column;
    }

    .month-list {
        position: static;
    }

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

    .event-thumb {
        width: 100%;
    }

    .event-actions {
        min-width: 0;
        grid-template-columns: 1fr 1fr;
    }

    .calendar-options {
        right: auto;
        left: 0;
        transform-origin: top left;
    }
}

@media (max-width: 560px) {
    .top-links {
        width: 100%;
        justify-content: stretch;
    }

    .top-links a {
        flex: 1;
    }

    .hero-actions,
    .event-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .floating-nav {
        left: 50%;
        bottom: 14px;
        width: calc(100% - 28px);
        justify-content: center;
    }

    .fn-btn {
        flex: 1;
        justify-content: center;
        padding-inline: 10px;
    }
}
