/* Base styles retained for existing components; brand.css loads last and
   defines the current colour and typography system. See DESIGN.md. */
/* ==========================================================================
   YA — Public skin
   --------------------------------------------------------------------------
   Loaded after ya.css by _Layout.cshtml. ya.css owns tokens and primitives;
   this file owns the public site's chrome and its editorial voice.

   The spatial idea: the page is paper, and the darkest moments — the hero
   and the colophon — are ink *plates* inset into it, with rounded corners
   and a lit rim. Dark, light, dark: the page opens and closes on the shell
   and does its work in between.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Editorial typography
   --------------------------------------------------------------------------
   The serif is the brand's voice but it is expensive attention: it gets the
   page title and section openings, and nothing under ~1.5rem. Card titles,
   labels and UI text stay in the sans, which is crisper at small sizes. */

h1, h2 {
    font-family: var(--ya-font-display);
    font-weight: 400;
    letter-spacing: -.024em;
    line-height: 1.08;
    font-synthesis-weight: none;
}
h3, h4, h5, h6 { font-family: var(--ya-font-sans); font-weight: 600; }

/* Arabic has no Instrument Serif equivalent; Markazi carries the display
   role and Plex Arabic the body, mirroring the Latin pairing's contrast. */
[dir="rtl"] h1, [dir="rtl"] h2,
[dir="rtl"] .font-display, [dir="rtl"] .ya-display,
[dir="rtl"] .ya-display-1, [dir="rtl"] .ya-display-2, [dir="rtl"] .ya-display-3 {
    font-family: "Markazi Text", "IBM Plex Sans Arabic", serif;
    letter-spacing: 0;
    line-height: 1.25;
}
[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", "Instrument Sans", system-ui, sans-serif; }

/* --------------------------------------------------------------------------
   2. Navigation
   --------------------------------------------------------------------------
   Frosted paper, always light, always the same. It condenses on scroll —
   the only thing that changes is its weight in the page, not its identity. */

.ya-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--ya-bg) 78%, transparent);
    backdrop-filter: blur(var(--ya-blur-md)) saturate(1.8);
    -webkit-backdrop-filter: blur(var(--ya-blur-md)) saturate(1.8);
    border-bottom: 1px solid transparent;
    transition: background-color var(--ya-duration-base) var(--ya-ease-out),
                border-color var(--ya-duration-base) var(--ya-ease-out),
                box-shadow var(--ya-duration-base) var(--ya-ease-out);
}
.ya-nav.is-scrolled {
    background: color-mix(in srgb, var(--ya-bg) 90%, transparent);
    border-bottom-color: var(--ya-border);
    box-shadow: 0 1px 24px -12px rgba(15, 23, 42, .28);
}
@supports not (backdrop-filter: blur(1px)) {
    .ya-nav { background: var(--ya-bg); }
}

.ya-nav-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 4rem;
    transition: height var(--ya-duration-base) var(--ya-ease-out);
}
.ya-nav.is-scrolled .ya-nav-inner { height: 3.5rem; }

/* Wordmark — the "Y/A" plate. Set in the display serif so the brand mark
   and the headlines are visibly the same voice. */
.ya-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--ya-r-sm);
    background: var(--ya-ink);
    color: var(--ya-bg);
    font-family: var(--ya-font-display);
    font-size: .9375rem;
    line-height: 1;
    padding-top: .0625rem;
    flex-shrink: 0;
    transition: transform var(--ya-duration-base) var(--ya-ease-spring);
}
a:hover > .ya-mark { transform: rotate(-4deg) scale(1.06); }

/* Nav link: a rule that draws in from the centre, and a settled state that
   is simply "darker", not "boxed". */
.ya-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ya-ink-soft);
    padding: .375rem 0;
    transition: color var(--ya-duration-fast) var(--ya-ease-out);
}
.ya-nav-link::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--ya-duration-base) var(--ya-ease-out);
}
.ya-nav-link:hover { color: var(--ya-ink); }
.ya-nav-link:hover::after { transform: scaleX(1); }
.ya-nav-link.is-active { color: var(--ya-ink); font-weight: 600; }
.ya-nav-link.is-active::after { transform: scaleX(1); }

/* Cart count. Sits on the icon rather than beside it so the toolbar keeps a
   single rhythm whether the cart is empty or not. */
.ya-nav-count {
    position: absolute;
    top: .125rem;
    inset-inline-end: .125rem;
    min-width: 1.0625rem;
    height: 1.0625rem;
    padding-inline: .25rem;
    display: grid;
    place-items: center;
    border-radius: var(--ya-r-pill);
    background: var(--ya-ink);
    color: var(--ya-bg);
    font-family: var(--ya-font-mono);
    font-size: .625rem;
    font-weight: 500;
    line-height: 1;
    border: 2px solid var(--ya-bg);
}

/* Mobile drawer. */
.ya-drawer {
    border-top: 1px solid var(--ya-border);
    padding: 1rem 0 1.25rem;
}
.ya-drawer a { display: block; padding: .625rem 0; font-size: .9375rem; color: var(--ya-ink-soft); }
.ya-drawer a.is-active { color: var(--ya-ink); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
    .ya-drawer:not(.hidden) { animation: ya-drawer-in .28s var(--ya-ease-out); }
    @keyframes ya-drawer-in {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* --------------------------------------------------------------------------
   3. Plates — the dark bands inset into the paper
   -------------------------------------------------------------------------- */

.ya-plate {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--ya-stage);
    color: var(--ya-s-100);
    border-radius: var(--ya-r-2xl);
    box-shadow: var(--ya-elevation-shell);
}
.ya-plate a:not(.btn-accent):not(.btn-ghost) { color: inherit; }

/* --------------------------------------------------------------------------
   5. Catalogue entries
   --------------------------------------------------------------------------
   One card anatomy for every kind of work — essay, book, project, course,
   product — because in the index they are all the same kind of thing. The
   only difference is the type tag. */

.ya-entry {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--ya-card);
    border: 1px solid var(--ya-border);
    border-radius: var(--ya-r-lg);
    overflow: hidden;
    box-shadow: var(--ya-elevation-1);
    transition: box-shadow var(--ya-duration-base) var(--ya-ease-out),
                border-color var(--ya-duration-base) var(--ya-ease-out),
                transform var(--ya-duration-base) var(--ya-ease-out);
}
.ya-entry:hover {
    transform: translateY(-4px);
    border-color: var(--ya-border-2);
    box-shadow: var(--ya-elevation-2);
}
.ya-entry-media {
    position: relative;
    overflow: hidden;
    background: var(--ya-surface-sunk);
    /* A light cover plate on a light card would otherwise dissolve into it. */
    box-shadow: inset 0 -1px 0 var(--ya-border);
}
.ya-entry-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--ya-duration-slow) var(--ya-ease-out),
                filter var(--ya-duration-slow) var(--ya-ease-out);
}
.ya-entry:hover .ya-entry-media img { transform: scale(1.04); }
.ya-entry-body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem; }
.ya-entry-title {
    /* Explicitly the sans, because an entry title is often an <h2> and the
       page-level heading rule would otherwise hand it the display serif.
       The serif is reserved for page and section openings: at 17px its
       single weight cannot out-rank the description underneath it, and the
       hierarchy collapses. */
    font-family: var(--ya-font-sans);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -.014em;
    color: var(--ya-ink);
    transition: color var(--ya-duration-fast) var(--ya-ease-out);
}
.ya-entry-excerpt {
    font-size: .875rem;
    line-height: 1.6;
    color: var(--ya-ink-soft);
    margin-top: .5rem;
    flex: 1;
}
.ya-entry-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.125rem;
}
/* The plate number: an entry's real position in the current index. */
.ya-entry-index {
    position: absolute;
    top: .875rem;
    inset-inline-end: .875rem;
    z-index: 2;
    font-family: var(--ya-font-mono);
    font-size: .625rem;
    letter-spacing: .1em;
    color: rgba(248, 250, 252, .7);
    mix-blend-mode: difference;
}

.ya-price { font-family: var(--ya-font-mono); font-size: .9375rem; font-weight: 500; color: var(--ya-ink); letter-spacing: -.02em; }

/* Cover fallback — a plate with the work's type set in mono, so a missing
   image still reads as a catalogued object rather than a broken card. */
.ya-cover-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, var(--ya-s-800), var(--ya-s-900)),
        var(--ya-s-900);
    color: rgba(248, 250, 252, .55);
}

/* --------------------------------------------------------------------------
   6. Footer / colophon
   -------------------------------------------------------------------------- */

/* Scoped past the language switcher: that component sets its own colour per
   state, and a blanket `.ya-colophon a` outranks the utility class doing it,
   which leaves the selected chip's label invisible on its own background. */
.ya-colophon :not(.ya-lang):not(.ya-lang-options) > a { color: rgba(248, 250, 252, .6); transition: color var(--ya-duration-fast) var(--ya-ease-out); }
.ya-colophon :not(.ya-lang):not(.ya-lang-options) > a:hover { color: var(--ya-s-100); }
.ya-colophon input {
    background: rgba(248, 250, 252, .06);
    border-color: rgba(248, 250, 252, .16);
    color: var(--ya-s-100);
}
.ya-colophon input::placeholder { color: rgba(248, 250, 252, .55); }
.ya-colophon input:focus {
    border-color: var(--ya-s-100);
    box-shadow: 0 0 0 3px rgba(248, 250, 252, .12);
}

/* --------------------------------------------------------------------------
   7. Article reading experience
   -------------------------------------------------------------------------- */

.ya-article-body { font-size: 1.0625rem; line-height: 1.78; color: var(--ya-ink-soft); }
.ya-article-body > p:first-of-type::first-letter {
    float: inline-start;
    font-family: var(--ya-font-display);
    font-size: 3.6em;
    line-height: .82;
    padding-inline-end: .08em;
    padding-top: .06em;
    color: var(--ya-ink);
}
[dir="rtl"] .ya-article-body > p:first-of-type::first-letter { float: none; font-size: inherit; padding: 0; }

/* --------------------------------------------------------------------------
   8. Legacy class bridge
   --------------------------------------------------------------------------
   A handful of pages still carry the previous shell's class names. They map
   onto the new vocabulary here so nothing renders unstyled while pages are
   migrated one at a time. */

.md-navbar { background: color-mix(in srgb, var(--ya-bg) 82%, transparent); backdrop-filter: blur(var(--ya-blur-md)); border-bottom: 1px solid var(--ya-border); }
.md-navbar-icon { color: var(--ya-ink-soft); border-radius: var(--ya-r-sm); transition: background-color var(--ya-duration-fast) var(--ya-ease-out), color var(--ya-duration-fast) var(--ya-ease-out); }
.md-navbar-icon:hover { background: var(--ya-surface-sunk); color: var(--ya-ink); }
.stage-grain { position: relative; isolation: isolate; }
.hairline-gold { border-color: rgba(248, 250, 252, .16); }
