/* ============================================
   Public home page (Default.aspx)
   Front page free, rest of the edition behind
   a subscription. Builds on the tokens in site.css.
   ============================================ */

:root {
    --ink: #111418;
    --paper: #FBFAF7;
    --rule: #D9D4CA;
    --serif: 'Noto Serif', 'Noto Serif Devanagari', Georgia, 'Times New Roman', serif;
    --lock: #B45309;
}

[hidden] { display: none !important; }

body.home {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', var(--font);
}

.home a { color: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------- buttons ---------- */
.hbtn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 2px; height: 38px; padding: 0 16px;
    border-radius: 999px; border: 1px solid transparent;
    font: 600 0.88rem/1 'Inter', var(--font);
    text-decoration: none !important; cursor: pointer; white-space: nowrap;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform .08s;
}
.hbtn:active { transform: translateY(1px); }
.hbtn:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
.hbtn-solid { background: var(--accent); color: #fff !important; }
.hbtn-solid:hover { background: var(--accent-dark); }
.hbtn-ghost { background: #fff; border-color: var(--rule); color: var(--ink) !important; }
.hbtn-ghost:hover { border-color: var(--ink); }
.hbtn-link { background: none; color: var(--text-muted) !important; padding: 0 8px; }
.hbtn-link:hover { color: var(--ink) !important; }
.hbtn-block { display: flex; width: 100%; margin-top: 10px; height: 44px; }
.hbadge {
    display: inline-flex; align-items: center; height: 30px; padding: 0 12px;
    border-radius: 999px; background: #ECFDF3; color: var(--success);
    font-size: 0.8rem; font-weight: 600;
}

/* ---------- masthead ---------- */
.mast { background: #fff; border-bottom: 1px solid var(--rule); }
.mast-top { border-bottom: 1px solid var(--rule); font-size: 0.82rem; color: var(--text-muted); }
.mast-top-in { display: flex; align-items: center; justify-content: space-between; min-height: 52px; gap: 12px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.mast-auth { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mast-auth .hbtn { height: 34px; padding: 0 14px; font-size: 0.82rem; }

.mast-brand { text-align: center; padding-top: 22px; padding-bottom: 16px; }
.brand { display: inline-flex; align-items: center; gap: 14px; text-decoration: none !important; }
.brand-logo { height: clamp(40px, 7vw, 64px); width: auto; }
.brand-name {
    font-family: var(--serif); font-weight: 800; letter-spacing: -0.01em;
    font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1.05; color: var(--ink);
}
.brand-sub {
    margin-top: 8px; font-size: 0.72rem; letter-spacing: 0.32em;
    text-transform: uppercase; color: var(--text-muted);
}

.mast-bar { border-top: 3px double var(--ink); }
.mast-bar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.edition-line { font-size: 0.9rem; color: #3A3F45; }
.edition-line strong { color: var(--ink); }
.edition-line .dot { margin: 0 6px; color: var(--rule); }

.archive-pick {
    position: relative; display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 6px 0 14px; margin: 0;
    border: 1px solid var(--rule); border-radius: 999px; background: #fff;
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.archive-pick input {
    border: 0; background: transparent; font: inherit; font-weight: 500;
    color: var(--text-muted); height: 32px; padding: 0 6px; cursor: pointer;
}
.archive-pick input:focus { outline: none; }
.archive-pick:focus-within { border-color: var(--accent); }

.chips { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding-bottom: 12px; scrollbar-width: thin; }
.chips-label { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.chip {
    white-space: nowrap; padding: 6px 14px; border-radius: 999px;
    border: 1px solid var(--rule); background: #fff; font-size: 0.82rem; text-decoration: none !important;
}
.chip:hover { border-color: var(--ink); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff !important; }

/* ---------- notices ---------- */
.notice {
    margin-top: 16px; padding: 10px 14px; border-radius: var(--radius-sm);
    background: #FFF7ED; color: #9A3412; font-size: 0.88rem; border: 1px solid #FED7AA;
}
.ribbon {
    margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 18px; border-radius: var(--radius);
    background: var(--ink); color: #E8E6E1; font-size: 0.92rem;
}
.ribbon strong { color: #fff; }
.ribbon .hbtn { flex-shrink: 0; }

/* ---------- layout ---------- */
.home-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px; align-items: start; padding-top: 22px; padding-bottom: 40px;
}

/* ---------- front page ---------- */
.front-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.kicker {
    font-family: var(--serif); font-weight: 700; font-size: 1.25rem; margin-right: 10px;
}
.front-meta { font-size: 0.82rem; color: var(--text-muted); }
.front-actions { display: flex; gap: 8px; }

.front-frame {
    position: relative; background: #fff; border: 1px solid var(--rule);
    box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 18px 40px -18px rgba(17,20,24,.25);
    max-width: 880px; margin: 0 auto;
}
.front-frame img { display: block; width: 100%; height: auto; }
.front-frame.is-locked img { filter: blur(6px); transform: scale(1.01); }
.hotspots { position: absolute; inset: 0; }
.hot {
    position: absolute; display: block; padding: 0; margin: 0; cursor: zoom-in;
    background: transparent; border: 2px solid transparent; border-radius: 3px;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.hot:hover, .hot:focus-visible {
    background: rgba(37,99,235,.10); border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37,99,235,.12); outline: none;
}
.hotspots.is-hinting .hot { border-color: rgba(37,99,235,.55); background: rgba(37,99,235,.06); }
.front-hint { text-align: center; margin: 12px 0 0; font-size: 0.85rem; color: var(--text-muted); }

.lock-cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(251,250,247,.55); }
.lock-box { background: #fff; border-radius: var(--radius); padding: 26px 28px; text-align: center; box-shadow: var(--shadow-lg); max-width: 320px; }
.lock-box .fa-lock { font-size: 34px; color: var(--lock); }
.lock-box h3 { font-family: var(--serif); font-size: 1.15rem; margin: 10px 0 14px; }

/* ---------- sidebar ---------- */
.side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px; }
.side-card { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.side-head h3 { font-family: var(--serif); font-size: 1.05rem; margin: 0; }
.side-head span { font-size: 0.8rem; color: var(--text-muted); }

.pages {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    max-height: 430px; overflow-y: auto; padding: 2px; scrollbar-width: thin;
}
.pg { display: block; text-decoration: none !important; text-align: center; }
.pg-img {
    position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden;
    border: 1px solid var(--rule); border-radius: 4px; background: #F1EFEA;
    transition: border-color .15s, transform .15s;
}
.pg-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pg:hover .pg-img { border-color: var(--ink); transform: translateY(-1px); }
.pg.is-current .pg-img { border: 2px solid var(--accent); }
.pg.is-locked .pg-img img { opacity: .55; filter: grayscale(.4); }
.pg-lock {
    position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--ink); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.pg-free {
    position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 999px;
    background: var(--success); color: #fff; font-size: 0.65rem; font-weight: 700; letter-spacing: .03em;
}
.pg-num { display: block; margin-top: 5px; font-size: 0.74rem; color: var(--text-muted); }

.recent { display: flex; flex-direction: column; }
.recent-item { display: flex; gap: 12px; align-items: center; padding: 8px; margin: 0 -8px; border-radius: var(--radius-sm); text-decoration: none !important; }
.recent-item:hover { background: var(--surface-alt); }
.recent-item.is-on { background: var(--accent-light); }
.recent-thumb { width: 42px; height: 56px; flex-shrink: 0; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; background: #F1EFEA; }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.recent-text { display: flex; flex-direction: column; min-width: 0; font-size: 0.82rem; }
.recent-text strong { font-size: 0.88rem; }
.recent-text span { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- empty ---------- */
.empty { padding: 60px 20px; }
.empty-card { max-width: 460px; margin: 0 auto; text-align: center; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 40px 28px; }
.empty-card .fa { font-size: 46px; color: var(--text-muted); }
.empty-card h2 { font-family: var(--serif); margin: 14px 0 8px; font-size: 1.5rem; }
.empty-card p { color: var(--text-muted); margin: 0; }

/* ---------- footer ---------- */
.foot { border-top: 3px double var(--ink); background: #fff; margin-top: 20px; }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 14px; }
.foot-name { font-family: var(--serif); font-weight: 800; font-size: 1.2rem; }
.foot-line { font-size: 0.84rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; }
.foot-social { display: flex; gap: 8px; }
.foot-social a {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule);
    display: flex; align-items: center; justify-content: center; text-decoration: none !important;
}
.foot-social a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.foot-copy { font-size: 0.78rem; color: var(--text-muted); padding-bottom: 22px; }

/* ---------- modals ---------- */
.modal-x {
    position: fixed; inset: 0; z-index: 3000; background: rgba(17,20,24,.62);
    display: flex; align-items: center; justify-content: center; padding: 16px;
    animation: fadeIn .15s ease;
}
.modal-x-box {
    position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
    background: #fff; border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-lg);
    animation: popIn .18s ease;
}
.modal-x-wide { max-width: 760px; padding: 0; }
.modal-x-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-x-head h3 { font-family: var(--serif); font-size: 1.1rem; margin: 0; }
.modal-x-body { padding: 16px 20px; }
.modal-x-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px 18px; flex-wrap: wrap; }
.modal-x-foot .hbtn { margin-left: auto; }
.modal-x-close {
    width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-alt);
    font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); flex-shrink: 0;
}
.modal-x-close:hover { background: var(--border); }
.modal-x-close.floating { position: absolute; top: 12px; right: 12px; }

.article-img-wrap { background: #F1EFEA; border-radius: var(--radius-sm); min-height: 120px; display: flex; align-items: center; justify-content: center; }
.article-img-wrap img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
.article-img-wrap.is-loading::after { content: 'Loading story…'; color: var(--text-muted); font-size: 0.85rem; padding: 40px; }
.article-img-wrap.is-loading img { display: none; }
.article-desc { margin: 12px 0 0; color: #3A3F45; }
.article-desc:empty { display: none; }

.share {
    width: 38px; height: 38px; border-radius: 50%; border: 0; color: #fff !important; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none !important; font-size: 16px;
}
.share.wa { background: #25D366; }
.share.fb { background: #1877F2; }
.share.tw { background: #111; }
.share.cp { background: var(--text-muted); }

.access-guest, .access-member { text-align: center; }
.access-icon {
    width: 58px; height: 58px; border-radius: 50%; margin: 4px auto 12px;
    background: var(--accent-light); color: var(--accent); font-size: 24px;
    display: flex; align-items: center; justify-content: center;
}
.access-guest h3, .access-member h3 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 6px; }
.access-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 8px; }
.access-note { color: var(--text-muted); font-size: 0.8rem; margin: 14px 0 0; }

.plans { display: grid; gap: 10px; margin-top: 14px; text-align: left; }
.plan {
    position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name price" "period cta";
    gap: 2px 10px; padding: 14px 16px; border: 1.5px solid var(--rule); border-radius: var(--radius);
    text-decoration: none !important; transition: border-color .15s, box-shadow .15s;
}
.plan:hover { border-color: var(--accent); box-shadow: 0 6px 18px -8px rgba(37,99,235,.35); }
.plan.is-best { border-color: var(--accent); }
.plan-tag {
    position: absolute; top: -10px; left: 14px; padding: 2px 10px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 700;
}
.plan-name { grid-area: name; font-weight: 700; }
.plan-price { grid-area: price; font-family: var(--serif); font-weight: 800; font-size: 1.25rem; text-align: right; }
.plan-period { grid-area: period; font-size: 0.8rem; color: var(--text-muted); }
.plan-cta { grid-area: cta; font-size: 0.82rem; font-weight: 600; color: var(--accent); text-align: right; }

/* ---------- zoom ---------- */
.zoom-x { position: fixed; inset: 0; z-index: 3100; background: #1A1D21; display: flex; flex-direction: column; }
.zoom-x-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: #fff; font-weight: 600; }
.zoom-x-bar > div { display: flex; gap: 6px; }
.zbtn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.zbtn:hover { background: rgba(255,255,255,.22); }
.zoom-x-stage { flex: 1; overflow: auto; text-align: center; -webkit-overflow-scrolling: touch; }
.zoom-x-stage img { display: inline-block; max-width: none; background: #fff; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
    .home-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; }
}

@media (max-width: 860px) {
    /* One column. The sidebar cards join the grid directly so the page
       strip sits above the front page and recent editions go below it. */
    .home-grid { grid-template-columns: minmax(0, 1fr); }
    .side { display: contents; }
    .side > .side-card:first-child { order: -1; }
    .side > .side-card:last-child { order: 1; }
    .pages {
        display: flex; overflow-x: auto; overflow-y: hidden; max-height: none;
        gap: 10px; padding-bottom: 6px; scroll-snap-type: x proximity;
    }
    .pg { flex: 0 0 86px; scroll-snap-align: start; }
}

@media (max-width: 600px) {
    .wrap { padding: 0 14px; }
    .mast-date { display: none; }
    .mast-top-in { justify-content: flex-end; }
    .mast-bar-in { flex-direction: column; align-items: flex-start; }
    .archive-pick { width: 100%; justify-content: space-between; }
    .ribbon { flex-direction: column; align-items: stretch; text-align: center; }
    .hide-sm { display: none; }
    .modal-x { align-items: flex-end; padding: 0; }
    .modal-x-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
}
