/* ==========================================================================
   Dawn Thesis — dark three-column sidebar layout
   Loaded after built/screen.css; overrides Dawn's default shell.
   Dark-first palette; html.theme-light switches to light.
   ========================================================================== */

:root {
    --th-bg: #0d0d0f;
    --th-bg-raised: #17171a;
    --th-bg-hover: #1e1e22;
    --th-border: rgba(255, 255, 255, 0.08);
    --th-text: #ececee;
    --th-text-2: #8f8f96;
    --th-pill-bg: #ffffff;
    --th-pill-text: #111113;
    --th-scrim: rgba(0, 0, 0, 0.55);
    --th-grad: linear-gradient(90deg, #a78bfa, #ec4899);
}

html.theme-light {
    --th-bg: #ffffff;
    --th-bg-raised: #f5f5f7;
    --th-bg-hover: #ececef;
    --th-border: rgba(0, 0, 0, 0.09);
    --th-text: #16161a;
    --th-text-2: #6f6f78;
    --th-pill-bg: #111113;
    --th-pill-text: #ffffff;
    --th-scrim: rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: light) {
    html:not(.theme-dark):not(.theme-light) {
        --th-bg: #ffffff;
        --th-bg-raised: #f5f5f7;
        --th-bg-hover: #ececef;
        --th-border: rgba(0, 0, 0, 0.09);
        --th-text: #16161a;
        --th-text-2: #6f6f78;
        --th-pill-bg: #111113;
        --th-pill-text: #ffffff;
        --th-scrim: rgba(0, 0, 0, 0.3);
    }
}

body {
    background-color: var(--th-bg) !important;
    color: var(--th-text);
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.app {
    display: grid;
    grid-template-columns: 280px 400px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--th-border);
    background: var(--th-bg);
    scrollbar-width: thin;
}

.app-list {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--th-border);
    background: var(--th-bg);
    scrollbar-width: thin;
}

.app-main {
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.app-main .site-content {
    flex-grow: 1;
    padding: 0;
}

/* Icon buttons (theme toggle, search) */
.app-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--th-text);
    cursor: pointer;
}

.app-iconbtn:hover {
    background: var(--th-bg-hover);
}

.app-iconbtn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
}

.app-actions {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 50;
    display: flex;
    gap: 4px;
}

html:not(.theme-light) .app-theme-toggle .ico-moon { display: none; }
html:not(.theme-light) .app-theme-toggle .ico-sun { display: block; }
html.theme-light .app-theme-toggle .ico-moon { display: block; }
html.theme-light .app-theme-toggle .ico-sun { display: none; }

/* Footer */
.app-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
    padding: 24px 48px;
    border-top: 1px solid var(--th-border);
    color: var(--th-text-2);
    font-size: 1.3rem;
}

.app-foot a {
    color: var(--th-text-2);
}

.app-foot-menu ul {
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* --------------------------------------------------------------------------
   Mobile topbar + scrim
   -------------------------------------------------------------------------- */

.app-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    grid-column: 1 / -1;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--th-bg);
    border-bottom: 1px solid var(--th-border);
}

.app-burger {
    border: 0;
    background: transparent;
    color: var(--th-text);
    display: inline-flex;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

.app-topbar-title {
    flex-grow: 1;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--th-text);
}

.app-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 95;
    background: var(--th-scrim);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sb {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 20px 16px;
}

.sb-head {
    padding: 4px 12px 18px;
}

.sb-brand {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--th-text);
}

.sb-brand:hover {
    opacity: 1;
}

.sb-logo {
    max-height: 32px;
    width: auto;
}

.sb-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 1.45rem;
    font-weight: 500;
    color: var(--th-text);
    line-height: 1.3;
}

.sb-link:hover {
    background: var(--th-bg-hover);
    opacity: 1;
}

.sb-link.is-active {
    background: var(--th-pill-bg);
    color: var(--th-pill-text);
    font-weight: 600;
}

.sb-ico {
    display: inline-flex;
    width: 16px;
    color: currentColor;
    opacity: 0.85;
}

.sb-label {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-section {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sb-heading {
    margin: 0 12px 8px;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--th-text-2);
}

.sb-tag-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.sb-dot {
    width: 10px;
    height: 10px;
    margin: 0 5px;
    border-radius: 50%;
    background: var(--th-text-2);
}

.sb-ext .sb-arrow {
    opacity: 0.6;
}

.sb-cta {
    margin-top: auto;
    padding-top: 28px;
}

.sb-member-btn {
    display: block;
    padding: 11px 16px;
    text-align: center;
    border: 1px solid var(--th-border);
    border-radius: 12px;
    background: var(--th-bg-raised);
    font-size: 1.45rem;
    font-weight: 700;
}

.sb-member-btn span {
    background: var(--th-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.sb-member-btn:hover {
    border-color: rgba(167, 139, 250, 0.5);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Post list column
   -------------------------------------------------------------------------- */

.pl-head {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 14px;
    background: var(--th-bg);
}

.pl-title {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--th-text);
}

.pl-filter-wrap {
    position: relative;
}

.pl-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--th-border);
    border-radius: 9px;
    font-size: 1.3rem;
    color: var(--th-text);
    background: transparent;
    cursor: pointer;
}

.pl-filter:hover {
    background: var(--th-bg-hover);
}

.pl-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 170px;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--th-border);
    border-radius: 12px;
    background: var(--th-bg-raised);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.pl-menu.is-open {
    display: block;
}

.pl-menu-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--th-text);
    font-size: 1.35rem;
    text-align: left;
    cursor: pointer;
}

.pl-menu-item:hover {
    background: var(--th-bg-hover);
}

.pl-menu-item.is-selected {
    background: var(--th-pill-bg);
    color: var(--th-pill-text);
    font-weight: 600;
}

.pl-empty {
    padding: 24px 12px;
    color: var(--th-text-2);
    font-size: 1.35rem;
}

.pl-items {
    padding: 0 12px 24px;
}

.pl-item {
    position: relative;
    padding: 16px 12px;
    border-radius: 12px;
}

.pl-item + .pl-item {
    margin-top: 2px;
}

.pl-item:hover {
    background: var(--th-bg-hover);
}

.pl-tagline,
.card-tagline {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    color: var(--th-text);
}

.pl-badge {
    flex-shrink: 0;
    opacity: 0.9;
}

.pl-tag,
.card-tag {
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--th-text-2);
}

.pl-item-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--th-text);
}

.pl-meta,
.card-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    font-size: 1.25rem;
    color: var(--th-text-2);
}

.pl-sep {
    opacity: 0.6;
}

/* --------------------------------------------------------------------------
   Home: hero
   -------------------------------------------------------------------------- */

.home-main {
    padding: 72px 48px 64px;
    display: flex;
    flex-direction: column;
    gap: 64px;
    max-width: 1240px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 48px;
    align-items: center;
}

.hero-title {
    margin: 0 0 20px;
    font-size: clamp(3.2rem, 4vw, 4.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--th-text);
}

.hero-text {
    margin: 0 0 28px;
    max-width: 52ch;
    font-size: 1.75rem;
    line-height: 1.6;
    color: var(--th-text-2);
}

.hero-btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 12px;
    background: var(--th-pill-bg);
    color: var(--th-pill-text);
    font-size: 1.5rem;
    font-weight: 700;
}

.hero-btn:hover {
    opacity: 0.9;
}

.hero-socials {
    display: flex;
    gap: 18px;
    margin-top: 26px;
}

.hero-socials a {
    color: var(--th-text);
    opacity: 0.9;
}

.hero-socials svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.hero-art {
    position: relative;
    min-height: 320px;
}

.hero-img {
    position: absolute;
    width: 62%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.hero-img-a {
    left: 0;
    top: 8%;
    transform: rotate(-7deg);
    z-index: 1;
}

.hero-img-b {
    right: 0;
    top: 0;
    transform: rotate(6deg);
    z-index: 2;
}

.hero-img-solo {
    position: relative;
    width: 84%;
    margin-left: auto;
    transform: rotate(-4deg);
}

/* --------------------------------------------------------------------------
   Home: tag cards
   -------------------------------------------------------------------------- */

.tag-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.tag-card {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    overflow: hidden;
    isolation: isolate;
}

.tag-card:hover {
    opacity: 1;
}

.tag-card:hover .tag-card-img {
    transform: scale(1.04);
}

.tag-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s var(--animation-base, ease-in-out);
}

.tag-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.45));
    z-index: 1;
}

.tag-card-name {
    position: absolute;
    left: 16px;
    bottom: 12px;
    z-index: 2;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Home: sections, featured, paid
   -------------------------------------------------------------------------- */

.home-section-title {
    margin: 0 0 24px;
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--th-text);
}

.feat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.feat-hero {
    position: relative;
    grid-column: 1 / -1;
    min-height: 380px;
    border-radius: 14px;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    align-items: flex-end;
}

.feat-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feat-hero-overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 28px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
    color: #fff;
}

.feat-hero-overlay .card-tagline,
.feat-hero-overlay .card-meta {
    color: rgba(255, 255, 255, 0.92);
}

.feat-hero-title {
    margin: 0;
    font-size: clamp(2rem, 2.6vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.015em;
    color: #fff;
}

.feat-card {
    position: relative;
    padding: 20px;
    border: 1px solid var(--th-border);
    border-radius: 14px;
    background: var(--th-bg);
}

.feat-card:hover {
    background: var(--th-bg-hover);
}

.feat-card-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--th-text);
}

.paid-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* --------------------------------------------------------------------------
   Inner pages (post / page / tag / author) inside the main pane
   -------------------------------------------------------------------------- */

.app-main .site-main:not(.home-main) {
    padding: 72px 0 64px;
}

/* Dawn's light-first component surfaces → follow theme variables */
.app-main .gh-content,
.app-main .site-main {
    color: var(--th-text);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1360px) {
    .app {
        grid-template-columns: 260px 340px minmax(0, 1fr);
    }
}

@media (max-width: 1160px) {
    .app {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .app-list {
        display: none;
    }
}

@media (max-width: 860px) {
    .app {
        display: block;
    }

    .app-topbar {
        display: flex;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        width: 290px;
        max-width: 86vw;
        transform: translateX(-100%);
        transition: transform 0.25s var(--animation-base, ease-in-out);
        border-right: 1px solid var(--th-border);
    }

    .app.is-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app.is-sidebar-open .app-scrim {
        display: block;
    }

    .app-actions {
        display: none;
    }

    .home-main {
        padding: 40px 20px 48px;
        gap: 44px;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .hero-art {
        min-height: 260px;
        order: -1;
    }

    .tag-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .feat-grid,
    .paid-grid {
        grid-template-columns: 1fr;
    }

    .feat-hero {
        min-height: 280px;
    }

    .app-foot {
        padding: 20px;
    }

    .app-main .site-main:not(.home-main) {
        padding: 40px 0 48px;
    }
}
