/**
 * Editorial page kit — shared primitives for the marketing / landing templates
 * (corporate-gifting, how-it-works, sell-your-watch, contact).
 *
 * Scope: .cjw-ed on the page wrapper. Page identity via a modifier:
 *   .cjw-ed--cg | .cjw-ed--hiw | .cjw-ed--sw | .cjw-ed--ct
 *
 * Everything COMMON to the editorial pages lives here exactly once: the local
 * token aliases, page reset, eyebrow, button system, charcoal hero (gradient +
 * film-grain), section scaffolding, and trust strip. Page sheets keep ONLY
 * their unique sections + small per-page deltas (override via .cjw-ed--X).
 *
 * Tokens resolve to the global --cjw-* set in css/tokens.css. Page-unique
 * sections consume the --ed-* aliases below, so there is a single source of
 * truth for the editorial palette.
 *
 * WhatsApp button brand color + hover stay in css/buttons.css (one source).
 * Loaded after base.css, before the page-template sheets.
 */

/* --- Local token aliases (page-scoped) -------------------------------- */
.cjw-ed {
    --ed-ink:         var(--cjw-color-primary);
    --ed-ink-soft:    var(--cjw-color-primary-soft);
    --ed-ink-alt:     var(--cjw-color-primary-alt);
    --ed-paper:       var(--cjw-color-bg-surface);
    --ed-paper-alt:   #fafafa;
    --ed-rule:        var(--cjw-color-border);
    --ed-rule-strong: var(--cjw-color-border-strong);
    --ed-mute:        var(--cjw-color-text-muted);
    --ed-mute-soft:   #888888;

    --ed-dark:           #131313;   /* hero / dark-band canvas */
    --ed-on-dark:        #ffffff;
    --ed-on-dark-mute:   rgba(255, 255, 255, 0.72);
    --ed-on-dark-soft:   rgba(255, 255, 255, 0.55);
    --ed-on-dark-rule:   rgba(255, 255, 255, 0.12);
    --ed-on-dark-ghost:  rgba(255, 255, 255, 0.07);

    --ed-pad-x: clamp(20px, 4vw, 64px);
    --ed-pad-y: clamp(48px, 7vw, 80px);
    --ed-max:   1280px;

    --ed-display: var(--cjw-font-base);
    --ed-serif:   Georgia, 'Times New Roman', 'Cormorant Garamond', serif;
    --ed-mono:    var(--cjw-font-mono);

    font-family: var(--ed-display);
    color: var(--ed-ink);
    background: var(--ed-paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Reset parent-theme heading margins; sections paint their own colors
   (light-on-dark vs dark-on-light), so no global text color here. */
.cjw-ed h1,
.cjw-ed h2,
.cjw-ed h3 {
    margin: 0;
    letter-spacing: -0.01em;
}
.cjw-ed p {
    margin: 0;
    color: var(--ed-mute);
    line-height: 1.6;
}
.cjw-ed a {
    color: inherit;
}

/* --- Eyebrow ----------------------------------------------------------- */
.cjw-eyebrow {
    font-family: var(--ed-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ed-mute-soft);
    margin: 0 0 16px;
}
.cjw-eyebrow--on-dark {
    color: var(--ed-on-dark-soft);
}

/* --- Buttons -----------------------------------------------------------
 * Pill, 13/26 padding, 14px / 500 weight — the shared editorial CTA family.
 * Brand WhatsApp color + hover live in css/buttons.css (.cjw-btn--whatsapp).
 */
.cjw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 26px;
    font-family: var(--ed-display);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease,
                border-color 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
}

.cjw-btn__icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
}

/* Variant color rules are scoped under .cjw-ed so they outrank the
   `.cjw-ed a { color: inherit }` link reset (0,1,1) — otherwise button anchors
   on light surfaces inherit the body text color and the label disappears.
   WhatsApp brand color stays in css/buttons.css; only its label color needs
   the same specificity bump here. */

/* Primary: mono. Black-on-light by default; sections on dark surfaces invert
   it (see .cjw-hero rules + page-specific dark bands). */
.cjw-ed .cjw-btn--primary {
    background: var(--ed-ink);
    color: #fff;
    border-color: var(--ed-ink);
}
.cjw-ed .cjw-btn--primary:hover,
.cjw-ed .cjw-btn--primary:focus-visible {
    background: #fff;
    color: var(--ed-ink);
    border-color: var(--ed-ink);
}

/* Ghost: outline; auto-inverts on dark surfaces. */
.cjw-ed .cjw-btn--ghost {
    background: transparent;
    color: var(--ed-ink);
    border-color: var(--ed-rule-strong);
}
.cjw-ed .cjw-btn--ghost:hover,
.cjw-ed .cjw-btn--ghost:focus-visible {
    border-color: var(--ed-ink);
    background: var(--ed-paper-alt);
}

/* Keep the WhatsApp label white over the green pill (css/buttons.css owns the
   background); beats the link-inherit reset. */
.cjw-ed .cjw-btn--whatsapp {
    color: #fff;
}

.cjw-btn--lg {
    padding: 16px 34px;
    font-size: 15px;
}

/* Busy / loading state (used by the form submit buttons). */
.cjw-btn[disabled],
.cjw-btn[aria-busy="true"] {
    cursor: progress;
    opacity: 0.85;
}
.cjw-btn__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cjw-ed-spin 0.7s linear infinite;
}
.cjw-btn[aria-busy="true"] .cjw-btn__spinner { display: inline-block; }
.cjw-btn[aria-busy="true"] .cjw-btn__label { opacity: 0.7; }

@keyframes cjw-ed-spin { to { transform: rotate(360deg); } }

/* --- Hero --------------------------------------------------------------
 * Charcoal canvas, radial spotlight, faint blue accent, and an SVG film-grain
 * overlay (no motion). Type scale is set per page via .cjw-ed--X overrides.
 */
.cjw-hero {
    color: #fff;
    padding: clamp(80px, 14vw, 180px) var(--ed-pad-x) clamp(64px, 10vw, 120px);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: var(--ed-dark);
}
.cjw-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 90% 60% at 70% 20%, rgba(255, 255, 255, 0.08), transparent 60%),
        radial-gradient(ellipse 60% 40% at 10% 90%, rgba(26, 94, 221, 0.10), transparent 70%),
        linear-gradient(180deg, #1f1f1f 0%, #131313 100%);
    pointer-events: none;
}
.cjw-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    opacity: 0.6;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.cjw-hero__inner {
    position: relative;
    max-width: var(--ed-max);
    margin: 0 auto;
}

/* Eyebrow inside the hero is always light. */
.cjw-hero .cjw-eyebrow {
    color: var(--ed-on-dark-soft);
    margin-bottom: 28px;
}

/* Base hero title — pages override the clamp via .cjw-ed--X .cjw-hero__title. */
.cjw-ed .cjw-hero__title {
    font-size: clamp(34px, 5.6vw, 76px);
    font-weight: 500;
    line-height: 1.04;
    letter-spacing: -0.01em;
    color: #fff;
    max-width: 26ch;
    margin: 0 0 28px;
}

.cjw-ed .cjw-hero__subtitle {
    font-size: clamp(15px, 1.3vw, 18px);
    line-height: 1.65;
    color: var(--ed-on-dark-mute);
    max-width: 58ch;
    margin: 0 0 36px;
}

.cjw-ed .cjw-hero__meta {
    font-family: var(--ed-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--ed-on-dark-soft);
    line-height: 1.6;
    max-width: 60ch;
}

.cjw-hero__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.cjw-hero__rule {
    position: absolute;
    left: var(--ed-pad-x);
    right: var(--ed-pad-x);
    bottom: 0;
    height: 1px;
    background: var(--ed-on-dark-rule);
}

/* On the dark hero, primary inverts to a white pill, ghost reads light. */
.cjw-hero .cjw-btn--primary {
    background: #fff;
    color: var(--ed-ink);
    border-color: #fff;
}
.cjw-hero .cjw-btn--primary:hover,
.cjw-hero .cjw-btn--primary:focus-visible {
    background: transparent;
    color: #fff;
    border-color: #fff;
}
.cjw-hero .cjw-btn--ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: transparent;
}
.cjw-hero .cjw-btn--ghost:hover,
.cjw-hero .cjw-btn--ghost:focus-visible {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* --- Section scaffolding ---------------------------------------------- */
.cjw-section {
    max-width: var(--ed-max);
    margin: 0 auto;
    padding: var(--ed-pad-y) var(--ed-pad-x);
}

.cjw-section__head {
    margin-bottom: clamp(32px, 5vw, 56px);
    max-width: 64ch;
}
.cjw-section__head--centered {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.cjw-ed .cjw-section__title {
    font-size: clamp(28px, 4.2vw, 48px);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--ed-ink);
}
.cjw-ed .cjw-section__title--on-dark {
    color: #fff;
}

.cjw-section__lede {
    margin-top: 14px;
    font-size: 16px;
    color: var(--ed-mute);
}
.cjw-section__head--centered .cjw-section__lede {
    margin-left: auto;
    margin-right: auto;
}
.cjw-section__lede a {
    color: var(--ed-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --- Trust strip ------------------------------------------------------- */
.cjw-trust {
    background: var(--ed-ink);
    color: #fff;
    border-top: 1px solid var(--ed-on-dark-rule);
}
.cjw-trust__inner {
    max-width: var(--ed-max);
    margin: 0 auto;
    padding: 28px var(--ed-pad-x);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.cjw-trust__cell {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 6px 24px 6px 0;
    border-right: 1px solid var(--ed-on-dark-rule);
}
.cjw-trust__cell:last-child { border-right: none; }
.cjw-trust__num {
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.cjw-trust__label {
    font-size: 13px;
    color: var(--ed-on-dark-mute);
    line-height: 1.35;
}

/* --- Responsive (shared primitives) ----------------------------------- */
@media (max-width: 1024px) {
    .cjw-trust__inner { grid-template-columns: repeat(2, 1fr); }
    .cjw-trust__cell:nth-child(2) { border-right: none; }
    .cjw-trust__cell:nth-child(3),
    .cjw-trust__cell:nth-child(4) {
        padding-top: 18px;
        border-top: 1px solid var(--ed-on-dark-rule);
    }
}

@media (max-width: 720px) {
    .cjw-hero { padding: 96px var(--ed-pad-x) 72px; }
    .cjw-ed .cjw-hero__title { font-size: clamp(32px, 9vw, 44px); max-width: none; }
    .cjw-hero__ctas .cjw-btn { width: 100%; justify-content: center; }

    .cjw-trust__inner { grid-template-columns: 1fr; padding: 8px var(--ed-pad-x); }
    .cjw-trust__cell {
        border-right: none;
        border-bottom: 1px solid var(--ed-on-dark-rule);
        padding: 18px 0;
    }
    .cjw-trust__cell:nth-child(3),
    .cjw-trust__cell:nth-child(4) { padding-top: 18px; border-top: none; }
    .cjw-trust__cell:last-child { border-bottom: none; }

    .cjw-ed .cjw-section__title { font-size: 28px; }
}

/* --- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .cjw-ed *,
    .cjw-ed *::before,
    .cjw-ed *::after {
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
        animation-delay: 0ms !important;
    }
}
