@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* =========================================================================
   Home — Editorial
   Scoped entirely under .home-editorial (and :has() for the body/footer tint).
   Does not affect the CRM app.
   ========================================================================= */

/* Tint the surrounding chrome to cream so header & footer don't break tonality */
body:has(.home-editorial) {
    background-color: #EBE4D2;
}

/* ----- Re-skinned header (cream masthead) ----- */
body:has(.home-editorial) .site-header {
    background: transparent;
    border-bottom: 1px solid rgba(26, 23, 19, 0.18);
}

body:has(.home-editorial) .nav-container {
    max-width: 1280px;
    padding: 0 clamp(20px, 5vw, 64px);
}

body:has(.home-editorial) .nav-logo {
    font-family: 'Instrument Serif', 'Times New Roman', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 26px;
    letter-spacing: 0;
    color: #1A1713;
}

body:has(.home-editorial) .nav-logo .logo-text {
    position: relative;
}

body:has(.home-editorial) .nav-logo .logo-text::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #D94B2B;
    border-radius: 50%;
    margin-left: 4px;
    transform: translateY(-8px);
}

body:has(.home-editorial) .nav-menu a {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #4A4238;
    padding: 6px 10px;
    border-radius: 0;
    background: transparent;
    position: relative;
    transition: color 200ms ease;
}

body:has(.home-editorial) .nav-menu a::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 2px;
    height: 1px;
    background: #D94B2B;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

body:has(.home-editorial) .nav-menu a:hover,
body:has(.home-editorial) .nav-menu a:focus-visible {
    color: #1A1713;
    background: transparent;
}

body:has(.home-editorial) .nav-menu a:hover::after,
body:has(.home-editorial) .nav-menu a:focus-visible::after {
    transform: scaleX(1);
}

/* Re-skin the primary Login button to an ink slab (no ::after underline) */
body:has(.home-editorial) .nav-menu a.btn--primary {
    background: #1A1713;
    color: #FFF8EC;
    border: 0;
    padding: 9px 16px;
    font-weight: 500;
    letter-spacing: 0.18em;
    transition: background 220ms ease;
}

body:has(.home-editorial) .nav-menu a.btn--primary::after {
    display: none;
}

body:has(.home-editorial) .nav-menu a.btn--primary:hover,
body:has(.home-editorial) .nav-menu a.btn--primary:focus-visible {
    background: #D94B2B;
    color: #FFF8EC;
}

/* Mobile toggle & drawer match */
body:has(.home-editorial) .nav-toggle-bar {
    background: #1A1713;
}

@media (max-width: 768px) {
    body:has(.home-editorial) .nav-menu {
        background: #EBE4D2;
        border-bottom-color: rgba(26, 23, 19, 0.18);
    }
}

body:has(.home-editorial) .site-footer {
    background-color: #EBE4D2;
    color: #4A4238;
    border-top: 1px solid rgba(26, 23, 19, 0.18);
}

.home-editorial {
    --paper: #EBE4D2;
    --paper-deep: #DDD3BA;
    --paper-soft: #F1EADA;
    --ink: #1A1713;
    --ink-soft: #4A4238;
    --ink-mute: #857C6C;
    --accent: #D94B2B;
    --accent-deep: #B13A20;
    --rule: rgba(26, 23, 19, 0.18);
    --rule-strong: rgba(26, 23, 19, 0.35);

    --serif: 'Instrument Serif', 'Times New Roman', serif;
    --mono: 'IBM Plex Mono', 'Courier New', monospace;
    --sans: 'DM Sans', -apple-system, sans-serif;

    position: relative;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    overflow: hidden;
    isolation: isolate;
}

/* Negate the main padding the global layout might add; the editorial lives edge-to-edge */
.home-editorial,
main:has(> .home-editorial) {
    margin: 0;
    padding: 0;
    max-width: none;
}

/* Paper grain overlay — tactile print feel */
.home-editorial::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    opacity: 0.09;
    mix-blend-mode: multiply;
}

.home-editorial > * {
    position: relative;
    z-index: 1;
}

/* =========================================================================
   Top marquee
   ========================================================================= */

.ed-marquee {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    overflow: hidden;
    padding: 10px 0;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-soft);
    white-space: nowrap;
}

.ed-marquee__track {
    display: inline-flex;
    will-change: transform;
}

.ed-marquee__half {
    display: inline-flex;
    gap: 48px;
    padding-right: 48px;
    flex-shrink: 0;
}

.ed-marquee__item {
    display: inline-flex;
    align-items: center;
    gap: 48px;
    flex-shrink: 0;
}

.ed-marquee__item::after {
    content: "◆";
    color: var(--accent);
    font-size: 10px;
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: no-preference) {
    .ed-marquee__track {
        animation: ed-marquee 48s linear infinite;
    }
}

@keyframes ed-marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* =========================================================================
   Shared container & rules
   ========================================================================= */

.ed-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(20px, 5vw, 64px);
}

.ed-rule {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 0;
}

.ed-rule--strong {
    border-top-color: var(--rule-strong);
}

/* Section marker: "№ 01 — ATELIER INDEX" */
.ed-marker {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.ed-marker__no {
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    letter-spacing: 0;
    color: var(--accent);
    transform: translateY(2px);
    text-transform: none;
}

/* =========================================================================
   Hero
   ========================================================================= */

.ed-hero {
    padding: clamp(64px, 10vw, 140px) 0 clamp(48px, 8vw, 96px);
}

.ed-hero__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: clamp(36px, 6vw, 72px);
}

.ed-hero__meta-right {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-mute);
}

.ed-hero__title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(56px, 11vw, 172px);
    line-height: 0.92;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 clamp(28px, 4vw, 48px);
    max-width: 14ch;
}

.ed-hero__title em {
    font-style: italic;
    color: var(--accent);
}

/* Word-by-word staggered reveal */
.ed-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
}

.ed-word > span {
    display: inline-block;
    transform: translateY(110%);
    opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .ed-word > span {
        animation: ed-rise 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
    .ed-hero__title .ed-word:nth-child(1) > span { animation-delay: 120ms; }
    .ed-hero__title .ed-word:nth-child(2) > span { animation-delay: 260ms; }
    .ed-hero__title .ed-word:nth-child(3) > span { animation-delay: 400ms; }
    .ed-hero__title .ed-word:nth-child(4) > span { animation-delay: 540ms; }
}

@media (prefers-reduced-motion: reduce) {
    .ed-word > span { transform: none; opacity: 1; }
}

@keyframes ed-rise {
    to { transform: translateY(0); opacity: 1; }
}

.ed-hero__body {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: clamp(28px, 5vw, 80px);
}

.ed-hero__lede {
    font-family: var(--sans);
    font-size: clamp(16px, 1.5vw, 19px);
    line-height: 1.55;
    color: var(--ink-soft);
    max-width: 46ch;
    margin: 0;
    opacity: 0;
    transform: translateY(12px);
}

.ed-hero__cta-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transform: translateY(12px);
}

@media (prefers-reduced-motion: no-preference) {
    .ed-hero__lede {
        animation: ed-fade-up 700ms cubic-bezier(0.22, 1, 0.36, 1) 780ms forwards;
    }
    .ed-hero__cta-wrap {
        animation: ed-fade-up 700ms cubic-bezier(0.22, 1, 0.36, 1) 920ms forwards;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ed-hero__lede, .ed-hero__cta-wrap { opacity: 1; transform: none; }
}

@keyframes ed-fade-up {
    to { opacity: 1; transform: translateY(0); }
}

/* Hero CTA — vermillion slab, arrow slides */
.ed-cta {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 18px 30px 18px 32px;
    background: var(--accent-deep);
    color: #FFF8EC;
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border: 0;
    border-radius: 0;
    position: relative;
    transition: background 240ms ease, color 240ms ease;
    overflow: hidden;
}

.ed-cta__label {
    position: relative;
    z-index: 1;
}

.ed-cta__arrow {
    position: relative;
    z-index: 1;
    display: inline-block;
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1;
    transform: translateY(-1px);
}

.ed-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--ink);
    transform: translateY(101%);
    transition: transform 360ms cubic-bezier(0.65, 0, 0.35, 1);
    z-index: 0;
}

.ed-cta:hover::before,
.ed-cta:focus-visible::before {
    transform: translateY(0);
}

.ed-cta:hover .ed-cta__arrow,
.ed-cta:focus-visible .ed-cta__arrow {
    transform: translateX(6px) translateY(-1px);
}

.ed-cta:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
}

.ed-cta__meta {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-mute);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    align-self: center;
    padding: 6px 0;
    border-left: 1px solid var(--rule);
    padding-left: 14px;
}

/* =========================================================================
   Features / Modules
   ========================================================================= */

.ed-modules {
    padding: clamp(56px, 8vw, 112px) 0 clamp(72px, 10vw, 140px);
    border-top: 1px solid var(--rule);
}

.ed-modules__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: clamp(40px, 6vw, 80px);
}

.ed-modules__subtitle {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(18px, 2vw, 22px);
    color: var(--ink-soft);
    margin: 0;
    max-width: 36ch;
    text-align: right;
}

.ed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(32px, 4vw, 56px) clamp(24px, 3vw, 48px);
}

.ed-card {
    position: relative;
    padding-top: 28px;
    border-top: 1px solid var(--rule-strong);
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

/* Middle card drops down — asymmetric editorial rhythm */
.ed-card:nth-child(2) {
    margin-top: clamp(20px, 4vw, 56px);
}

.ed-card__numeral {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(64px, 7vw, 112px);
    line-height: 1;
    color: var(--ink);
    margin: 0 0 24px;
    letter-spacing: -0.02em;
    transition: color 400ms ease, transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    display: inline-block;
}

.ed-card__numeral em {
    font-style: italic;
}

.ed-card__tag {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 14px;
}

.ed-card__title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(28px, 2.6vw, 36px);
    line-height: 1.1;
    color: var(--ink);
    margin: 0 0 18px;
    letter-spacing: -0.01em;
    position: relative;
    display: inline-block;
    align-self: flex-start;
}

.ed-card__title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ed-card__body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 0 0 auto;
    max-width: 32ch;
}

.ed-card__foot {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-mute);
    display: flex;
    justify-content: space-between;
}

.ed-card:hover .ed-card__numeral {
    color: var(--accent);
    transform: translateX(6px);
}

.ed-card:hover .ed-card__title::after {
    width: 100%;
}

/* =========================================================================
   Colophon (footer strip inside the editorial)
   ========================================================================= */

.ed-colophon {
    border-top: 1px solid var(--rule-strong);
    padding: 22px 0;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-mute);
}

.ed-colophon__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ed-colophon__mark {
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 900px) {
    .ed-grid {
        grid-template-columns: 1fr;
    }
    .ed-card:nth-child(2) {
        margin-top: 0;
    }
    .ed-hero__body {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .ed-cta__meta {
        display: none;
    }
    .ed-modules__subtitle {
        text-align: left;
    }
}

@media (max-width: 560px) {
    .ed-hero__meta-right {
        font-size: 10px;
    }
    .ed-card {
        min-height: 0;
    }
}
