/* ============================================================
   Seraph Living — ads / offers (announcement bar, home promo,
   popup, shop tile, product/cart strip). Uses the system tokens
   (green, gold, grain, --inner-*, --elev-*) so ads read as part
   of the shop. Hover is colour/fill only; nothing moves.
   ============================================================ */

:root { --ad-bar-h: 36px; }

/* ---------- Announcement bar (fixed above the fixed header) ---------- */
html:has(.ad-bar) { --header-total: calc(var(--nav-h) + var(--ad-bar-h)); }
html:has(.ad-bar) .header { top: var(--ad-bar-h); }

.ad-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 101;
    height: var(--ad-bar-h);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: 48px;
    background-color: var(--green);
    background-image: var(--grain);
    color: var(--on-green);
    font-size: 12px;
    letter-spacing: 0.06em;
    box-shadow: inset 0 -1px 0 rgba(199, 154, 75, 0.35);
    transition: opacity var(--dur) var(--ease-out);
}
.ad-bar.is-closing { opacity: 0; }
.ad-bar__track { display: grid; min-width: 0; max-width: 100%; }
.ad-bar__item {
    grid-area: 1 / 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 420ms var(--micro-ease);
}
.ad-bar__item.is-active { opacity: 1; }
.ad-bar__item > span:not(.ad-bar__eyebrow) { overflow: hidden; text-overflow: ellipsis; }
.ad-bar__eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0.2em; font-size: 10px; font-weight: 500; }
.ad-bar__link {
    color: #fff;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: text-decoration-color var(--micro) var(--micro-ease);
}
.ad-bar__link--plain { font-weight: 400; color: var(--on-green); overflow: hidden; text-overflow: ellipsis; }
.ad-bar__close {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    display: grid;
    place-items: center;
    color: rgba(244, 241, 232, 0.8);
    border-radius: var(--r-pill);
    transition-property: color, background-color;
    transition-duration: var(--micro);
    transition-timing-function: var(--micro-ease);
}
.ad-bar__close::after { content: ''; position: absolute; inset: -6px; } /* 44px hit area */
.ad-bar__close .ti { font-size: 16px; }
.ad-bar a:focus-visible,
.ad-bar__close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: var(--r-minimal); }
@media (hover: hover) and (pointer: fine) {
    .ad-bar__link:hover { text-decoration-color: currentColor; }
    .ad-bar__close:hover { color: #fff; background-color: rgba(255, 255, 255, 0.08); }
}
@media (max-width: 600px) {
    .ad-bar { padding-inline: 16px 44px; justify-content: flex-start; font-size: 11.5px; letter-spacing: 0.03em; }
    .ad-bar__item { justify-content: flex-start; }
    .ad-bar__eyebrow { display: none; }
}

/* ---------- Home promo band ---------- */
.ad-promo { padding-block: clamp(32px, 5vw, 72px); }
.ad-promo__panel {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background-color: var(--accent-soft);
    background-image: var(--grain);
    border: 1px solid var(--border);
    border-radius: var(--r-comfortable);
    box-shadow: var(--inner-light), var(--elev-2);
    overflow: hidden;
}
.ad-promo__panel--text { grid-template-columns: 1fr; }
.ad-promo__panel--text .ad-promo__copy { align-items: center; text-align: center; margin-inline: auto; max-width: 720px; }
.ad-promo__media { position: relative; aspect-ratio: 4 / 3; background: var(--surface); }
.ad-promo__media img { width: 100%; height: 100%; object-fit: cover; }
.ad-promo__media::after { content: ''; position: absolute; inset: 0; box-shadow: var(--frame-outline); pointer-events: none; }
.ad-promo__copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
    padding: clamp(28px, 4.5vw, 64px);
}
.ad-promo__title {
    font-family: var(--font-title);
    font-weight: 500;
    font-size: clamp(30px, 3.4vw, 48px);
    line-height: 1.04;
    letter-spacing: -0.01em;
    color: var(--text-bright);
    text-wrap: balance;
}
.ad-promo__body { color: var(--text-tertiary); line-height: 1.7; max-width: 44ch; }
.ad-promo__cta { margin-top: 8px; }
.ad-count { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ad-count__label { font-size: 13px; font-weight: 500; color: var(--text-tertiary); }
.ad-count__cells { display: flex; gap: 8px; }
.ad-count__cell {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 64px; padding: 12px 8px;
    background: var(--surface); border-radius: 12px; box-shadow: var(--elev-1, 0 1px 2px rgba(0,0,0,.06));
}
.ad-count__cell b {
    font-family: var(--font-title); font-weight: 500; font-size: 32px; line-height: 1;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text-bright);
}
.ad-count__cell small { font-size: 12px; color: var(--text-tertiary); }
@media (max-width: 400px) { .ad-count__cell { min-width: 0; flex: 1; } .ad-count__cell b { font-size: 26px; } }
@media (max-width: 760px) {
    .ad-promo__panel { grid-template-columns: 1fr; }
    .ad-promo__media { aspect-ratio: 3 / 2; }
}

/* ---------- Popup offer (native dialog) ---------- */
.ad-pop {
    width: min(780px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    overflow: visible;
}
.ad-pop::backdrop { background: rgba(20, 42, 31, 0.5); }
.ad-pop[open] { animation: adPopIn 260ms var(--micro-ease); }
.ad-pop[open]::backdrop { animation: adFadeIn 260ms var(--micro-ease); }
@keyframes adPopIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes adFadeIn { from { opacity: 0; } }
.ad-pop__panel {
    position: relative;
    display: grid;
    grid-template-columns: 0.9fr 1fr;
    max-height: calc(100dvh - 32px);
    overflow: auto;
    background: #fff;
    border-radius: var(--r-large);
    box-shadow: var(--inner-light), 0 28px 64px -28px rgba(17, 17, 15, 0.5);
}
.ad-pop__panel--text { grid-template-columns: 1fr; max-width: 480px; margin-inline: auto; }
.ad-pop__media { position: relative; min-height: 100%; background: var(--surface); }
.ad-pop__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ad-pop__copy {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: clamp(40px, 5vw, 56px) clamp(24px, 4vw, 44px) 24px;
    background-color: #fff;
    background-image: var(--grain);
}
.ad-pop__title {
    font-family: var(--font-title);
    font-weight: 500;
    font-size: clamp(30px, 3.6vw, 42px);
    line-height: 1.04;
    color: var(--text-bright);
    text-wrap: balance;
}
.ad-pop__body { color: var(--text-tertiary); line-height: 1.65; }
.ad-pop__code {
    padding: 8px 12px;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    background: var(--accent-soft);
    border: 1px dashed var(--accent-border);
    border-radius: var(--r-minimal);
}
.ad-pop__code strong { color: var(--green); font-weight: 600; }
.ad-pop__cta { align-self: stretch; margin-top: 6px; }
.ad-pop__decline {
    align-self: center;
    min-height: 44px;
    padding-inline: 12px;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border-strong);
    transition: color var(--micro) var(--micro-ease), text-decoration-color var(--micro) var(--micro-ease);
}
.ad-pop__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    z-index: 1;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--r-pill);
    transition-property: color, background-color;
    transition-duration: var(--micro);
    transition-timing-function: var(--micro-ease);
}
.ad-pop__close .ti { font-size: 20px; }
.ad-pop__close:focus-visible,
.ad-pop__decline:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
    .ad-pop__close:hover { color: var(--text); background-color: var(--surface); }
    .ad-pop__decline:hover { color: var(--text); text-decoration-color: currentColor; }
}
@media (max-width: 640px) {
    .ad-pop__panel { grid-template-columns: 1fr; }
    .ad-pop__media { min-height: 0; aspect-ratio: 16 / 9; }
    .ad-pop__copy { padding-top: 28px; }
}

/* ---------- Shop grid tile ---------- */
.ad-tile { display: flex; min-width: 0; }
.ad-tile__link {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: var(--green);
    background-image: var(--grain);
    color: var(--on-green);
    border-radius: var(--r-comfortable);
    box-shadow: var(--inner-dark), var(--elev-2);
    overflow: hidden;
    transition: background-color var(--micro) var(--micro-ease);
}
.ad-tile__media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--green-deep); }
.ad-tile__media img { width: 100%; height: 100%; object-fit: cover; }
.ad-tile__copy { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: clamp(16px, 2vw, 24px); }
.ad-tile__eyebrow { font-size: 10px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.ad-tile__title { font-family: var(--font-title); font-weight: 500; font-size: clamp(22px, 2vw, 30px); line-height: 1.08; color: #fff; text-wrap: balance; }
.ad-tile__link:not(:has(.ad-tile__media)) .ad-tile__title { font-size: clamp(26px, 2.6vw, 38px); }
.ad-tile__link:not(:has(.ad-tile__media)) .ad-tile__copy { justify-content: center; }
.ad-tile__body { font-size: 14px; line-height: 1.6; color: rgba(244, 241, 232, 0.84); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ad-tile__cta {
    margin-top: auto;
    padding-top: 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 4px;
    transition: color var(--micro) var(--micro-ease);
}
.ad-tile__link:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
    .ad-tile__link:hover { background-color: var(--green-deep); }
    .ad-tile__link:hover .ad-tile__cta { color: var(--gold); }
}
@media (max-width: 600px) {
    .ad-tile__body { -webkit-line-clamp: 3; font-size: 13px; }
}

/* ---------- Product / cart strip ---------- */
.ad-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-block: 20px;
    padding: 12px 16px;
    background-color: var(--accent-soft);
    background-image: var(--grain);
    border: 1px solid rgba(31, 59, 44, 0.16);
    border-radius: var(--r-comfortable);
    box-shadow: inset 2px 0 0 var(--gold), var(--inner-light);
}
.ad-strip__icon { flex: none; font-size: 22px; color: var(--green); }
.ad-strip__copy { flex: 1; min-width: 0; }
.ad-strip__eyebrow { font-size: 10px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-text); }
.ad-strip__title { font-size: 15px; font-weight: 500; color: var(--text-bright); line-height: 1.4; }
.ad-strip__body { font-size: 13px; color: var(--text-tertiary); line-height: 1.5; }
.ad-strip__cta {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--green);
    background: linear-gradient(currentColor, currentColor) no-repeat 0 calc(100% - 10px) / 0 1px;
    transition: background-size 260ms var(--micro-ease), color var(--micro) var(--micro-ease);
}
.ad-strip__cta:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
    .ad-strip__cta:hover { background-size: 100% 1px; color: var(--green-deep); }
}
@media (max-width: 520px) {
    .ad-strip { flex-wrap: wrap; }
    .ad-strip__cta { margin-left: 36px; min-height: 36px; }
}
.ad-strip--cart-strip { margin-block: 0 24px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .ad-bar, .ad-bar__item { transition: none; }
    .ad-pop[open], .ad-pop[open]::backdrop { animation: none; }
}
