/* ==========================================================================
   طبقات الحماية — the awareness article.
   Link AFTER site.css, which owns the tokens and the shared chrome.
   ========================================================================== */

/* Each layer picks one accent, and every coloured part of that layer reads
   `--ac` / `--ac-soft` rather than naming a colour. That is what lets the admin
   change a layer's colour from a dropdown without a stylesheet edit. */
.acc-brand  { --ac: var(--brand);   --ac-soft: color-mix(in srgb, var(--brand) 12%, transparent); }
.acc-lime   { --ac: var(--lime-600);--ac-soft: color-mix(in srgb, var(--lime-600) 14%, transparent); }
.acc-violet { --ac: #7c5cd6;        --ac-soft: color-mix(in srgb, #7c5cd6 13%, transparent); }
.acc-amber  { --ac: #d98a1f;        --ac-soft: color-mix(in srgb, #d98a1f 14%, transparent); }
.acc-rose   { --ac: #d9536b;        --ac-soft: color-mix(in srgb, #d9536b 13%, transparent); }
.acc-sky    { --ac: #2b8fc9;        --ac-soft: color-mix(in srgb, #2b8fc9 13%, transparent); }

[data-theme="dark"] .acc-violet { --ac: #a68ef0; }
[data-theme="dark"] .acc-amber  { --ac: #e8ac52; }
[data-theme="dark"] .acc-rose   { --ac: #ee8298; }
[data-theme="dark"] .acc-sky    { --ac: #5fb6e8; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.prot-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 5vw, 3.5rem);
    background: linear-gradient(to bottom, var(--bg-alt) 0%, var(--bg-alt) 60%, var(--bg) 100%);
}

.prot-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 55%),
        radial-gradient(circle at 88% 90%, color-mix(in srgb, var(--lime) 22%, transparent), transparent 55%);
    mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
    pointer-events: none;
}

.prot-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
}

.prot-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem 1rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
    margin-bottom: 1rem;
}

.prot-hero h1 {
    font-size: clamp(1.9rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.25;
    color: var(--text);
    margin-bottom: .9rem;
}

.prot-hero h1 .hl {
    color: var(--brand);
    /* A soft underline instead of a highlight block: the phrase is long and a
       filled background would fight the gradient behind it. */
    background: linear-gradient(transparent 68%, color-mix(in srgb, var(--lime) 45%, transparent) 0);
}

.prot-hero p {
    color: var(--text-muted);
    font-size: clamp(1rem, 2vw, 1.15rem);
    max-width: 60ch;
}

.prot-hero-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
}

.prot-hero-art img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    object-fit: cover;
}

/* The stand-in when the admin uploaded no hero image: concentric rings around a
   shield, which says "layers" without pretending to be a photograph. */
.prot-rings {
    position: relative;
    width: min(280px, 70vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

.prot-rings span {
    position: absolute;
    border-radius: 50%;
    border: 2px dashed color-mix(in srgb, var(--brand) 35%, transparent);
    animation: prot-spin 26s linear infinite;
}

.prot-rings span:nth-child(1) { inset: 0; }
.prot-rings span:nth-child(2) { inset: 14%; animation-direction: reverse; animation-duration: 20s; }
.prot-rings span:nth-child(3) { inset: 28%; animation-duration: 15s; }

.prot-rings i {
    position: relative;
    font-size: clamp(3rem, 9vw, 4.5rem);
    color: var(--brand);
    filter: drop-shadow(0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent));
}

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

/* --------------------------------------------------------------------------
   Facts band
   -------------------------------------------------------------------------- */
.prot-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-block: clamp(1.5rem, 4vw, 2.5rem);
}

.prot-fact {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.prot-fact:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.prot-fact i { font-size: 1.35rem; color: var(--brand); margin-bottom: .5rem; }
.prot-fact strong { display: block; font-size: 1.5rem; font-weight: 900; color: var(--text); line-height: 1.2; }
.prot-fact span { display: block; margin-top: .3rem; font-size: .88rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Section chrome shared by the article's blocks
   -------------------------------------------------------------------------- */
.prot-section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.prot-section.alt { background: var(--bg-alt); }

.prot-section-head { text-align: center; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }

.prot-section-head h2 {
    font-size: clamp(1.5rem, 3.6vw, 2.2rem);
    font-weight: 900;
    color: var(--text);
    margin-bottom: .5rem;
}

.prot-section-head p { color: var(--text-muted); max-width: 62ch; margin-inline: auto; }

.prot-note {
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-start: 4px solid var(--lime-600);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 3vw, 2rem);
    box-shadow: var(--shadow-sm);
}

.prot-note h2 { font-size: clamp(1.25rem, 3vw, 1.7rem); font-weight: 900; margin-bottom: .8rem; color: var(--text); }
.prot-note p { color: var(--text-muted); }
.prot-note p + p { margin-top: .85rem; }
.prot-note ul { list-style: none; display: grid; gap: .5rem; margin-top: .85rem; }
.prot-note li { position: relative; padding-inline-start: 1.5rem; color: var(--text-muted); }
.prot-note li::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: .2em;
    font-size: .8rem;
    color: var(--lime-600);
}

/* --------------------------------------------------------------------------
   A layer
   -------------------------------------------------------------------------- */
.prot-layer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(1.25rem, 3vw, 2.25rem);
    box-shadow: var(--shadow-sm);
    scroll-margin-top: calc(var(--header-h) + 20px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.prot-layer + .prot-layer { margin-top: 1.5rem; }
.prot-layer:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--ac) 40%, var(--border)); }

/* The accent bar down the leading edge is what makes six long blocks readable
   as six distinct things while scrolling past them. */
.prot-layer::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 5px;
    background: var(--ac);
}

.prot-layer-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.prot-layer-badge {
    flex-shrink: 0;
    position: relative;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-size: 1.35rem;
    color: #fff;
    background: var(--ac);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--ac) 38%, transparent);
}

/* The layer number rides the badge rather than sitting in the heading text:
   the heading already begins with "الطبقة الأولى" and two numbers in one line
   would read as a mistake. */
.prot-layer-badge b {
    position: absolute;
    inset-block-start: -8px;
    inset-inline-start: -8px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 900;
    color: var(--ac);
    background: var(--surface);
    border: 2px solid var(--ac);
}

.prot-layer-head h3 {
    font-size: clamp(1.1rem, 2.6vw, 1.45rem);
    font-weight: 900;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: .3rem;
}

.prot-tagline { color: var(--ac); font-weight: 700; font-size: .95rem; }

.prot-layer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

.prot-layer-grid.has-image { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }

.prot-layer-body p { color: var(--text-muted); }
.prot-layer-body p + p { margin-top: .85rem; }
.prot-layer-body ul { list-style: none; display: grid; gap: .5rem; margin-top: .85rem; }
.prot-layer-body li { position: relative; padding-inline-start: 1.5rem; color: var(--text-muted); }
.prot-layer-body li::before {
    content: '\f0da'; /* fa-caret-right — flipped for RTL below */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: .12em;
    color: var(--ac);
}

.prot-figure { margin: 0; }

.prot-figure img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}

.prot-figure figcaption {
    margin-top: .6rem;
    font-size: .85rem;
    color: var(--text-muted);
    text-align: center;
}

.prot-points {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .9rem;
    margin-top: 1.5rem;
}

.prot-point {
    background: var(--ac-soft);
    border: 1px solid color-mix(in srgb, var(--ac) 24%, transparent);
    border-radius: 14px;
    padding: 1rem;
    transition: var(--transition);
}

.prot-point:hover { transform: translateY(-3px); }
.prot-point i { color: var(--ac); font-size: 1.05rem; margin-bottom: .45rem; display: block; }
.prot-point h4 { font-size: .97rem; font-weight: 800; color: var(--text); margin-bottom: .3rem; }
.prot-point p { font-size: .88rem; color: var(--text-muted); line-height: 1.6; }

/* --------------------------------------------------------------------------
   Mind map
   -------------------------------------------------------------------------- */
.prot-map {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0;
}

.prot-map-center {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1.8rem;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-700));
    box-shadow: var(--shadow-lg);
    z-index: 2;
}

/* The trunk is one absolutely-positioned line rather than a border on each
   branch: a per-branch border cannot join across the gaps between them. */
.prot-map-branches {
    position: relative;
    width: 100%;
    padding-block-start: 2.5rem;
    display: grid;
    gap: 1.25rem;
}

.prot-map-branches::before {
    content: '';
    position: absolute;
    inset-block: 0 2rem;
    inset-inline-start: 50%;
    width: 2px;
    background: linear-gradient(to bottom, var(--brand), color-mix(in srgb, var(--brand) 15%, transparent));
    transform: translateX(50%);
}

.prot-branch {
    position: relative;
    width: min(100%, 460px);
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--ac) 30%, var(--border));
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.prot-branch:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* Odd branches hang on one side of the trunk, even on the other. */
.prot-branch:nth-child(odd)  { justify-self: start; }
.prot-branch:nth-child(even) { justify-self: end; }

/* The connector from the trunk to the card. `inset-inline` follows the writing
   direction, so this stays correct on an LTR mirror of the page. */
.prot-branch::before {
    content: '';
    position: absolute;
    inset-block-start: 50%;
    width: clamp(1rem, 6vw, 4rem);
    height: 2px;
    background: color-mix(in srgb, var(--ac) 55%, transparent);
}

.prot-branch:nth-child(odd)::before  { inset-inline-end: calc(-1 * clamp(1rem, 6vw, 4rem)); }
.prot-branch:nth-child(even)::before { inset-inline-start: calc(-1 * clamp(1rem, 6vw, 4rem)); }

.prot-branch-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .5rem;
}

.prot-branch-head i {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: .9rem;
    color: #fff;
    background: var(--ac);
    flex-shrink: 0;
}

.prot-branch-head h4 { font-size: .98rem; font-weight: 900; color: var(--text); line-height: 1.4; }

.prot-branch-chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.prot-chip {
    font-size: .8rem;
    font-weight: 700;
    padding: .3rem .75rem;
    border-radius: 999px;
    color: var(--ac);
    background: var(--ac-soft);
    border: 1px solid color-mix(in srgb, var(--ac) 25%, transparent);
}

/* --------------------------------------------------------------------------
   Sources
   -------------------------------------------------------------------------- */
.prot-sources { display: grid; gap: .85rem; }

.prot-source {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.prot-source:hover { border-color: var(--brand); transform: translateX(-4px); }

.prot-source > i {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 12%, transparent);
}

.prot-source h4 { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: .2rem; }
.prot-source .pub { font-size: .82rem; font-weight: 700; color: var(--lime-600); }
.prot-source p { font-size: .88rem; color: var(--text-muted); margin-top: .3rem; }

.prot-source a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .45rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--brand);
    /* A signed-out reader may not recognise a bare domain as a link. */
    text-decoration: underline;
    text-underline-offset: 3px;
    /* The URL is Latin text inside an RTL paragraph; isolate it or the bidi
       algorithm moves the trailing punctuation to the wrong end. */
    direction: ltr;
    unicode-bidi: isolate;
}

.prot-sources-note { margin-top: 1rem; font-size: .88rem; color: var(--text-muted); text-align: center; }

/* --------------------------------------------------------------------------
   Closing
   -------------------------------------------------------------------------- */
.prot-closing {
    text-align: center;
    padding: clamp(1.75rem, 5vw, 3rem);
    border-radius: var(--radius-lg);
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-700));
    box-shadow: var(--shadow-lg);
}

.prot-closing i { font-size: 2rem; opacity: .9; margin-bottom: .75rem; }
.prot-closing h2 { font-size: clamp(1.35rem, 3.4vw, 2rem); font-weight: 900; margin-bottom: .75rem; }
.prot-closing p { opacity: .92; max-width: 62ch; margin-inline: auto; }
.prot-closing p + p { margin-top: .8rem; }

.prot-closing-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.5rem; }

.prot-closing .btn-ghost {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .4);
    color: #fff;
}

.prot-closing .btn-ghost:hover { background: #fff; color: var(--brand); border-color: #fff; }

/* --------------------------------------------------------------------------
   Reveal-on-scroll
   -------------------------------------------------------------------------- */
.prot-reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.prot-reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .prot-reveal { opacity: 1; transform: none; }
    .prot-rings span { animation: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .prot-hero-inner { grid-template-columns: 1fr; text-align: center; }
    .prot-hero p { margin-inline: auto; }
    .prot-layer-grid.has-image { grid-template-columns: 1fr; }

    /* The two-sided map needs width it does not have on a phone. Move the trunk
       to the leading edge and hang every branch off it in one column — the same
       information, read top to bottom. */
    .prot-map-branches::before { inset-inline-start: 10px; transform: none; }
    /* …and the centre node goes with it. Left centred over a trunk pinned to
       the edge, it reads as a pill that belongs to nothing. */
    .prot-map-center { justify-self: start; }
    .prot-branch,
    .prot-branch:nth-child(odd),
    .prot-branch:nth-child(even) { justify-self: stretch; margin-inline-start: 2.25rem; width: auto; }
    .prot-branch::before,
    .prot-branch:nth-child(odd)::before,
    .prot-branch:nth-child(even)::before {
        inset-inline-start: -2.25rem;
        inset-inline-end: auto;
        width: 2.25rem;
    }
}
