/* ===========================================================================
   SYN//ARCHIVE — Hub pages (Codex lore index + Mechanics overview)
   Reuses syn-theme.css tokens; mechanics pages also load protocol.css.
   =========================================================================== */

.hub {
    max-width: var(--wrap, 1200px);
    margin: 0 auto;
    padding: 26px 22px 90px;
}

/* generic section heading used across both hubs */
.hub-h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    letter-spacing: 0.01em;
    margin: 0 0 4px;
    color: var(--bone);
}
.hub-rule { height: 1px; background: var(--line-soft); border: 0; margin: 10px 0 22px; }

/* ===========================================================================
   CODEX  (lore index — sidebar + card grids)
   =========================================================================== */
.codex-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

/* --- sidebar --- */
.codex-side {
    position: sticky;
    top: calc(var(--head-h, 64px) + 16px);
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 14px;
    max-height: calc(100vh - var(--head-h, 64px) - 32px);
    overflow: auto;
}
.codex-search {
    display: flex;
    margin-bottom: 12px;
}
.codex-search input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-soft);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    color: var(--bone);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 9px 12px;
    outline: none;
}
.codex-search input::placeholder { color: var(--ash); letter-spacing: 0.04em; }
.codex-search input:focus { border-color: var(--page-accent); }
.codex-search button {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line-soft);
    border-radius: 0 8px 8px 0;
    color: var(--ash);
    width: 42px;
    cursor: pointer;
}
.codex-search button:hover { color: var(--bone); }

.cx-nav { display: flex; flex-direction: column; gap: 2px; }
.cx-link, .cx-trigger {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 9px;
    color: var(--ash);
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    padding: 10px 12px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.16s, color 0.16s;
}
.cx-link:hover, .cx-trigger:hover { background: rgba(255, 255, 255, 0.05); color: var(--bone); }
.cx-link.is-home { background: rgba(255, 255, 255, 0.05); color: var(--bone); border: 1px solid var(--line-soft); }
.cx-link i, .cx-trigger > i:first-child { width: 18px; text-align: center; color: var(--page-accent); font-size: 0.9rem; }
.cx-trigger { justify-content: flex-start; }
.cx-trigger .chev { margin-left: auto; font-size: 0.62rem; opacity: 0.7; transition: transform 0.2s; }
.cx-group.open .cx-trigger .chev { transform: rotate(180deg); }
.cx-sub {
    display: none;
    flex-direction: column;
    margin: 2px 0 6px 30px;
    padding-left: 11px;
    border-left: 1px solid var(--line-soft);
    gap: 1px;
}
.cx-group.open .cx-sub { display: flex; }
.cx-sub a {
    color: var(--ash);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    padding: 6px 9px;
    border-radius: 7px;
    transition: background 0.16s, color 0.16s;
}
.cx-sub a:hover { background: rgba(255, 255, 255, 0.05); color: var(--bone); }

/* --- main --- */
.codex-main { min-width: 0; }
.codex-intro {
    text-align: center;
    font-family: var(--font-display);
    color: var(--ash);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-style: italic;
    line-height: 1.5;
    margin: 4px auto 6px;
    max-width: 70ch;
}
.codex-intro b { color: var(--bone); font-style: normal; }
.codex-lede {
    color: var(--ash);
    line-height: 1.7;
    max-width: 74ch;
    margin: 0 auto 8px;
    text-align: center;
    font-size: 0.98rem;
}
.codex-lede .term { color: var(--page-accent); border-bottom: 1px dotted var(--page-accent); cursor: help; }
.codex-qr {
    text-align: center;
    margin: 30px 0 6px;
}
.codex-qr h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.4vw, 2.3rem);
    color: var(--bone);
    margin: 0;
    letter-spacing: 0.02em;
}
.codex-qr p { color: var(--ash); font-style: italic; margin: 4px 0 0; }

.codex-sec { margin-top: 40px; }
.codex-sec > h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--bone);
    letter-spacing: 0.01em;
    margin: 0 0 4px;
}
.codex-sec > .sec-rule { height: 1px; background: var(--line-soft); border: 0; margin: 0 0 20px; }

.cx-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px 18px;
}
.cx-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border-radius: 10px;
    padding: 22px 16px;
    text-align: center;
    transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.cx-card .cx-title {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 1.02rem;
    color: var(--bone);
}
.cx-card .cx-cap {
    color: var(--ash);
    font-style: italic;
    font-size: 0.82rem;
    line-height: 1.45;
    margin-top: 9px;
}
.cx-card.dashed {
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.012);
}
.cx-card.solid {
    border: 1px dashed var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
        rgba(20, 22, 40, 0.5);
}
.cx-card:hover {
    border-color: var(--page-accent);
    transform: translateY(-2px);
}
.cx-card:hover .cx-title { color: var(--page-accent); }

/* ===========================================================================
   MECHANICS  (overview — contents + resources + flowing sections)
   =========================================================================== */
.mech-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    color: var(--bone);
    margin: 0 0 26px;
    letter-spacing: 0.01em;
}
.mech-overview-h {
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.4vw, 2.2rem);
    color: var(--bone);
    margin: 0 0 4px;
}
.mech-dash { width: min(420px, 60%); height: 0; border-top: 1px dashed var(--line); margin: 0 auto 26px; }

.mech-overview {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 26px;
    align-items: start;
}
.mech-contents {
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 22px 24px;
    background: rgba(255, 255, 255, 0.012);
}
.mech-contents h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--bone);
    margin: 0 0 10px;
}
.mech-contents .ess-note {
    color: var(--ash);
    font-style: italic;
    font-size: 0.86rem;
    line-height: 1.5;
    margin: 0 0 14px;
}
.mech-contents ul { list-style: none; margin: 0; padding: 0; }
.mech-contents > ul > li { margin: 6px 0; }
.mech-contents > ul > li > a,
.mech-contents > ul > li > span.grp {
    font-family: var(--font-display);
    color: var(--bone);
    font-size: 1.02rem;
    text-decoration: none;
}
.mech-contents > ul > li > a:hover { color: var(--page-accent); }
.mech-contents ul ul { margin: 4px 0 10px 6px; }
.mech-contents ul ul li { margin: 4px 0; padding-left: 22px; position: relative; }
.mech-contents ul ul li a {
    color: var(--ash);
    text-decoration: none;
    font-size: 0.92rem;
    border-bottom: 1px dotted transparent;
}
.mech-contents ul ul li a:hover { color: var(--bone); border-bottom-color: var(--ash); }
.mech-contents ul ul li.ess::before {
    content: "\f06c"; /* leaf */
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    position: absolute; left: 0; top: 1px;
    color: var(--d-green, #5ec26a); font-size: 0.74rem;
}
.mech-contents ul ul li.sub::before {
    content: ""; position: absolute; left: 4px; top: 0.62em;
    width: 6px; height: 6px; border: 1px solid var(--line); border-radius: 50%;
}

.mech-res-head {
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--bone);
    margin: 0 0 14px;
}
.mech-res {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.res-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 92px;
    padding: 16px 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.012);
    color: var(--ash);
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.92rem;
    text-decoration: none;
    transition: border-color 0.18s, color 0.18s, transform 0.18s;
}
.res-card:hover { border-color: var(--page-accent); color: var(--page-accent); transform: translateY(-2px); }

/* sections */
.mech-sec { margin-top: 46px; }
.mech-sec > h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.8vw, 1.9rem);
    color: var(--bone);
    margin: 0 0 12px;
}
.mech-sec p { color: var(--ash); line-height: 1.7; max-width: 86ch; }
.mech-sec p b, .mech-sec p strong { color: var(--bone); }
.mech-sec .link { color: var(--page-accent); text-decoration: none; border-bottom: 1px dotted var(--page-accent); }

/* callout (striped info box like the reference) */
.callout {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 18px 0 0;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
    background:
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 10px, transparent 10px 20px),
        rgba(255, 255, 255, 0.02);
    color: var(--ash);
    line-height: 1.6;
}
.callout i.ci { color: var(--page-accent); font-size: 1.1rem; flex-shrink: 0; }
.callout code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    padding: 2px 7px;
    color: var(--bone);
    font-size: 0.86em;
}

/* stat cards (Syn City's 8 categories) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}
.statc {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--panel);
    overflow: hidden;
}
.statc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.02);
}
.statc-head h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--bone); margin: 0; }
.statc-body { padding: 14px 16px 16px; }
.statc-quote { color: var(--ash); font-style: italic; font-size: 0.86rem; margin: 0 0 12px; }
.statc-sub { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.statc-sub li { font-size: 0.9rem; }
.statc-sub .sn { color: var(--bone); font-family: var(--font-display); font-weight: 600; }
.statc-sub .sd { color: var(--ash); line-height: 1.45; }
.abbr {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: #fff;
    padding: 4px 9px;
    border-radius: 999px;
}
.abbr.dex, .abbr.ref { background: #3a5bd9; }
.abbr.int, .abbr.tech { background: #7b4fd0; }
.abbr.har, .abbr.soc { background: #45a05e; }
.abbr.str, .abbr.body { background: #d2682f; }
.abbr.mov { background: #2f9fb0; }
.abbr.cool { background: #b14fa0; }
.abbr.tact { background: #c0903a; }

/* XP options grid */
.xp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 26px;
    margin-top: 18px;
    padding: 22px 24px;
    border: 1px dashed var(--line);
    border-radius: 14px;
}
.xp-opt h4 { font-family: var(--font-display); font-weight: 600; color: var(--bone); font-size: 1.05rem; margin: 0 0 4px; }
.xp-opt h4 .cost { color: var(--page-accent); }
.xp-opt p { color: var(--ash); font-size: 0.86rem; line-height: 1.5; margin: 0; }

/* actions grid */
.act-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 28px;
    margin-top: 18px;
    padding: 24px;
    border: 1px dashed var(--line);
    border-radius: 14px;
}
.act h4 { font-family: var(--font-display); font-weight: 600; color: var(--bone); font-size: 1.08rem; margin: 0 0 5px; }
.act h4::before { content: "\2022"; color: var(--page-accent); margin-right: 7px; }
.act p { color: var(--ash); font-size: 0.88rem; line-height: 1.55; margin: 0; }

/* initiative diagram */
.init-wrap {
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.012);
}
.init-cap { text-align: center; color: var(--ash); font-size: 0.9rem; margin: 0 0 12px; }
.init-row { display: flex; align-items: flex-end; justify-content: center; gap: 0; flex-wrap: wrap; }
.init-node { text-align: center; width: 92px; }
.init-pip {
    width: 50px; height: 50px; margin: 0 auto 6px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.3rem;
}
.init-roll { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.08em; color: var(--ash); display: block; margin-bottom: 5px; }
.init-rank { font-family: var(--font-display); font-weight: 700; color: var(--bone); font-size: 0.95rem; }
.init-arrow { color: var(--ash); align-self: center; padding: 0 4px 22px; }
.init-foot { text-align: center; color: var(--ash); font-size: 0.82rem; font-style: italic; margin: 12px 0 0; }

/* coming-soon (socials) */
.soon {
    max-width: 760px;
    margin: 0 auto;
    padding: 60px 22px 120px;
    text-align: center;
}
.soon-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--page-accent);
    border: 1px solid var(--page-accent);
    border-radius: 999px;
    padding: 7px 16px;
    margin-bottom: 22px;
}
.soon h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 6vw, 3.2rem); color: var(--bone); margin: 0 0 14px; letter-spacing: 0.01em; }
.soon h1 .ghost { color: transparent; -webkit-text-stroke: 1px var(--line); }
.soon p { color: var(--ash); line-height: 1.7; font-size: 1.02rem; max-width: 56ch; margin: 0 auto 28px; }
.soon-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.soon-links a {
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ash); text-decoration: none;
    border: 1px solid var(--line); border-radius: 999px; padding: 11px 20px;
    transition: border-color 0.2s, color 0.2s;
}
.soon-links a:hover { border-color: var(--page-accent); color: var(--page-accent); }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 46px; }
.soon-card {
    border: 1px dashed var(--line); border-radius: 12px; padding: 22px 14px;
    color: var(--ash); opacity: 0.7;
}
.soon-card i { font-size: 1.5rem; color: var(--page-accent); display: block; margin-bottom: 10px; }
.soon-card span { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 980px) {
    .codex-layout { grid-template-columns: 1fr; }
    .codex-side { position: static; max-height: none; }
    .mech-overview { grid-template-columns: 1fr; }
    .mech-res, .xp-grid, .act-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .hub { padding: 18px 14px 70px; }
    .mech-res, .xp-grid, .act-grid { grid-template-columns: 1fr; }
    .init-node { width: 74px; }
}
