
:root {
    --bg: #F7F9F7;
    --panel: #FFFFFF;
    --text: #1B4079;
    --muted: #66756F;
    --border: #D7DEDA;
    --accent: #1B4079;
    --accent-dark: #14315E;
    --accent-secondary: #4D7C8A;
    --fandom: #7F9C96;
    --tag: #8FAD88;
    --highlight: #CBDF90;
    --pill: #E7EEEA;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-dark);
}

.site-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-logo {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: .06em;
}

.site-nav {
    display: flex;
    gap: 16px;
}

.site-nav a {
    text-decoration: none;
    font-weight: 600;
}

main.site-shell {
    padding: 28px 0 56px;
}

.page-intro {
    margin-bottom: 22px;
}

.page-intro h1,
.work-header h1,
.chapter-header h1 {
    margin-top: 0;
}

.work-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.work-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 24px;
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.work-card h2 {
    margin: 0 0 10px;
}

.work-card h2 a {
    text-decoration: none;
}

.work-summary {
    margin: 14px 0;
    color: #3e3e3e;
}

.work-summary-large {
    max-width: 820px;
    font-size: 1.05rem;
}

.pill-row,
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.meta-pill,
.tag-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .82rem;
}

.meta-pill {
    background: var(--pill);
    font-weight: 700;
}

.tag-pill {
    background: var(--tag);
    border: 1px solid #e5d9cf;
}

.work-stats,
.metadata-grid {
    margin: 0;
}

.work-stats > div,
.metadata-grid > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 0;
}

.work-stats dt,
.metadata-grid dt {
    color: var(--muted);
}

.work-stats dd,
.metadata-grid dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
}

.work-header {
    margin-bottom: 22px;
}

.metadata-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.metadata-grid > div {
    display: block;
}

.metadata-grid dd {
    margin-top: 2px;
    text-align: left;
}

.meta-group {
    margin-top: 18px;
}

.meta-group > strong {
    display: block;
    margin-bottom: 7px;
}

.chapter-list-section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.chapter-list-section h2 {
    margin-top: 0;
}

.chapter-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.chapter-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-bottom: 1px solid #ece9e5;
}

.chapter-list li:last-child {
    border-bottom: 0;
}

.chapter-list a {
    text-decoration: none;
    font-weight: 700;
}

.chapter-number {
    color: var(--muted);
    margin-right: 4px;
}

.chapter-meta,
.chapter-submeta,
.eyebrow {
    color: var(--muted);
    font-size: .9rem;
}

.chapter-page {
    max-width: 860px;
    margin: 0 auto;
}

.chapter-header {
    margin: 32px 0;
    text-align: center;
}

.eyebrow {
    margin-bottom: 8px;
}

.chapter-content {
    /* Match the typography used by the Notes boxes. */
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 34px 42px;
}

/* Imported chapter HTML may contain inline font sizes/families.
   Override them for normal prose without removing emphasis or headings. */
.chapter-content p,
.chapter-content p span,
.chapter-content p font,
.chapter-content p strong,
.chapter-content p em,
.chapter-content p b,
.chapter-content p i,
.chapter-content p a,
.chapter-content div,
.chapter-content div span,
.chapter-content div font {
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 1rem !important;
}

.chapter-content p {
    margin: 0 0 1em;
}

.chapter-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.4em auto;
}

.chapter-content blockquote {
    margin: 1.3em 2em;
    padding-left: 1em;
    border-left: 3px solid #b8b1aa;
}

.chapter-note {
    margin: 20px 0;
    padding: 16px 18px;
    background: #fffaf3;
    border: 1px solid #e8dac9;
    border-radius: 8px;
}

.chapter-note p {
    margin-bottom: 0;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.chapter-nav a {
    text-decoration: none;
    font-weight: 700;
}

.chapter-nav-pager {
    display: flex;
    gap: 16px;
}

.chapter-nav-bottom {
    margin-top: 24px;
}

.site-footer {
    padding: 24px 0 36px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.empty-state,
.placeholder-page {
    padding: 30px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

@media (max-width: 800px) {
    .work-card {
        grid-template-columns: 1fr;
    }

    .metadata-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chapter-content {
        padding: 24px 20px;
    }

    .chapter-list li {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 520px) {
    .header-inner,
    .chapter-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .metadata-grid {
        grid-template-columns: 1fr;
    }
}


/* Archive Of MY Own header logo */
.site-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    display: block;
    width: 210px;
    max-height: 54px;
    object-fit: contain;
    object-position: left center;
}

.header-inner {
    min-height: 72px;
}

.work-card {
    align-items: start;
}

.work-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.work-stat-pill {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 9px 10px;
    border-radius: 9px;
    background: #eeeeee;
    color: #2e2e2e;
}

.work-stat-label {
    color: #737373;
    font-size: .72rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.work-stat-pill strong {
    font-size: .9rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.work-stat-pill:last-child {
    grid-column: 1 / -1;
}

@media (max-width: 800px) {
    .site-logo img {
        width: 180px;
        max-height: 48px;
    }

    .work-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .work-stat-pill:last-child {
        grid-column: auto;
    }
}

@media (max-width: 560px) {
    .work-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-stat-pill:last-child {
        grid-column: 1 / -1;
    }

    .site-logo img {
        width: 155px;
    }
}


/* Tags are deliberately squarer than fandom pills */
.tag-pill {
    border-radius: 6px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination-pages {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.pagination-link:hover {
    background: #ece9e5;
    color: var(--text);
}

.pagination-link.is-current {
    background: #dedbd6;
    border-color: #c9c5bf;
    cursor: default;
}


/* Archive Of MY Own palette */
.site-header {
    background: #1B4079;
    border-bottom-color: #14315E;
}

.site-nav a {
    color: #FFFFFF;
}

.site-nav a:hover {
    color: #CBDF90;
}

.site-logo img {
    filter: none;
}

.work-card h2 a,
.chapter-list a,
.chapter-nav a {
    color: #1B4079;
}

.meta-pill {
    background: #7F9C96;
    color: #102D2D;
}

.tag-pill {
    background: #8FAD88;
    border-color: #7E9E79;
    color: #17351A;
}

.work-stat-pill {
    background: #EEF2F0;
    color: #1B4079;
}

.work-stat-label {
    color: #64736D;
}

.pagination-link.is-current {
    background: #1B4079;
    border-color: #1B4079;
    color: #FFFFFF;
}

.pagination-link:hover {
    background: #CBDF90;
    border-color: #B4C77F;
    color: #1B4079;
}

.chapter-note {
    background: #F2F6EC;
    border-color: #D8E2BE;
}


/* Wide header logo */
.site-logo img {
    width: 360px;
    max-width: 42vw;
    max-height: 66px;
    object-fit: contain;
    object-position: left center;
}

.header-inner {
    min-height: 82px;
}

/* Chapter-count pill on homepage */
.work-stat-pill {
    text-decoration: none;
}

.work-stat-pill-chapters {
    background: var(--tag);
    border: 1px solid #7E9E79;
    color: #17351A;
    cursor: pointer;
}

.work-stat-pill-chapters .work-stat-label {
    color: #38583C;
}

.work-stat-pill-chapters:hover {
    background: #9DB995;
    color: #17351A;
}

/* Work detail taxonomy */
.work-taxonomy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.work-taxonomy-column {
    min-width: 0;
}

.work-taxonomy-column > strong {
    display: block;
    margin-bottom: 8px;
}

.character-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--highlight);
    border: 1px solid #B7CA7D;
    color: #24351C;
    font-size: .82rem;
}

/* Chapter top navigation: one tag-colored pill */
.chapter-nav-top {
    justify-content: center;
}

.chapter-nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    border: 1px solid #7E9E79;
    border-radius: 999px;
    background: var(--tag);
}

.chapter-nav-pill a,
.chapter-nav-pill span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 16px;
    color: #17351A;
    text-decoration: none;
    font-weight: 700;
    border-right: 1px solid rgba(23,53,26,.18);
}

.chapter-nav-pill a:last-child,
.chapter-nav-pill span:last-child {
    border-right: 0;
}

.chapter-nav-pill a:hover {
    background: rgba(255,255,255,.22);
}

.chapter-nav-pill .is-disabled {
    opacity: .42;
}

@media (max-width: 760px) {
    .site-logo img {
        width: 270px;
        max-width: 60vw;
    }

    .work-taxonomy-grid {
        grid-template-columns: 1fr;
    }

    .chapter-nav-pill {
        width: 100%;
    }

    .chapter-nav-pill a,
    .chapter-nav-pill span {
        flex: 1 1 0;
        padding: 8px 10px;
        font-size: .9rem;
    }
}


/* ============================================================
   Header as full-width background artwork
   ============================================================ */

.site-header {
    position: relative;
    min-height: 104px;
    overflow: hidden;
    background: #1B4079;
    border-bottom: 1px solid #14315E;
}

.site-header-art {
    position: absolute;
    inset: 0;
    background-image: url("../img/archive-of-my-own-logo-wide.png");
    background-repeat: no-repeat;
    background-position: left center;
    background-size: cover;
    pointer-events: none;
}

.header-inner {
    position: relative;
    z-index: 2;
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.site-logo-hit {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(72%, 920px);
    display: block;
}

.site-nav {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.auth-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 999px;
    background: rgba(27,64,121,.78);
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    backdrop-filter: blur(4px);
}

.auth-pill:hover {
    background: rgba(77,124,138,.92);
    color: #fff !important;
}

.auth-pill-register {
    background: rgba(143,173,136,.92);
    border-color: rgba(255,255,255,.72);
    color: #17351A !important;
}

.auth-pill-register:hover {
    background: rgba(203,223,144,.96);
    color: #17351A !important;
}

/* ============================================================
   Latest chapter CTA
   ============================================================ */

.latest-chapter-cta {
    margin: 0 0 20px;
}

.latest-chapter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 18px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: .04em;
}

.latest-chapter-button:hover {
    background: var(--accent-dark);
    color: #fff;
}

/* ============================================================
   Chapter nav color split
   ============================================================ */

.chapter-nav-pill .chapter-nav-index {
    background: var(--accent-secondary);
    color: #fff;
}

.chapter-nav-pill .chapter-nav-index:hover {
    background: #416C77;
    color: #fff;
}

@media (max-width: 760px) {
    .site-header,
    .header-inner {
        min-height: 88px;
    }

    .site-header-art {
        background-position: 25% center;
        background-size: cover;
    }

    .site-logo-hit {
        width: 62%;
    }

    .auth-pill {
        min-height: 34px;
        padding: 6px 10px;
        font-size: .9rem;
    }
}


/* Square work thumbnails on homepage */
.work-card-layout {
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: start;
}

.work-cover {
    width: 150px;
    height: 150px;
    max-width: 150px;
    max-height: 150px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    flex: 0 0 150px;
}

.work-cover img {
    width: 150px;
    height: 150px;
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
}

@media (max-width: 800px) {
    .work-card-layout {
        grid-template-columns: 120px minmax(0, 1fr);
    }

    .work-cover,
    .work-cover img {
        width: 120px;
        height: 120px;
        max-width: 120px;
        max-height: 120px;
    }
}

@media (max-width: 560px) {
    .work-card-layout {
        grid-template-columns: 1fr;
    }

    .work-cover,
    .work-cover img {
        width: 150px;
        height: 150px;
        max-width: 150px;
        max-height: 150px;
    }
}


/* ============================================================
   Homepage work card: three-column compact layout
   ============================================================ */

.work-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 385px;
    gap: 26px;
    align-items: start;
}

.work-card-layout {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.work-cover {
    width: 150px;
    height: 150px;
    max-width: 150px;
    max-height: 150px;
    aspect-ratio: 1 / 1;
    margin: 0;
    align-self: start;
}

.work-cover img {
    width: 150px;
    height: 150px;
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
}

.work-card-copy {
    min-width: 0;
}

.work-card-copy h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.work-card-copy .work-summary {
    margin: 14px 0;
}

.work-stat-grid {
    align-self: start;
    width: 100%;
    min-width: 0;
}

/* Keep the statistic grid at the far right */
.work-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* On medium screens keep image next to text, move stats below */
@media (max-width: 1050px) {
    .work-card {
        grid-template-columns: 1fr;
    }

    .work-stat-grid {
        max-width: 520px;
    }
}

@media (max-width: 680px) {
    .work-card-layout {
        grid-template-columns: 110px minmax(0, 1fr);
        gap: 14px;
    }

    .work-cover,
    .work-cover img {
        width: 110px;
        height: 110px;
        max-width: 110px;
        max-height: 110px;
    }
}

@media (max-width: 480px) {
    .work-card-layout {
        grid-template-columns: 1fr;
    }

    .work-cover,
    .work-cover img {
        width: 150px;
        height: 150px;
        max-width: 150px;
        max-height: 150px;
    }
}


/* Work page header: 200x200 thumbnail + title/fandoms/full summary */
.work-detail-heading {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.work-detail-cover {
    width: 200px;
    height: 200px;
    max-width: 200px;
    max-height: 200px;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--pill);
    border: 1px solid var(--border);
}

.work-detail-cover img {
    width: 200px;
    height: 200px;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
}

.work-detail-cover.is-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-secondary);
    font-size: 2rem;
}

.work-detail-copy {
    min-width: 0;
}

.work-detail-copy h1 {
    margin-top: 0;
    margin-bottom: 10px;
}

.work-detail-copy .work-summary-large {
    max-width: none;
    margin-top: 16px;
}

@media (max-width: 700px) {
    .work-detail-heading {
        grid-template-columns: 140px minmax(0, 1fr);
        gap: 16px;
    }

    .work-detail-cover,
    .work-detail-cover img {
        width: 140px;
        height: 140px;
        max-width: 140px;
        max-height: 140px;
    }
}

@media (max-width: 480px) {
    .work-detail-heading {
        grid-template-columns: 1fr;
    }

    .work-detail-cover,
    .work-detail-cover img {
        width: 200px;
        height: 200px;
        max-width: 200px;
        max-height: 200px;
    }
}


/* ============================================================
   Public account / registration
   ============================================================ */

.account-page {
    display: flex;
    justify-content: center;
    padding: 24px 0 40px;
}

.account-card {
    width: min(560px, 100%);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
}

.account-heading h1,
.registration-success h1 {
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--accent);
}

.account-heading p {
    margin-top: 0;
    color: var(--muted);
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 22px;
}

.account-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 700;
    color: var(--accent);
}

.account-form input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.account-form input:focus {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 1px;
}

.account-help {
    font-size: .8rem;
    font-weight: 400;
    color: var(--muted);
}

.account-primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.account-primary-button:hover {
    background: var(--accent-dark);
    color: #fff;
}

.account-errors {
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid #c88686;
    border-radius: 8px;
    background: #fff0f0;
    color: #7a2020;
}

.account-errors ul {
    margin-bottom: 0;
}

.registration-success {
    text-align: center;
}

.registration-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: var(--tag);
    color: #17351A;
    font-size: 1.5rem;
    font-weight: 900;
}

.registration-success .account-primary-button {
    margin-top: 14px;
}

.account-footer-note {
    margin-top: 20px;
    text-align: center;
    color: var(--muted);
}


.auth-pill-user {
    background: rgba(127,156,150,.92);
    border-color: rgba(255,255,255,.65);
    color: #102D2D !important;
    cursor: default;
}
