/* Mango business page.
   Tokens are sampled from the Figma exports in design-refs/. The layout is the
   same at every width: one centered column, max 575px. There are no
   breakpoint-specific layouts. */

:root {
    color-scheme: light;

    /* Typography */
    --font-display: "Besley", Georgia, "Times New Roman", serif;
    --font-body: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --text-hero: 1.8125rem;     /* 29px: up-next card title, "No Events" */
    --text-title: 1.4375rem;    /* 23px: later card title */
    --text-modal-title: 1.625rem; /* 26px: modal titles */
    --text-name: 1.375rem;      /* 22px: business name */
    --text-time: 1.0625rem;     /* 17px: "Tomorrow @ 10:00am - 2:30pm" */
    --text-body: 0.9375rem;     /* 15px: tagline, modal body */
    --text-card: 0.875rem;      /* 14px: card description */
    --text-button: 1rem;        /* 16px */
    --text-label: 0.875rem;     /* 14px: "UP NEXT" */
    --text-small: 0.8125rem;    /* 13px */

    --leading-tight: 1.15;
    --leading-body: 1.45;

    /* Color */
    --brown-900: #6c3419;       /* headlines, borders, card ledge */
    --brown-700: #7b462e;       /* body text */
    --brown-500: #986d58;       /* muted text */
    --brown-300: #b59581;       /* the "@" and "-" in time lines */
    --olive-900: #354202;       /* primary button, Switch, badge day */
    --olive-600: #507812;       /* "Event Added" */
    --badge-border: #9db24d;
    --badge-bg: rgb(152 178 73 / 0.12);
    --badge-month: rgb(57 70 5 / 0.7);
    --chip-today: #e83839;
    --chip-tomorrow: #f2a03c;
    --chip-past: #e6dfcf;
    --card-bg: #fff6e6;
    --card-added-bg: #f5efdc;
    --card-added-divider: #cbd0aa;
    --divider: #ece6d3;
    --band-border: #efe1d1;
    --dot: #aea387;
    --dot-active: #f2a03c;
    --black: #111111;
    --on-dark: #fff6e6;
    --overlay: rgb(70 52 38 / 0.38);

    --page-top: #f9eed2;
    --page-top-left: #e3e2bb;
    --page-mid: #feedd9;
    --page-bottom: #ffe1da;


    /* Shape and space */
    --column-max: 575px;
    --gutter: 16px;
    --radius-card: 14px;
    --radius-button: 10px;
    --radius-badge: 12px;
    --border: 1.5px solid var(--brown-900);
    --ledge: 4px;               /* thick bottom edge that makes cards look raised */

    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --modal-duration: 300ms;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    color: var(--brown-700);
    background:
        radial-gradient(ellipse 70% 260px at 0 0, var(--page-top-left), transparent 70%),
        linear-gradient(180deg, var(--page-top) 0, #fef1d7 360px, var(--page-mid) 55%, var(--page-bottom) 100%);
    background-color: var(--page-mid);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
}

img,
svg {
    display: block;
}

:focus-visible {
    outline: 2px solid var(--olive-900);
    outline-offset: 3px;
}

/* Programmatic focus targets (modal titles) never show a ring. */
[tabindex="-1"]:focus {
    outline: none;
}

/* ---------- Native mobile web (iOS Safari / iOS Chrome / Android Chrome) ---------- */

/* Custom pressed states replace the grey tap flash; no double-tap-zoom delay;
   no long-press callout on controls. */
a,
button,
.card__top {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Keep the column clear of the notch / rounded corners in landscape
   (viewport-fit=cover is set in scan.html). */
.column {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* No pull-to-refresh / rubber-band bleed when a sheet is open. */
html.has-modal body {
    overscroll-behavior: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* One centered content column at every width. */
.column {
    width: 100%;
    max-width: var(--column-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* Decorative rainbow swoosh in the top-right corner of the viewport. */
.rainbow {
    position: absolute;
    top: 0;
    right: 0;
    width: min(100vw, 402px);
    height: auto;
    pointer-events: none;
    z-index: 0;
}

.noscript {
    padding: 40px var(--gutter);
    text-align: center;
}

/* 404 page (rendered by the server) */
.not-found__main {
    display: grid;
    place-content: center;
    gap: 8px;
    min-height: 100vh;
    min-height: 100dvh;
    text-align: center;
}

.not-found__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-modal-title);
    color: var(--brown-900);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Header ---------- */

.business {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding-top: 40px;
    padding-bottom: 18px;
}

.business__logo {
    flex: none;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    background: #fbf8f2;
    box-shadow: 0 0 0 1px rgb(108 52 25 / 0.08);
}

.business__text {
    min-width: 0;
    padding-top: 6px;
}

.business__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-name);
    line-height: var(--leading-tight);
    color: var(--brown-900);
}

.business__tagline {
    margin-top: 6px;
    font-size: var(--text-body);
    line-height: 1.5;
    color: var(--brown-700);
}

.social {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0 -6px;
    padding: 0;
    list-style: none;
}

.social__link {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--olive-900);
}

.social__icon {
    width: 24px;
    height: 24px;
}

/* ---------- "What is Mango?" ---------- */

.mango-band {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border-bottom: 2px solid var(--band-border);
}

.mango-band__link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding-block: 10px;
    text-decoration: none;
}

.mango-band__icon {
    flex: none;
    width: 32px;
    height: 32px;
}

.mango-band__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.mango-band__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.0625rem;
    line-height: 1.25;
    color: var(--brown-900);
}

.mango-band__subtitle {
    font-size: var(--text-small);
    line-height: 1.35;
    color: var(--brown-500);
}

.mango-band__arrow {
    flex: none;
    width: 24px;
    height: 24px;
    color: var(--olive-900);
}

/* ---------- Events area ---------- */

.events {
    position: relative;
    z-index: 1;
    flex: 1;
    padding-top: 6px;
}

.section-label {
    margin: 22px 0 10px;
    font-family: var(--font-body);
    font-size: var(--text-label);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--brown-700);
}

/* ---------- Event card ---------- */

.card {
    --card-pad: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: var(--border);
    border-radius: var(--radius-card);
    /* The "ledge" that makes the card look raised; shrinks when pressed. */
    box-shadow: 0 var(--ledge) 0 var(--brown-900);
    margin-bottom: var(--ledge);
    transition:
        transform 120ms var(--ease-in),
        box-shadow 120ms var(--ease-in);
}

.card:has(.card__open:active) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--brown-900);
}

.card__top {
    position: relative;
    flex: 1;
    padding: var(--card-pad) var(--card-pad) 16px;
    transition: opacity 150ms var(--ease-in);
}

/* Pressing "Add Event" fades the top half (the design's Active state). */
.card:has(.add-button:active) .card__top {
    opacity: 0.35;
}

.card__head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px;
    /* Pink "12px" note: content below is measured from the taller of the
       headline and the date badge. */
    margin-bottom: 12px;
}

.card__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-hero);
    line-height: 1.22;
    color: var(--brown-900);
    overflow-wrap: anywhere;
}

.card--later .card__title {
    font-size: var(--text-title);
}

/* The title button's hit area covers the whole top half ("Learn More"). */
.card__open {
    appearance: none;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.card__open::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.card__open:focus-visible {
    outline: none;
}

.card__top:has(.card__open:focus-visible) {
    outline: 2px solid var(--olive-900);
    outline-offset: -4px;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

/* Date badge */
.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 4px 6px 5px;
    border: 1.5px solid var(--badge-border);
    border-radius: var(--radius-badge);
    background: linear-gradient(var(--badge-bg), var(--badge-bg)), var(--card-bg);
    font-family: var(--font-display);
    line-height: 1;
    text-align: center;
}

.badge__month {
    font-size: 1rem;
    font-weight: 400;
    color: var(--badge-month);
}

.badge__day {
    margin-top: 2px;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--olive-900);
}

/* Later cards: the badge overhangs the top edge. */
.card--later .badge {
    position: absolute;
    top: -18px;
    right: 14px;
}

.card--later .card__head {
    grid-template-columns: 1fr;
    padding-right: 44px;
}

/* Time line: "Tomorrow @ 10:00am - 2:30pm" */
.time {
    font-size: var(--text-time);
    font-weight: 500;
    line-height: 1.3;
    color: var(--brown-900);
}

.time__sep {
    color: var(--brown-300);
}

.chip {
    padding: 0 2px;
    border-radius: 2px;
}

.chip--today {
    background: var(--chip-today);
}

.chip--tomorrow {
    background: var(--chip-tomorrow);
}

.chip--past {
    background: var(--chip-past);
}

/* Plain weekday names ("Monday") have no chip. */
.chip--weekday {
    padding: 0;
}

.card__desc {
    margin-top: 8px;
    font-size: var(--text-card);
    line-height: 1.45;
    color: var(--brown-700);
    overflow-wrap: anywhere;
}

.learn-more {
    color: var(--brown-900);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

/* ---------- Add Event button ---------- */

.add-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    border: 0;
    font-size: var(--text-button);
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 150ms var(--ease-in),
        color 150ms var(--ease-in);
}

.add-button__icon {
    width: 24px;
    height: 24px;
    flex: none;
}

.add-button--filled {
    min-height: 48px;
    padding: 10px 16px;
    border-radius: var(--radius-button);
    background: var(--olive-900);
    color: var(--on-dark);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15);
}

/* After: lighter button, past-tense verb (still clickable to add again). */
.add-button--filled.is-added {
    background: var(--olive-600);
}

.card--up-next .card__bottom {
    padding: 0 var(--card-pad) var(--card-pad);
}

.card--later .card__bottom {
    border-top: 1.5px solid var(--divider);
    border-radius: 0 0 calc(var(--radius-card) - 1.5px) calc(var(--radius-card) - 1.5px);
    overflow: hidden;
}

.card--later .card__bottom:has(.is-added) {
    border-top-color: var(--card-added-divider);
}

.add-button--text {
    min-height: 56px;
    padding: 12px 16px;
    background: transparent;
    color: var(--olive-900);
}

.add-button--text.is-added {
    background: var(--card-added-bg);
    color: var(--olive-600);
}

/* ---------- Later on: one card, or the carousel ---------- */

.later-single {
    padding-top: 18px;
}

.carousel {
    --card-w: 68%;
    --gap: 12px;
    margin-inline: calc(-1 * var(--gutter));
}

.carousel__track {
    display: flex;
    gap: var(--gap);
    padding: 20px 0 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.carousel__track::-webkit-scrollbar {
    display: none;
}

.carousel__track:focus {
    outline: none;
}

/* Spacers so the first and last cards can sit in the center. */
.carousel__track::before,
.carousel__track::after {
    content: "";
    flex: 0 0 calc((100% - var(--card-w)) / 2 - var(--gap));
}

.carousel__slide {
    display: flex;
    flex: 0 0 var(--card-w);
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.carousel__slide > .card {
    flex: 1;
}

.carousel__dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
}

.carousel__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot);
    transition: background-color 150ms var(--ease-in);
}

.carousel__dot.is-active {
    background: var(--dot-active);
}

/* ---------- No events ---------- */

.events--empty {
    display: grid;
    place-items: center;
    padding-block: 48px 96px;
}

.no-events {
    max-width: 30rem;
    text-align: center;
}

.no-events__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-hero);
    line-height: var(--leading-tight);
    color: var(--brown-900);
}

.no-events__text {
    margin-top: 12px;
    font-size: 1.0625rem;
    line-height: 1.5;
    color: var(--brown-700);
}

.no-events__name {
    font-weight: 600;
    color: var(--brown-900);
}

/* ---------- Modal primitive ---------- */

html.has-modal,
html.has-modal body {
    overflow: hidden;
}

/* WebKit (iOS Safari and iOS Chrome) note: the dialog only has a max-height,
   so its flex children must use an auto basis (flex: 0 1 auto). A 0% basis
   (flex: 1) collapses them to zero height in WebKit, leaving an empty or
   clipped sheet. */
.modal {
    width: calc(100% - 24px);
    max-width: calc(var(--column-max) - 24px);
    height: -webkit-fit-content;
    height: fit-content;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto auto calc(12px + env(safe-area-inset-bottom));
    padding: 0;
    border: var(--border);
    border-radius: 16px;
    background: var(--card-bg);
    color: var(--brown-700);
    box-shadow: 0 10px 30px rgb(60 35 15 / 0.18);
    overflow: hidden;
}

.modal[open] {
    display: flex;
    flex-direction: column;
    animation: modal-in var(--modal-duration) var(--ease-in);
}

.modal::backdrop {
    background: var(--overlay);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: backdrop-in var(--modal-duration) var(--ease-in);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
}

@keyframes backdrop-in {
    from {
        opacity: 0;
    }
}

.modal__panel {
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    min-height: 0;
}

/* 44px tap target around the 30px asset icon; negative margin keeps the
   visual alignment of a 30px button. */
.modal__close {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--olive-900);
    cursor: pointer;
}

.modal__close-icon {
    width: 30px;
    height: 30px;
}

.eyebrow {
    font-size: var(--text-label);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--brown-900);
}

/* ---------- Event details ---------- */

.details__bar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 10px;
    background: var(--card-bg);
    border-bottom: 1.5px solid transparent;
}

.details__scroll {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.details__intro {
    padding: 4px 20px 16px;
    border-bottom: 1.5px solid var(--divider);
}

.details__head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 12px;
    margin-bottom: 12px;
}

.details__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-modal-title);
    line-height: var(--leading-tight);
    color: var(--brown-900);
    overflow-wrap: anywhere;
}

.details__venue {
    margin-top: 12px;
    font-size: var(--text-body);
    color: var(--brown-900);
}

.details__venue-label {
    color: var(--brown-500);
}

.details__venue strong {
    font-weight: 500;
}

.details__body {
    padding: 16px 20px 20px;
    font-size: 1rem;
    line-height: 1.55;
}

.details__block + .details__block {
    margin-top: 20px;
}

.details__link {
    margin-top: 16px;
}

.details__link a {
    font-weight: 500;
    color: var(--brown-900);
    text-underline-offset: 3px;
}

.details__footer {
    flex: none;
    padding: 12px 20px 20px;
    background: var(--card-bg);
    border-top: 1.5px solid var(--divider);
}

/* ---------- Location placeholder (no map) ---------- */

.location {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    text-decoration: none;
    color: var(--brown-900);
}

.location__tile {
    position: relative;
    flex: none;
    width: 52px;
    height: 52px;
    border: var(--border);
    border-radius: 12px;
    overflow: hidden;
    background:
        /* two crossing "roads" */
        linear-gradient(90deg, transparent 58%, #d9dcd6 58% 70%, transparent 70%),
        linear-gradient(0deg, transparent 34%, #d9dcd6 34% 46%, transparent 46%),
        /* a park corner */
        linear-gradient(135deg, transparent 72%, #cfe5c2 72%),
        #eef0ea;
}

.location__pin {
    position: absolute;
    top: 30%;
    left: 30%;
    width: 12px;
    height: 12px;
    border-radius: 50% 50% 50% 0;
    background: var(--chip-today);
    transform: rotate(-45deg);
    box-shadow: 0 0 0 2px var(--card-bg);
}

.location__address {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    font-size: var(--text-body);
    line-height: 1.4;
}

.location__line2 {
    color: var(--brown-500);
}

.location__arrow {
    flex: none;
    width: 24px;
    height: 24px;
    color: var(--olive-900);
}

/* ---------- Default Calendar modal ---------- */

.calendar-choice {
    padding: 22px 20px 20px;
}

.calendar-choice__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.calendar-choice__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-modal-title);
    line-height: var(--leading-tight);
    color: var(--brown-900);
}

.calendar-choice__text {
    margin-top: 8px;
    font-size: var(--text-body);
    line-height: 1.45;
    color: var(--brown-500);
}

.calendar-choice__options {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.calendar-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 50px;
    padding: 10px 16px;
    border-radius: var(--radius-button);
    font-size: var(--text-button);
    font-weight: 600;
    cursor: pointer;
}

.calendar-option__icon {
    width: 22px;
    height: 22px;
}

.calendar-option--apple .calendar-option__icon {
    color: var(--on-dark);
}

.calendar-option--google {
    border: 1.5px solid var(--black);
    background: transparent;
    color: var(--black);
}

.calendar-option--apple {
    border: 1.5px solid var(--black);
    background: var(--black);
    color: #ffffff;
}

/* ---------- Default Calendar bar ---------- */

.default-bar-slot {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 2;
    margin-top: 20px;
}

.default-bar-slot:empty {
    display: none;
}

.default-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 6px 8px 6px 16px;
    border: var(--border);
    border-radius: 12px;
    background: var(--card-bg);
}

.default-bar__icon {
    flex: none;
    width: 22px;
    height: 22px;
    color: var(--black);
}

.default-bar__label {
    flex: 1;
    font-size: var(--text-button);
    color: var(--brown-700);
}

.default-bar__switch {
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: var(--text-button);
    font-weight: 600;
    color: var(--olive-900);
    cursor: pointer;
}
