/*
=====================================================================
AMIABLE IMPEX — E-CATALOGUE (round 2)
Builds on nx-inner.css. Brochures shown as 3D book covers.
Markup: resources/views/e-catalogue.php (body.nx-ecat)
=====================================================================
*/

.ec-content { overflow: hidden; isolation: isolate; }
.ec-head .nx-h2 { color: var(--nx-ink); }
.ec-nowrap { white-space: nowrap; }
.ec-head { max-width: 980px; margin-bottom: 64px; }

.ec-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    max-width: 1180px;
    margin: 0 auto;
}

/* ---------- Card ---------- */
.ec-card {
    --ec-accent: var(--nx-copper);
    position: relative;
    display: flex;
    flex-direction: column;
    color: var(--nx-ink);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--nx-line);
    border-radius: 24px;
    overflow: hidden;
    transition: transform .5s var(--nx-ease), border-color .5s var(--nx-ease), box-shadow .5s var(--nx-ease);
}
.ec-card--green { --ec-accent: var(--nx-copper-2); }
.ec-card:hover { transform: translateY(-6px); border-color: rgba(229, 52, 59, .3); box-shadow: 0 40px 70px -44px rgba(11, 12, 15, .5); }
.ec-card:focus-visible { outline: 2px solid var(--nx-copper); outline-offset: 4px; }

/* Stage behind the book: light grid + soft accent light */
.ec-stage {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3.3;
    margin: 10px 10px 0;
    overflow: hidden;
    border-radius: 18px;
    background:
        radial-gradient(260px 200px at 50% 60%, color-mix(in srgb, var(--ec-accent) 22%, transparent), transparent 70%),
        linear-gradient(rgba(11, 12, 15, .05) 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(90deg, rgba(11, 12, 15, .05) 1px, transparent 1px) 0 0 / 28px 28px,
        var(--nx-paper);
    perspective: 900px;
}

/* ---------- Book cover ---------- */
.ec-book {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 46%;
    aspect-ratio: 3 / 4;
    padding: 22px 18px 18px 30px;
    color: var(--nx-bone);
    background:
        repeating-linear-gradient(115deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 6px),
        linear-gradient(160deg, #1b1e25 0%, #0b0c0f 100%);
    border-radius: 6px 14px 14px 6px;
    box-shadow:
        14px 22px 40px -16px rgba(11, 12, 15, .55),
        inset -1px 0 0 rgba(255, 255, 255, .06);
    transform: rotateY(-18deg) rotateX(4deg);
    transform-style: preserve-3d;
    transition: transform .8s var(--nx-ease), box-shadow .8s var(--nx-ease);
}
.ec-book::after { /* pages edge */
    content: "";
    position: absolute;
    top: 6px; bottom: 6px; right: -7px;
    width: 7px;
    border-radius: 0 4px 4px 0;
    background: repeating-linear-gradient(180deg, #f4f4f1 0 2px, #dcdcd6 2px 3px);
    transform: rotateY(60deg);
    transform-origin: left;
}
.ec-card:hover .ec-book { transform: rotateY(-4deg) rotateX(0deg) translateY(-6px); box-shadow: 20px 30px 50px -18px rgba(11, 12, 15, .6); }

.ec-spine {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 12px;
    border-radius: 6px 0 0 6px;
    background: var(--ec-accent);
    box-shadow: inset -2px 0 0 rgba(0, 0, 0, .2);
}

.ec-doc-icon {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    color: var(--ec-accent);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
}
.ec-doc-icon svg { width: 20px; height: 20px; }

.ec-doc-lines { display: grid; gap: 7px; }
.ec-doc-lines i { display: block; height: 4px; border-radius: 4px; background: rgba(243, 238, 230, .16); }
.ec-doc-lines i:nth-child(1) { width: 90%; background: rgba(243, 238, 230, .4); height: 6px; }
.ec-doc-lines i:nth-child(2) { width: 70%; }
.ec-doc-lines i:nth-child(3) { width: 50%; background: var(--ec-accent); }

.ec-book-logo { width: 62%; height: auto; margin-top: auto; opacity: .9; }

/* ---------- Footer row ---------- */
.ec-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 24px 24px;
}
.ec-copy { display: grid; gap: 6px; }
.ec-copy strong { font: 500 19px/1.3 var(--nx-serif); color: var(--nx-ink); transition: color .4s var(--nx-ease); }
.ec-copy small { font-size: 13.5px; line-height: 1.5; color: var(--nx-muted); }
.ec-card:hover .ec-copy strong { color: var(--nx-copper-3); }

.ec-arrow {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    font-size: 17px;
    color: var(--nx-ink);
    border: 1px solid var(--nx-line);
    border-radius: 50%;
    transform: rotate(-45deg);
    transition: background .45s var(--nx-ease), color .45s var(--nx-ease), border-color .45s var(--nx-ease), transform .45s var(--nx-ease);
}
.ec-card:hover .ec-arrow { color: #fff; background: var(--nx-copper-grad); border-color: transparent; transform: rotate(0deg); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .ec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ec-nowrap { white-space: normal; }
}
@media (max-width: 640px) {
    .ec-head { margin-bottom: 44px; }
    .ec-grid { grid-template-columns: 1fr; gap: 16px; }
    .ec-book { width: 40%; }
}
@media (prefers-reduced-motion: reduce) {
    .ec-card, .ec-book, .ec-arrow { transition: none !important; }
}
