/* ==========================================================================
   ARKOLOGY BRAND LAYER — "1A · The Reading Table"
   Loaded after stock Source screen.css (default.hbs). Self-contained: the index
   is rebuilt from scratch with ak-* markup, so we don't lean on Source's feed
   components. Faithful to the approved 1A mockup — essay-paced single column,
   masked hero texture, featured lede, hairline "More field notes" rows,
   centered newsletter. Dark-only, as mocked.
   ========================================================================== */

:root {
    --ak-bg:        #090d0e;   /* primary canvas */
    --ak-surface:   #141919;   /* offset panels */
    --ak-text:      #e8eaed;   /* primary text */
    --ak-2:         #99a1a3;   /* secondary text */
    --ak-muted:     #666e70;   /* tertiary / labels */
    --ak-sage:      #82ab98;   /* accent / links / tags */
    --ak-moss:      #3f4a45;   /* deep moss */

    --ak-line:        rgba(232,234,237,.14);
    --ak-line-soft:   rgba(232,234,237,.10);
    --ak-line-strong: rgba(232,234,237,.20);
    --ak-line-hair:   rgba(232,234,237,.16);
    --ak-line-35:     rgba(232,234,237,.35);

    --ak-max: 1080px;
    --ak-pad: 44px;

    --sg: "Space Grotesk", system-ui, sans-serif;
    --dm: "DM Sans", Verdana, sans-serif;

    --ak-ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---- Base ------------------------------------------------------------------ */
html, body {
    background: var(--ak-bg);
    color: var(--ak-text);
    font-family: var(--dm);
    font-weight: 300;
    margin: 0;
    padding: 0;
    overflow-x: clip;   /* contain the full-bleed hero texture (100vw) without breaking sticky */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.gh-viewport { min-height: 100vh; background: var(--ak-bg); }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ak-sage); color: var(--ak-bg); }
* { scrollbar-width: thin; scrollbar-color: var(--ak-line-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background-color: var(--ak-line-strong); }
::-webkit-scrollbar-track { background: transparent; }

/* Shared primary button (mock .btn-primary) */
.btn-primary {
    display: inline-block;
    border: 1px solid var(--ak-text);
    font-family: var(--sg);
    color: var(--ak-text);
    letter-spacing: .5px;
    background-color: rgba(9,13,14,.08);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    border-radius: 5px;
    padding: 10px 24px;
    font-size: .9rem;
    font-weight: 400;
    line-height: 20px;
    cursor: pointer;
    transition: all .2s var(--ak-ease);
}
.btn-primary:hover { border-color: var(--ak-bg); background-color: var(--ak-text); color: var(--ak-bg); }

/* Shared tag eyebrow (mock .ak-tag) */
.ak-tag {
    font-family: var(--sg);
    font-size: 10px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--ak-sage);
    font-weight: 400;
}

/* Row-title hover behaviour (mock .ak-row-title / .ak-postrow) */
.ak-row-title { transition: color .25s var(--ak-ease); }
.ak-postrow:hover .ak-row-title { color: var(--ak-sage); }

/* ==========================================================================
   TOPBAR (global) — logo · Blog / Studio / Subscribe
   ========================================================================== */
.ak-topbar {
    border-bottom: 1px solid var(--ak-line);
    background: rgba(9,13,14,.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    position: sticky; top: 0; z-index: 30;
}
.ak-topbar-inner {
    max-width: var(--ak-max);
    margin: 0 auto;
    padding: 22px var(--ak-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ak-topbar-logo img { height: 30px; width: auto; display: block; }
.ak-topbar-logo .ak-wordmark {
    font-family: var(--sg); font-weight: 300; font-size: 20px; letter-spacing: .3px; color: var(--ak-text);
}
.ak-topbar-nav { display: flex; align-items: center; gap: 28px; }
.ak-topbar-nav a {
    font-family: var(--sg); font-size: 13px; font-weight: 300; color: var(--ak-2);
    transition: color .2s var(--ak-ease);
}
.ak-topbar-nav a:hover, .ak-topbar-nav a.is-active { color: var(--ak-text); }
.ak-topbar-nav .btn-primary { padding: 8px 18px; font-size: 12.5px; color: var(--ak-text); line-height: 20px; }
.ak-topbar-nav .btn-primary:hover { color: var(--ak-bg); }

/* ==========================================================================
   INDEX SHELL
   ========================================================================== */
.ak-index {
    position: relative;
    max-width: var(--ak-max);
    margin: 0 auto;
    min-height: calc(100vh - 76px); /* hold page height even when a segment is empty */
}

/* Hero texture — full-bleed to the viewport edges (breaks out of the max-width
   column), masked, behind the masthead. A left-weighted dark gradient keeps the
   headline legible over the texture. */
.ak-hero-texture {
    position: absolute; top: 0; left: 50%; right: auto;
    /* overshoot 3px each side so any subpixel hairline is clipped off (overflow-x:clip) */
    margin-left: calc(-50vw - 3px); width: calc(100vw + 6px); height: 520px;
    background:
        linear-gradient(90deg, var(--ak-bg) 6%, rgba(9,13,14,.72) 30%, rgba(9,13,14,.18) 62%, transparent 80%),
        url("../images/ak-hero-texture.jpg") center top / cover no-repeat;
    opacity: .6;
    -webkit-mask-image: linear-gradient(to bottom, #000 52%, transparent);
    mask-image: linear-gradient(to bottom, #000 52%, transparent);
    pointer-events: none;
    z-index: 0;
}
.ak-index > *:not(.ak-hero-texture) { position: relative; z-index: 1; }

/* Empty-segment state — keep the column full-width and vertically present */
.ak-empty {
    min-height: 30vh; padding: 40px var(--ak-pad) 60px;
    display: flex; flex-direction: column; gap: 8px;
}
.ak-empty-title { font-family: var(--sg); font-weight: 300; font-size: 22px; color: var(--ak-text); margin: 0; }
.ak-empty-sub { font-family: var(--dm); font-weight: 200; font-size: 14px; color: var(--ak-2); margin: 0; }

/* ---- Masthead -------------------------------------------------------------- */
.ak-masthead { padding: 60px var(--ak-pad) 28px; max-width: 660px; }
.ak-eyebrow {
    font-family: var(--sg); font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--ak-sage); margin-bottom: 18px;
}
.ak-title {
    font-family: var(--sg); font-weight: 300; font-size: 52px; line-height: 1.05;
    color: var(--ak-text); margin: 0 0 24px;
}
.ak-lede {  /* still used by tag.hbs */
    font-family: var(--dm); font-weight: 200; font-size: 16px; line-height: 1.55;
    color: var(--ak-2); max-width: 500px; margin: 0;
}
/* Tiered masthead copy: secondary → tertiary → footnote */
.ak-secondary {
    font-family: var(--sg); font-weight: 300; font-size: 19px; line-height: 1.4;
    color: var(--ak-text); max-width: 520px; margin: 0 0 22px;
}
.ak-tertiary {
    font-family: var(--dm); font-weight: 300; font-size: 14px; line-height: 1.62;
    color: var(--ak-2); max-width: 560px; margin: 0 0 20px;
}
.ak-note {
    position: relative; padding-left: 20px;
    font-family: var(--dm); font-weight: 200; font-style: italic; font-size: 12.5px; line-height: 1.65;
    color: var(--ak-muted); max-width: 560px; margin: 0;
}
.ak-note-mark {
    position: absolute; left: 0; top: 1px;
    font-family: var(--sg); font-style: normal; font-weight: 400; font-size: 12px;
    letter-spacing: .04em; color: var(--ak-sage);
}

/* ---- Search + chips -------------------------------------------------------- */
.ak-filters { padding: 0 var(--ak-pad) 30px; display: flex; flex-direction: column; gap: 18px; }
.ak-search {
    display: flex; align-items: center; gap: 10px;
    border: 0; border-bottom: 1px solid var(--ak-line-strong);
    max-width: 340px; padding: 0 0 8px; background: transparent; cursor: pointer;
    font-family: var(--dm); font-weight: 300; font-size: 14px; color: var(--ak-muted);
    text-align: left;
}
.ak-search svg { width: 18px; height: 18px; flex: none; stroke: var(--ak-muted); }
.ak-search:hover { color: var(--ak-2); }
.ak-search:hover svg { stroke: var(--ak-2); }
.ak-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.ak-chip {
    border: 1px solid var(--ak-line-strong);
    font-family: var(--dm); cursor: pointer; border-radius: 32px;
    padding: 7px 15px; font-size: 12.5px; font-weight: 300; color: var(--ak-text);
    background: transparent; transition: all .35s var(--ak-ease); white-space: nowrap;
}
.ak-chip:hover { background: rgba(232,234,237,.9); color: var(--ak-bg); }
.ak-chip.on { background: var(--ak-text); color: var(--ak-bg); border-color: var(--ak-text); }

/* ---- Control bar: Labs/Ventures toggle (left) · search + chips (right) ------ */
.ak-controls {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 30px; padding: 12px var(--ak-pad) 34px;
}
.ak-controls-left { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.ak-controls .ak-segbar { padding: 0; }
.ak-seg-desc {
    font-family: var(--dm); font-weight: 200; font-size: 13px; line-height: 1.5;
    color: var(--ak-2); max-width: 300px; margin: 0;
}
.ak-controls-right { display: flex; flex-direction: column; align-items: flex-end; gap: 18px; padding-top: 4px; }
.ak-controls-right .ak-search { max-width: none; }
.ak-controls-right .ak-chips { justify-content: flex-end; }
@media (max-width: 820px) {
    .ak-controls { flex-direction: column; align-items: stretch; gap: 24px; }
    .ak-controls-right { align-items: flex-start; }
    .ak-controls-right .ak-chips { justify-content: flex-start; }
}

/* ==========================================================================
   FEATURED LEDE
   ========================================================================== */
.ak-featured {
    display: grid; grid-template-columns: 300px 1fr;
    margin: 8px var(--ak-pad) 50px;
    border: 1px solid var(--ak-line-hair); border-radius: 5px; overflow: hidden;
    background: rgba(9,13,14,.45);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
/* Format-robust featured image: a consistent landscape crop, centered in the
   column, so portrait / square / wide sources all read cleanly (mostly landscape). */
.ak-featured-img {
    overflow: hidden; border-right: 1px solid var(--ak-line-hair);
    background: var(--ak-surface);
    display: flex; align-items: center; justify-content: center; min-height: 230px;
}
.ak-featured-img img {
    width: 100%; height: 100%; object-fit: cover; object-position: center;
    opacity: .94; display: block;
}
.ak-featured-body { padding: 34px 40px; display: flex; flex-direction: column; justify-content: center; }
.ak-featured-meta { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.ak-featured-meta .ak-tag { color: var(--ak-sage); }
.ak-meta-sub { font-family: var(--dm); font-size: 12px; color: var(--ak-muted); font-weight: 300; }
.ak-featured-title {
    font-family: var(--sg); font-weight: 300; font-size: 32px; line-height: 1.1;
    color: var(--ak-text); margin: 0 0 16px; max-width: 560px;
}
.ak-featured-excerpt {
    font-family: var(--dm); font-weight: 200; font-size: 15px; line-height: 1.6;
    color: var(--ak-2); margin: 0 0 22px; max-width: 560px;
}
.ak-read {
    font-family: var(--sg); font-size: 13px; color: var(--ak-sage);
    display: inline-flex; align-items: center; gap: 6px;
}
.ak-read svg { width: 15px; height: 15px; stroke: var(--ak-sage); transition: transform .2s var(--ak-ease); }
.ak-featured:hover .ak-read svg { transform: translate(2px, -2px); }

/* ==========================================================================
   "MORE FIELD NOTES" ROWS
   ========================================================================== */
.ak-rows-wrap { padding: 0 var(--ak-pad); }
.ak-rows-head {
    font-family: var(--sg); font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--ak-muted); padding-bottom: 14px; border-bottom: 1px solid var(--ak-line);
}
.ak-row {
    display: grid; grid-template-columns: 110px 1fr 150px; gap: 28px; align-items: baseline;
    padding: 26px 0; border-bottom: 1px solid var(--ak-line-soft);
}
.ak-row-date { font-family: var(--dm); font-size: 12px; color: var(--ak-muted); font-weight: 300; }
/* Row body: optional thumbnail (shown only when the post has a feature image) + text */
.ak-row-main { display: flex; gap: 22px; align-items: flex-start; }
.ak-row-thumb {
    flex: none; width: 104px; height: 72px; border-radius: 4px; overflow: hidden;
    border: 1px solid var(--ak-line-hair); background: var(--ak-surface); align-self: center;
}
.ak-row-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; opacity: .94; }
.ak-row-text { min-width: 0; }
.ak-row-h {
    font-family: var(--sg); font-weight: 300; font-size: 21px; line-height: 1.15;
    color: var(--ak-text); margin: 0 0 9px;
}
.ak-row-excerpt { font-family: var(--dm); font-weight: 200; font-size: 13.5px; line-height: 1.55; color: var(--ak-2); margin: 0; }

/* ---- Labs / Ventures segment toggle ---- */
.ak-segbar { padding: 30px var(--ak-pad) 0; }
.ak-segtoggle {
    display: inline-flex; align-items: center; gap: 2px;
    border: 1px solid var(--ak-line-strong); border-radius: 32px; padding: 3px;
}
.ak-seg {
    font-family: var(--sg); font-size: 12.5px; font-weight: 300; letter-spacing: .3px;
    padding: 7px 20px; border-radius: 32px; color: var(--ak-2);
    transition: background-color .25s var(--ak-ease), color .25s var(--ak-ease);
}
.ak-seg:hover { color: var(--ak-text); }
.ak-seg.is-active { background: var(--ak-text); color: var(--ak-bg); }
.ak-row-aside { text-align: right; }
.ak-row-time { font-family: var(--dm); font-size: 11.5px; color: var(--ak-muted); margin-top: 6px; }

/* Pagination (functional addition — mock shows a static slice) */
.ak-pager { display: flex; justify-content: center; padding: 34px 0 6px; }
.ak-pager a { font-family: var(--sg); font-size: 12.5px; }

/* ==========================================================================
   NEWSLETTER
   ========================================================================== */
.ak-newsletter { margin: 52px var(--ak-pad); }
.ak-newsletter-card {
    border: 1px solid var(--ak-line-strong); border-radius: 5px;
    padding: 52px 44px; text-align: center;
    background: rgba(20,25,25,.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.ak-newsletter-eyebrow {
    font-family: var(--sg); font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--ak-sage); margin-bottom: 16px;
}
.ak-newsletter-title {
    font-family: var(--sg); font-weight: 300; font-size: 32px; line-height: 1.1;
    color: var(--ak-text); margin: 0 0 12px;
}
.ak-newsletter-copy {
    font-family: var(--dm); font-weight: 200; font-size: 15px; line-height: 1.55;
    color: var(--ak-2); margin: 0 auto; max-width: 440px;
}
.ak-sub-form { display: flex; gap: 14px; max-width: 440px; margin: 30px auto 0; }
.ak-sub-input {
    flex: 1; background: transparent; border: 0; border-bottom: 1px solid var(--ak-line-35);
    color: var(--ak-text); font-family: var(--dm); font-weight: 300; font-size: 14px;
    padding: 9px 2px; outline: none; text-align: center;
}
.ak-sub-input::placeholder { color: var(--ak-muted); }
.ak-sub-input:focus { border-bottom-color: var(--ak-sage); }
.ak-sub-btn { padding: 9px 24px; font-size: 13px; white-space: nowrap; }
.ak-sub-error { font-family: var(--dm); font-size: 12px; color: #d98b8b; margin: 10px 0 0; min-height: 1em; }
.ak-sub-error:empty { display: none; }

/* ==========================================================================
   FOOTER (non-index pages) — slim, left-justified: logo · socials · Subscribe
   ========================================================================== */
.gh-footer { background: var(--ak-bg); border-top: 1px solid var(--ak-line); }
.ak-footer {
    max-width: var(--ak-max); margin: 0 auto;
    padding: 26px var(--ak-pad);
    display: flex; align-items: center; justify-content: flex-start; gap: 26px;
}
.ak-footer-logo img { height: 26px; width: auto; display: block; opacity: .85; }
.ak-footer-social { display: inline-flex; align-items: center; gap: 16px; }
.ak-footer-social a { color: var(--ak-2); display: inline-flex; transition: color .2s var(--ak-ease); }
.ak-footer-social a:hover { color: var(--ak-text); }
.ak-footer-social svg { width: 17px; height: 17px; fill: currentColor; }
.ak-footer-sub { padding: 8px 18px; font-size: 12.5px; line-height: 20px; }
@media (max-width: 560px) {
    .ak-footer { flex-wrap: wrap; gap: 18px; }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1120px) {
    :root { --ak-pad: 34px; }
    .ak-title { font-size: 44px; }
}
@media (max-width: 820px) {
    :root { --ak-pad: 22px; }
    .ak-title { font-size: 34px; }
    .ak-hero-texture { width: 100%; height: 380px; opacity: .35; }
    .ak-featured { grid-template-columns: 1fr; }
    .ak-featured-img { border-right: 0; border-bottom: 1px solid var(--ak-line-hair); }
    .ak-featured-img img { min-height: 200px; }
    .ak-featured-body { padding: 30px 26px; }
    .ak-featured-title { font-size: 26px; }
    .ak-row { grid-template-columns: 1fr; gap: 8px; }
    .ak-row-aside { text-align: left; display: flex; align-items: baseline; gap: 12px; }
    .ak-row-time { margin-top: 0; }
    .ak-newsletter-title { font-size: 26px; }
    .ak-sub-form { flex-direction: column; }
}

/* ==========================================================================
   SUBSCRIBE MODAL — themed replacement for Ghost Portal's signup dialog
   ========================================================================== */
.ak-modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; transition: opacity .28s var(--ak-ease);
}
.ak-modal[hidden] { display: none; }
.ak-modal.is-open { opacity: 1; }
.ak-modal-overlay {
    position: absolute; inset: 0;
    background: rgba(4,6,7,.72);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ak-modal-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 460px;
    background: #0c1112;
    border: 1px solid var(--ak-line-strong);
    border-radius: 8px;
    padding: 44px 40px 34px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
    transform: translateY(8px) scale(.99);
    transition: transform .28s var(--ak-ease);
}
.ak-modal.is-open .ak-modal-card { transform: none; }
.ak-modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--ak-line); border-radius: 50%;
    color: var(--ak-2); cursor: pointer; transition: border-color .2s var(--ak-ease), color .2s var(--ak-ease);
}
.ak-modal-close svg { width: 15px; height: 15px; }
.ak-modal-close:hover { border-color: var(--ak-sage); color: var(--ak-text); }
.ak-modal-eyebrow {
    font-family: var(--sg); font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--ak-sage); margin-bottom: 14px;
}
.ak-modal-title { font-family: var(--sg); font-weight: 300; font-size: 27px; line-height: 1.12; color: var(--ak-text); margin: 0 0 12px; }
.ak-modal-copy { font-family: var(--dm); font-weight: 200; font-size: 14px; line-height: 1.6; color: var(--ak-2); margin: 0 0 24px; }
.ak-modal-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.ak-modal-input {
    width: 100%; background: rgba(255,255,255,.03);
    border: 1px solid var(--ak-line-strong); border-radius: 5px;
    color: var(--ak-text); font-family: var(--dm); font-weight: 300; font-size: 15px;
    padding: 13px 16px; outline: none; transition: border-color .2s var(--ak-ease);
}
.ak-modal-input::placeholder { color: var(--ak-muted); }
.ak-modal-input:focus { border-color: var(--ak-sage); }
.ak-modal-submit {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 20px; cursor: pointer;
    background: var(--ak-sage); color: #05100b; border: 1px solid var(--ak-sage); border-radius: 5px;
    font-family: var(--sg); font-weight: 500; font-size: 13.5px; letter-spacing: .4px;
    transition: background-color .2s var(--ak-ease), opacity .2s var(--ak-ease);
}
.ak-modal-submit:hover { background: #93bda9; }
.ak-modal-submit-loading { display: none; }
.ak-modal-submit-loading svg { width: 16px; height: 16px; animation: ak-spin .8s linear infinite; }
@keyframes ak-spin { to { transform: rotate(360deg); } }
.ak-modal-form.loading .ak-modal-submit-label { display: none; }
.ak-modal-form.loading .ak-modal-submit-loading { display: inline-flex; }
.ak-modal-form.loading .ak-modal-submit { pointer-events: none; opacity: .85; }
.ak-modal-error { font-family: var(--dm); font-size: 12.5px; color: #e5a3a3; margin: 2px 0 0; }
.ak-modal-error:empty { display: none; }
.ak-modal-fineprint { font-family: var(--dm); font-weight: 300; font-size: 11.5px; color: var(--ak-muted); margin: 16px 0 0; }
/* success swap */
.ak-modal-done { display: none; flex-direction: column; align-items: flex-start; }
.ak-modal-card:has(.ak-modal-form.success) .ak-modal-body { display: none; }
.ak-modal-card:has(.ak-modal-form.success) .ak-modal-done { display: flex; }
.ak-modal-check {
    width: 46px; height: 46px; border-radius: 50%; margin-bottom: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--ak-sage); color: var(--ak-sage);
}
.ak-modal-check svg { width: 22px; height: 22px; }
.ak-modal-doneclose { margin-top: 26px; }
@media (max-width: 520px) {
    .ak-modal-card { padding: 40px 24px 28px; }
    .ak-modal-title { font-size: 23px; }
}

/* Hide Ghost's floating Portal button (Subscribe lives in the topbar + newsletter +
   footer). The trigger renders as an iframe in #ghost-portal-root. */
.gh-portal-triggerbtn-iframe,
iframe[title="portal-trigger"],
#ghost-portal-root iframe[class*="triggerbtn"],
.gh-portal-triggerbtn-wrapper { display: none !important; }
