/* ===========================================================================
   PT-00453 (CS-Coupons) — coupon cards, themes, and the "show your server" view.

   THE RULE THAT MAKES THE GRID WORK: every theme is artwork painted inside one
   SHARED frame. .csc-card owns the size, aspect ratio and padding; a theme may
   change colour, texture, type and edge treatment but must NOT change the box.
   Three differently-shaped coupons side by side read as a ransom note.
   =========================================================================== */

/* ---------------------------------------------------------------- the grid */

.csc-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;                 /* phone */
}

@media (min-width: 768px) {
    .csc-grid { grid-template-columns: repeat(2, 1fr); }   /* tablet */
}

@media (min-width: 1200px) {
    .csc-grid { grid-template-columns: repeat(3, 1fr); }   /* desktop */
}

/* ------------------------------------------------------------- shared frame */

.csc-card {
    position: relative;
    aspect-ratio: 8 / 5;
    padding: 1.4rem 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    border: none;
    text-align: left;
    width: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.csc-card:hover,
.csc-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
    outline: none;
}

/* PT-00453 D4, REVISED 2026-09-13 after Brian saw it on UAT: coupons that are
   in date but outside their hours are NOT dimmed. Dimming made a perfectly good
   coupon hard to read and look broken. Every coupon renders at full strength;
   the only signal of "right now" is the LIVE NOW pill, which appears solely when
   the coupon is valid for today and the current time window. */

.csc-title {
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    line-height: 1.15;
    margin: 0;
    overflow-wrap: anywhere;    /* PT-00583: one 200-letter word stays inside the card */
}

/* PT-00578: the editor's Preview sits inside a .card-body, where site.css's
   `.card-body h3` (2rem / 700) would outrank .csc-title. Restore what the
   patron page draws (this size + the site's h3 weight). Kept before the
   per-style rules below so their own title sizes/weights still win. */
.coupon-editor-preview .csc-title {
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    font-weight: 600;
}

.csc-body {
    font-size: .95rem;
    line-height: 1.45;
    margin: .45rem 0 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* PT-00583: a long title or body must never push the footer ("Good ..." /
   "Expires ...") out of the frame. js/coupon-fit.js measures each card and,
   ONLY when its text does not fit, adds these classes: the body gives up lines
   first (or is hidden), then the title is cut to at most three lines with an
   ellipsis. A card whose text fits gets none of them, so it looks exactly as
   before. The zoom is never fitted - it shows everything. */
.csc-card.csc-fitted > :first-child { min-height: 0; }
.csc-card.csc-fitted .csc-foot { flex-shrink: 0; }
/* Not even one title line fits beside a very long footer: clip, never overlap. */
.csc-card.csc-fit-tight > :first-child { overflow: hidden; }

.csc-card.csc-fit-title .csc-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--csc-title-lines, 3);
    overflow: hidden;
    /* the clamp clips at the padding edge, so padding (newsprint's gap above
       its rule) would show the top of the next, hidden line */
    padding-bottom: 0;
}

.csc-card.csc-fit-body .csc-body { -webkit-line-clamp: var(--csc-body-lines, 3); }
.csc-card.csc-fit-body-hide .csc-body { display: none; }

/* The editor's hidden phone-width copy of the Preview (coupon-fit.js sets its
   width). On a phone .csc-title's clamp() bottoms out at 1.15rem; the probe
   sits in a wide dialog, so that size is set here. */
.csc-phone-probe {
    position: absolute;
    left: -10000px;
    top: 0;
    visibility: hidden;
    pointer-events: none;
}

.coupon-editor-preview.csc-phone-probe .csc-title { font-size: 1.15rem; }

.csc-foot {
    font-size: .78rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: .5rem;
    margin-top: .6rem;
}

.csc-live {
    display: inline-block;
    font-weight: 700;
    letter-spacing: .06em;
    font-size: .7rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: #17863f;
    color: #fff;
    text-transform: uppercase;
}

.csc-when {
    font-weight: 600;
    opacity: .85;
}

/* --------------------------------------------------------------- the ink ---
   site-theme-dark.css paints every h1-h6 with the page's light heading colour:

       h1, h2, h3, h4, h5, h6 { color: var(--cs-heading-color, ...); }

   A coupon is a printed object with its own paper, so its ink must come from
   the theme. Inheritance alone is not enough — an inherited value always loses
   to a rule that targets the element directly, which is why a newsprint coupon
   rendered white-on-cream and read as "my text did not save". Each theme sets
   --csc-ink; these class-based selectors (0,2,0) outrank the global element
   rule and every theme override below can still win on source order. */
.csc-card,
.csc-card .csc-title,
.csc-card .csc-body,
.csc-card .csc-body *,
.csc-card .csc-foot,
.csc-card .csc-when {
    color: var(--csc-ink);
}

/* The LIVE NOW pill paints its own text on a green ground and must not inherit
   the coupon's ink — on a light theme that would be green-on-green. */
.csc-card .csc-live { color: #fff; }

/* TinyMCE content arrives wrapped in <p>; the default margins would push the
   footer off a fixed-height card. */
.csc-card .csc-body p { margin: 0 0 .4rem; }
.csc-card .csc-body p:last-child { margin-bottom: 0; }

/* ================================ THEMES ================================== */

/* 1. Newsprint Clipping — halftone dots, torn edges, condensed serif. */
.csc-theme-newsprint {
    /* The halftone used to be a 4px grid of 16%-black dots sitting directly
       behind the body copy, and it chewed up the text (Brian, UAT). Real
       newsprint only halftones its PHOTOGRAPHS — the copy is printed on plain
       paper — so the dots are now a faint paper tooth rather than a pattern the
       eye has to read through. Lighter, finer, and further apart. */
    background-color: #f3efe7;
    background-image:
        radial-gradient(rgba(0, 0, 0, .06) 0.9px, transparent 1px);
    background-size: 6px 6px;
    --csc-ink: #14120d;
    font-family: Georgia, "Times New Roman", serif;
    /* torn top and bottom edge */
    clip-path: polygon(
        0% 3%, 4% 0%, 9% 3%, 15% 0%, 21% 3%, 27% 0%, 34% 3%, 41% 0%, 48% 3%,
        55% 0%, 62% 3%, 69% 0%, 76% 3%, 83% 0%, 90% 3%, 96% 0%, 100% 3%,
        100% 97%, 96% 100%, 90% 97%, 83% 100%, 76% 97%, 69% 100%, 62% 97%,
        55% 100%, 48% 97%, 41% 100%, 34% 97%, 27% 100%, 21% 97%, 15% 100%,
        9% 97%, 4% 100%, 0% 97%);
    /* The torn edge eats the top and bottom 3% of the box, so the headline needs
       to start below the tear or its ascenders get sliced off. */
    padding-top: 2rem;
    padding-bottom: 1.9rem;
}

.csc-theme-newsprint .csc-title {
    font-weight: 700;
    font-stretch: condensed;
    text-transform: uppercase;
    letter-spacing: -.01em;
    border-bottom: 3px double #17150f;
    padding-bottom: .3rem;
}

/* 2. Movie Ticket Stub — perforated tear strip and punch holes. */
.csc-theme-ticketstub {
    background: linear-gradient(135deg, #8c1420 0%, #a8202e 55%, #7a0f1a 100%);
    --csc-ink: #ffe9c7;
    font-family: "Helvetica Neue", Arial, sans-serif;
    padding-left: 3.1rem;                       /* room for the stub */
    border-radius: 6px;
}

/* the perforation line */
.csc-theme-ticketstub::before {
    content: "ADMIT ONE";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .22em;
    color: #f0c674;
    background: rgba(0, 0, 0, .22);
    border-right: 2px dashed rgba(255, 233, 199, .55);
}

/* punch holes top and bottom of the tear line */
.csc-theme-ticketstub::after {
    content: "";
    position: absolute;
    left: 2.4rem;
    top: 0;
    bottom: 0;
    width: 12px;
    transform: translateX(-50%);
    background-image: radial-gradient(circle, #1a1a1a 0 3px, transparent 3.5px);
    background-size: 12px 16px;
    background-repeat: repeat-y;
    opacity: .55;
}

.csc-theme-ticketstub .csc-title {
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 800;
    color: #ffd98a;
}

/* 3. Chalkboard A-Frame — the sidewalk sign every bar already owns. */
.csc-theme-chalkboard {
    background-color: #26312c;
    background-image:
        radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1.4px),
        linear-gradient(160deg, rgba(255, 255, 255, .05), transparent 60%);
    background-size: 6px 6px, 100% 100%;
    --csc-ink: #f3f1e7;
    font-family: "Bradley Hand", "Segoe Script", "Comic Sans MS", cursive;
    border: 10px solid #6b4a2b;
    border-radius: 4px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 6px 18px rgba(0, 0, 0, .35);
}

.csc-theme-chalkboard .csc-title {
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 255, 255, .25);
}

/* 4. Vintage Diner Check — pale green guest check, red typewriter type. */
.csc-theme-dinercheck {
    background-color: #e8f0dd;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0 27px,
        rgba(60, 90, 50, .22) 27px 28px);
    --csc-ink: #8e2119;
    font-family: "Courier New", Courier, monospace;
    border: 1px solid #b6c6a6;
}

.csc-theme-dinercheck .csc-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.csc-theme-dinercheck .csc-foot::after {
    content: "THANK YOU — CALL AGAIN";
    position: absolute;
    right: 1.5rem;
    bottom: .35rem;
    font-size: .58rem;
    letter-spacing: .12em;
    opacity: .55;
}

/* 5. Neon Sign — glowing tube lettering on dark brick.
   NOTE: this is the one theme that fights the light backdrop of the zoomed
   view. Type is kept large and high-contrast; if it still reads badly on a
   phone in a dim bar, this is the first theme to cut. */
.csc-theme-neon {
    background-color: #17121c;
    background-image:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 26px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 54px);
    --csc-ink: #f4e9ff;
    font-family: "Helvetica Neue", Arial, sans-serif;
    border: 2px solid rgba(196, 110, 255, .45);
    border-radius: 8px;
}

.csc-theme-neon .csc-title {
    color: #ff5fd2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-shadow:
        0 0 4px #ff5fd2,
        0 0 12px rgba(255, 95, 210, .85),
        0 0 30px rgba(150, 80, 255, .6);
}

.csc-theme-neon .csc-when { color: #7bf1ff; text-shadow: 0 0 8px rgba(123, 241, 255, .7); }

/* 6. Golden Ticket — foil and an ornate border, for the big offer. */
.csc-theme-goldticket {
    background:
        linear-gradient(135deg, #b8860b 0%, #f7e08a 22%, #d4af37 45%, #fff3bf 62%, #c9a227 100%);
    --csc-ink: #3a2c05;
    font-family: Georgia, "Times New Roman", serif;
    border: 3px double #6b5310;
    border-radius: 4px;
    box-shadow: inset 0 0 0 6px rgba(107, 83, 16, .22), 0 6px 18px rgba(0, 0, 0, .35);
}

.csc-theme-goldticket .csc-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

/* Theme swatches in the dashboard picker reuse the same paint at button size. */
.coupon-theme-swatch {
    font-size: .78rem;
    font-weight: 600;
    min-height: 3.1rem;
}

/* ==================== "show your server" zoomed view ====================== */

.csc-zoom {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    /* Deliberately LIGHT even though the site is dark: a dark panel in a dim bar
       on an auto-dimmed phone is genuinely hard for a server to read, and a web
       page cannot raise screen brightness. */
    background: #f4f2ee;
}

.csc-zoom.is-open { display: flex; }

.csc-zoom-stage {
    width: min(560px, 100%);
    max-height: 74vh;
}

/* In the zoom the coupon is the whole point: bigger type, no hover lift, and
   the description is no longer clamped to three lines. */
.csc-zoom .csc-card {
    aspect-ratio: auto;
    min-height: min(70vh, 520px);
    cursor: default;
    padding: 1.8rem;
}

.csc-zoom .csc-card:hover { transform: none; }

/* The generous zoom padding must not overwrite a theme that reserves space for
   its own furniture — the ticket stub's tear strip lives in the left gutter, so
   the headline would run underneath it. */
.csc-zoom .csc-theme-ticketstub { padding-left: 3.6rem; }

.csc-zoom .csc-title { font-size: clamp(1.5rem, 6vw, 2.3rem); }

/* On the card the description is clamped to three lines; in the zoom the whole
   point is to read it, so every part of the clamp has to be undone explicitly —
   leaving -webkit-box-orient behind is enough to keep it truncated. */
.csc-zoom .csc-body {
    font-size: 1rem;
    display: block;
    -webkit-line-clamp: none;
    -webkit-box-orient: initial;
    overflow: visible;
    max-height: none;
}

.csc-zoom-bar {
    width: min(560px, 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    color: #3b3b3b;
}

/* Proof the screen is live, not a screenshot from last Tuesday. Small, at the
   bottom edge, never competing with the offer. */
.csc-clock {
    font-variant-numeric: tabular-nums;
    font-size: .82rem;
    color: #555;
}

.csc-zoom-nav {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.csc-zoom-close,
.csc-zoom-prev,
.csc-zoom-next {
    border: 1px solid #cfcac2;
    background: #fff;
    color: #222;
    border-radius: 999px;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.csc-zoom-close:disabled,
.csc-zoom-prev:disabled,
.csc-zoom-next:disabled { opacity: .35; }

.csc-zoom-count { font-size: .82rem; color: #555; min-width: 4.5rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
    .csc-card { transition: none; }
    .csc-card:hover { transform: none; }
}

/* =================== dashboard editor (owner side) ========================
   coupons.css is loaded on the Client Dashboard too, so the theme picker shows
   real paint rather than six identical grey buttons. */

/* The theme classes carry furniture sized for a full card (the newsprint tear
   padding, the ticket-stub gutter). At swatch size that furniture has to go —
   only the colour and texture are wanted here. */
.coupon-theme-swatch.csc-theme-newsprint,
.coupon-theme-swatch.csc-theme-ticketstub,
.coupon-theme-swatch.csc-theme-chalkboard,
.coupon-theme-swatch.csc-theme-dinercheck,
.coupon-theme-swatch.csc-theme-neon,
.coupon-theme-swatch.csc-theme-goldticket {
    padding: .5rem .6rem;
    clip-path: none;
    border-width: 2px;
    border-style: solid;
    border-color: transparent;
    color: var(--csc-ink);
    text-shadow: none;
    box-shadow: none;
}

.coupon-theme-swatch.csc-theme-ticketstub::before,
.coupon-theme-swatch.csc-theme-ticketstub::after { content: none; }

/* The selected look needs to be unmistakable against five others. */
.btn-check:checked + .coupon-theme-swatch {
    border-color: #6ea8fe;
    box-shadow: 0 0 0 .2rem rgba(110, 168, 254, .4);
}

/* On the dark dashboard an unchecked Bootstrap checkbox is a near-invisible
   hairline. The schedule picker is the one place where a whole feature depends
   on spotting them, so they are painted explicitly. */
#couponScheduleDays .form-check-input,
#couponEditorModal .form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: .15rem;
    background-color: #fbfbfe;
    border: 2px solid #6c757d;
}

#couponScheduleDays .form-check-input:checked,
#couponEditorModal .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

#couponScheduleDays .form-check-input:focus,
#couponEditorModal .form-check-input:focus {
    border-color: #6ea8fe;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .3);
}

/* Disabled means "tick the day first", not "broken" — keep it legible. */
#couponScheduleDays .form-check-input:disabled {
    background-color: #adb5bd;
    border-color: #6c757d;
    opacity: .55;
}

#couponScheduleDays .form-check-label { cursor: pointer; }

#couponScheduleDays .coupon-day-row { padding: .15rem 0; }

#couponScheduleDays .coupon-day-row:nth-child(odd) {
    background: rgba(255, 255, 255, .035);
    border-radius: .25rem;
}

/* The whole point of the picker is this line — make it readable. */
#couponSchedulePreview { font-size: .95rem; }

/* PT-00578: the editor's settings are grouped into six cards. Theme variables
   only, so they follow the site theme. The cards are not clickable, so the
   site-wide .card hover lift and glow are switched off here. */
#couponEditorModal .coupon-editor-card {
    margin-bottom: 1rem;
    box-shadow: none;
    /* PT-00578 round 2: the card must stand clearly apart from the pop-up
       (border 3:1 or more against --cs-card-bg) and its title bar gets its own
       colour. The --cs-group-card-* variables are set for every theme (theme
       manifest + the light palette in site-light.css). */
    background-color: var(--cs-group-card-bg, #24243e);
    /* colour only: the width stays the site's (2px under prefers-contrast: more) */
    border-color: var(--cs-group-card-border, #7c74c4);
}

#couponEditorModal .coupon-editor-card:hover {
    transform: none;
    border-color: var(--cs-group-card-border, #7c74c4);
    box-shadow: none;
}

/* The dark theme rounds .card to 12px, but this Bootstrap build gives the
   header fixed 0.25rem top corners - match the card's. */
#couponEditorModal .coupon-editor-card > .card-header {
    padding: .75rem 1rem;
    border-radius: 11px 11px 0 0;
    background-color: var(--cs-group-card-header-bg, #46338f);
    border-bottom: 1px solid var(--cs-group-card-border, #7c74c4);
}

/* The big heading says what the group is for - clearly larger and bolder
   than the field labels inside the card. */
#couponEditorModal .coupon-editor-card-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--cs-group-card-header-text, #f5f5f5);
}

#couponEditorModal .coupon-editor-card-title .bi {
    color: var(--cs-group-card-header-icon, #d4c2ff);
}

#couponEditorModal .coupon-editor-card > .card-body {
    padding: 1rem;
}

@media (max-width: 575.98px) {
    #couponEditorModal .modal-body { padding: .75rem; }
    #couponEditorModal .coupon-editor-card > .card-header { padding: .6rem .75rem; }
    #couponEditorModal .coupon-editor-card > .card-body { padding: .75rem; }
    #couponEditorModal .coupon-editor-card-title { font-size: 1.15rem; }
}
