/* Design thesis and token rules: see DESIGN.md ("a tidy shelf with loud spines"). */

@font-face {
    font-family: "Bricolage Grotesque";
    src: url("../fonts/bricolage-grotesque-latin-wght.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;

    /* Shelf: the calm surfaces */
    --paper: #f5efe3;
    --surface: #fffdf7;
    --ink: #17140f;
    --muted: #635c4e;
    --dot: rgba(23, 20, 15, 0.13);

    /* Spines: the loud parts. Text on any of these is always --on-color. */
    --pop: #ff5a36;
    --sun: #ffc83d;
    --mint: #45d19b;
    --sky: #7fa8ff;
    --on-color: #17140f;

    --star: #c2410c;
    --danger: #b92d1b;

    /* One border weight, one radius, one shadow recipe */
    --line: 2px solid var(--ink);
    --radius: 10px;
    --shadow-sm: 3px 3px 0 var(--ink);
    --shadow: 5px 5px 0 var(--ink);
    --shadow-pop: 8px 8px 0 var(--pop);

    --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #15130f;
        --surface: #221f18;
        --ink: #f4eee1;
        --muted: #a9a292;
        --dot: rgba(244, 238, 225, 0.1);
        --star: #ff5a36;
        --danger: #ff8a75;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--paper);
    background-image: radial-gradient(var(--dot) 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--ink);
    line-height: 1.5;
}

h1,
h2 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

a {
    color: inherit;
    text-decoration-color: var(--pop);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a:hover {
    background: var(--sun);
    color: var(--on-color);
}

:focus-visible {
    outline: 3px solid var(--sky);
    outline-offset: 2px;
}

button {
    font: inherit;
    cursor: pointer;
}

input,
select,
textarea {
    background: var(--surface);
    color: var(--ink);
    border: var(--line);
    border-radius: var(--radius);
    font: inherit;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
}

label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Buttons: every button is a pressable object */

.btn,
.auth-card button[type="submit"],
.toolbar button,
.dialog-actions button,
.item-actions button {
    border: var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.btn:active,
.auth-card button[type="submit"]:active,
.toolbar button:active,
.dialog-actions button:active,
.item-actions button:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

/* One primary action per screen gets the pop colour */
.btn-primary,
.btn-primary:hover,
.auth-card button[type="submit"],
.toolbar button,
#item-save-btn {
    background: var(--pop);
    color: var(--on-color);
}

/* Link styled as a button */
.btn {
    display: inline-block;
    padding: 10px 16px;
    text-decoration: none;
}

.btn:not(.btn-primary):hover {
    background: var(--surface);
    color: var(--ink);
}

/* Visibility badges: only public is filled, because only public exposes content */

.visibility-badge {
    display: inline-block;
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.visibility-badge[data-visibility="unlisted"] {
    border-style: dashed;
}

.visibility-badge[data-visibility="public"] {
    background: var(--mint);
    color: var(--on-color);
}

/* Wordmark */

.auth-card h1,
.app-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.auth-card h1::after,
.app-header h1::after {
    content: ".";
    color: var(--pop);
}

/* Auth pages */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px 24px 24px 16px;
}

.auth-card {
    background: var(--surface);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
}

.auth-card h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    color: var(--muted);
    margin: 0 0 24px;
    font-size: 0.95rem;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-card label {
    margin-top: 12px;
}

.auth-card input {
    padding: 10px;
    font-size: 1rem;
}

.auth-card button[type="submit"] {
    margin-top: 20px;
    padding: 12px;
    font-size: 1rem;
}

.switch {
    margin: 16px 0 0;
    font-size: 0.9rem;
    text-align: center;
}

.error,
.field-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin: 4px 0;
    padding-left: 8px;
    border-left: 3px solid var(--danger);
}

/* App pages */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: var(--line);
}

.link-button {
    background: none;
    border: none;
    padding: 4px;
    color: var(--muted);
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-button:hover {
    color: var(--ink);
}

.app-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-right: 3px;
}

.toolbar input[type="search"] {
    flex: 1 1 200px;
    padding: 10px 12px;
}

.toolbar select {
    padding: 10px;
}

.toolbar button {
    padding: 10px 16px;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

/* Item card: a book on the shelf. The spine colour is the reading status, and nothing else. */

.item-card {
    --spine: var(--sun);
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: var(--line);
    border-radius: var(--radius);
    padding: 14px 14px 14px 28px;
}

.item-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 12px;
    background: var(--spine);
    border-right: var(--line);
    border-radius: calc(var(--radius) - 2px) 0 0 calc(var(--radius) - 2px);
}

.item-card[data-status="reading"] {
    --spine: var(--sky);
}

.item-card[data-status="done"] {
    --spine: var(--mint);
}

.item-main {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.item-note {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 6px 0 10px;
    overflow-wrap: anywhere;
}

.item-note p {
    margin: 0 0 4px;
}

.item-note code {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    align-items: center;
}

.item-status {
    background: var(--spine);
    color: var(--on-color);
    border-radius: 4px;
    padding: 1px 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.item-rating {
    color: var(--star);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag-pill {
    border: 1px solid var(--muted);
    border-radius: 4px;
    padding: 0 6px;
}

.tag-pill::before {
    content: "#";
    opacity: 0.6;
}

.item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 3px 3px 0;
}

.item-actions button {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.item-actions .delete-btn {
    color: var(--danger);
}

.empty-state {
    margin: 0;
    padding: 40px 16px;
    border: 2px dashed var(--muted);
    border-radius: var(--radius);
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 1.1rem;
    text-align: center;
}

/* Item dialog */

dialog#item-dialog {
    background: var(--surface);
    color: var(--ink);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 24px;
    width: calc(100% - 40px);
    max-width: 480px;
}

dialog#item-dialog::backdrop {
    background: rgba(23, 20, 15, 0.55);
}

dialog#item-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

#item-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#item-form label {
    margin-top: 10px;
}

#item-form input,
#item-form select,
#item-form textarea {
    padding: 8px;
}

#item-form textarea {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding: 0 3px 3px 0;
}

.dialog-actions button {
    padding: 8px 16px;
}

/* Error pages */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 100vh;
    padding: 16px;
    text-align: center;
}

.error-page h1 {
    margin: 0;
    font-size: clamp(2.5rem, 12vw, 5rem);
}

.error-page p {
    margin: 0;
}

@media (max-width: 480px) {
    .toolbar select {
        flex: 1 1 30%;
        min-width: 0;
    }

    .toolbar button {
        flex: 1 1 100%;
    }

    .list-card {
        flex-direction: column;
    }

    .item-actions {
        flex-direction: row;
    }
}

/* Navigation, banners, panels (lists, settings, billing) */

.wordmark {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.wordmark:hover {
    background: none;
    color: inherit;
}

.wordmark::after {
    content: ".";
    color: var(--pop);
}

.app-header {
    flex-wrap: wrap;
    gap: 8px 16px;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-right: auto;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
}

.app-nav a[aria-current="page"] {
    text-decoration-color: var(--pop);
    text-decoration-thickness: 3px;
    font-weight: 700;
}

.app-nav a:not([aria-current]) {
    text-decoration: none;
}

.banner {
    margin: 0 0 16px;
    padding: 10px 14px;
    border: var(--line);
    border-radius: var(--radius);
    background: var(--sun);
    color: var(--on-color);
}

.banner a {
    color: var(--on-color);
    font-weight: 700;
}

.hint {
    margin: 4px 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.list-scope {
    margin: 0 0 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-right: 3px;
}

.page-title h2,
.panel h2 {
    margin: 0;
    font-size: 1.5rem;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 5px 24px 0;
    padding: 20px;
    background: var(--surface);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel[hidden] {
    display: none;
}

.panel > label {
    margin-top: 12px;
}

.panel input[type="text"],
.panel textarea {
    padding: 8px;
}

.panel p {
    margin: 4px 0;
}

.panel .btn {
    align-self: flex-start;
}

.panel button[type="submit"],
.panel .dialog-actions button {
    border: var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    padding: 8px 16px;
}

.panel button:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.panel .btn-primary,
.panel button.btn-primary {
    background: var(--pop);
    color: var(--on-color);
}

button.danger {
    color: var(--danger);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-group {
    margin: 12px 0 0;
    padding: 0;
    border: none;
}

.choice-group legend {
    margin-bottom: 6px;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 6px 0;
    font-family: var(--font-body);
    font-size: 0.95rem;
    text-transform: none;
    letter-spacing: normal;
}

.choice input {
    margin-top: 4px;
    accent-color: var(--pop);
}

.share-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.share-box[hidden] {
    display: none;
}

.share-box input {
    flex: 1 1 240px;
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin: 8px 0 0;
}

.facts dt {
    font-size: 0.85rem;
    color: var(--muted);
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.copy-controls {
    display: flex;
    gap: 8px;
}

.copy-controls select {
    flex: 1;
    padding: 8px;
}

.mono-break {
    overflow-wrap: anywhere;
}

.list-card .item-actions {
    flex-direction: row;
    align-items: flex-start;
}

.list-card .btn {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.plan-heading {
    margin: 16px 0 4px;
    font-family: var(--font-display);
    font-size: 1.25rem;
}

.plan-list {
    margin: 0 0 12px;
    padding-left: 20px;
}

.panel form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.panel form label {
    flex-basis: 100%;
}

.panel form select {
    padding: 8px;
    flex: 1 1 200px;
}

.panel p .btn {
    margin: 0 8px 8px 0;
}

/* Favicons */

.item-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-favicon {
    flex: none;
    width: 16px;
    height: 16px;
}

.item-favicon[hidden] {
    display: none;
}

.ed-body h2 .item-favicon {
    display: inline-block;
    margin-right: 8px;
    vertical-align: baseline;
}

/* Archive: links from earlier weeks, locked on the free plan. Quiet rows, no cards. */

.archive {
    margin-top: 40px;
    padding-top: 24px;
    border-top: var(--line);
}

.archive h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
}

.archive-count {
    margin-left: 6px;
    padding: 1px 8px;
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0;
    vertical-align: middle;
}

.archive-list {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.archive-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--dot);
}

.archive-title {
    flex: 1;
    min-width: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.archive-date {
    flex: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}

.archive-delete-btn {
    flex: none;
    padding: 2px 4px;
    border: none;
    background: none;
    color: var(--danger);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.steps {
    margin: 4px 0 16px;
    padding-left: 22px;
}

.steps li {
    margin: 4px 0;
}

/* "via @someone" credit and the "Save to my shelf" link on public pages */

.via {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}

.save-to-shelf {
    white-space: nowrap;
}

/* Feed and following */

.feed-byline {
    margin: 0 0 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}

.feed-more {
    margin: 24px 0 0;
    text-align: center;
}

.following-list form {
    display: inline;
}

.follow-link {
    font-weight: 700;
}

/* One-click status: the chip is a button that steps To read, Reading, Done */

button.item-status {
    border: none;
    font: inherit;
    cursor: pointer;
}

button.item-status:hover {
    outline: 2px solid var(--ink);
    outline-offset: 1px;
}

/* Phone layout (checked at 360px wide). Everything above is mobile-safe already; these fix the cramped spots. */

.page-title .btn {
    white-space: nowrap;
}

@media (max-width: 600px) {
    /* Header: wordmark and Log out on the first row, the section links on a scrollable second row. */
    .app-header {
        padding: 10px 16px 0;
    }

    .app-nav {
        order: 3;
        flex: 1 0 100%;
        flex-wrap: nowrap;
        gap: 20px;
        margin: 0 -16px;
        padding: 6px 16px 10px;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .app-header .header-actions {
        margin-left: auto;
    }

    /* Plan facts: label above value, so long values never squash into a sliver. */
    .facts {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .facts dd {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    /* Dashboard filters: search on its own row, the four filters two by two, then the save button. */
    .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .toolbar input[type="search"],
    .toolbar button {
        grid-column: 1 / -1;
    }

    .toolbar select {
        min-width: 0;
        width: 100%;
    }

    /* Bigger tap target for the status chip. */
    button.item-status {
        padding: 4px 8px;
    }
}

/* Dashboard: this week card, paste box, first run, save dialog extras */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.week-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 14px;
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: var(--muted);
}

.week-line .week-title {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--ink);
}

.week-line strong {
    color: var(--ink);
}

.week-counter-warn strong {
    color: var(--star);
}

.week-line .link-button {
    font-size: inherit;
}

.filters summary {
    cursor: pointer;
    padding: 10px 4px;
    font-size: 0.9rem;
    color: var(--muted);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 4px;
}

.quick-add {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
    padding-right: 3px;
}

.quick-add input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px;
}

.quick-add button {
    padding: 10px 16px;
}

.first-run {
    padding: 24px 20px;
    text-align: left;
    color: var(--ink);
}

.first-run h2 {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 1.4rem;
}

.first-run-steps {
    margin: 0;
    padding-left: 22px;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
}

.first-run-steps li + li {
    margin-top: 10px;
}

.first-run-steps .link-button {
    font-size: inherit;
}

.label-note {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--muted);
}

.more-options {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--dot);
}

.more-options summary {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--muted);
}

.more-options[open] summary {
    margin-bottom: 4px;
}

.more-options select,
.more-options input[type="text"] {
    width: 100%;
}

a.archive-title:hover {
    color: var(--ink);
}

.nav-mypage {
    text-decoration: none;
    color: var(--pop);
    font-weight: 700;
}

@media (max-width: 600px) {
    .quick-add {
        padding-right: 0;
    }

    .toolbar {
        padding-right: 0;
    }

    .filter-row select {
        flex: 1 1 40%;
        min-width: 0;
    }
}

/* Settings: profile, account and delete forms */

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 480px;
}

.stack-form label {
    margin-top: 10px;
}

.stack-form input[type="text"],
.stack-form input[type="email"],
.stack-form input[type="password"],
.stack-form textarea {
    padding: 8px;
}

.stack-form label.check {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.banner-ok {
    background: var(--mint);
}

.danger-zone h2 {
    color: var(--danger);
}

button.btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.stack-form {
    align-items: stretch;
    text-align: left;
    width: 100%;
}

.stack-form input[type="text"],
.stack-form input[type="email"],
.stack-form input[type="password"],
.stack-form textarea {
    width: 100%;
}

.stack-form label {
    text-align: left;
}

.stack-form p {
    margin: 12px 0 0;
}

.panel .more-options {
    text-align: left;
}

.panel .stack-form {
    align-items: stretch;
}

/* Terms, Privacy and Contact links: the footer on every page, including sign-in and sign-up */

.legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.legal-links a {
    color: var(--muted);
}

.auth-page > .legal-links {
    padding: 8px 16px 24px;
}

.pub-footer .legal-links,
.landing-footer .legal-links {
    flex-basis: 100%;
    justify-content: flex-start;
    margin-top: 4px;
}

.legal h2 {
    margin: 28px 0 8px;
    font-size: 1.2rem;
}

.legal p,
.legal li {
    max-width: 68ch;
    line-height: 1.55;
}

.legal ul {
    padding-left: 20px;
}

.auth-page {
    flex-direction: column;
    gap: 20px;
}

.auth-page > .legal-links {
    padding: 0;
}

.app-footer {
    max-width: 800px;
    margin: 8px auto 0;
    padding: 24px 16px 32px;
}

.app-footer .legal-links {
    justify-content: flex-start;
}


/* Shelf cards: quiet domain line under the title, and a small "..." menu instead of three buttons */

.item-domain {
    margin: 2px 0 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}

.item-domain + .item-note,
.item-domain + .item-meta {
    margin-top: 8px;
}

.card-menu {
    position: relative;
    flex: none;
    align-self: flex-start;
}

.card-menu summary {
    list-style: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.card-menu summary::-webkit-details-marker {
    display: none;
}

.card-menu summary:hover,
.card-menu[open] summary {
    color: var(--ink);
    background: var(--paper);
}

.card-menu-list {
    position: absolute;
    top: 34px;
    right: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    min-width: 120px;
    padding: 4px;
    background: var(--surface);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-menu-list button {
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.card-menu-list button:hover {
    background: var(--paper);
}

.card-menu-list .delete-btn {
    color: var(--danger);
}


/* Header: Upgrade is one small pill for free accounts; everything else is plain text */

.nav-upgrade {
    padding: 4px 12px;
    background: var(--pop);
    border: var(--line);
    border-radius: 999px;
    color: var(--on-color);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-upgrade[aria-current="page"] {
    box-shadow: var(--shadow-sm);
}

/* Settings: one section at a time (settings.js); all sections show without JavaScript */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin: 0 0 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--dot);
    font-family: var(--font-display);
    font-weight: 600;
}

.tabs a {
    color: var(--muted);
    text-decoration: none;
}

.tabs a[aria-current="page"] {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--pop);
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
}

.js-tabs .panel[data-tab]:not(.is-active) {
    display: none;
}

.js-tabs .panel + .panel {
    margin-top: 0;
}

@media (max-width: 600px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
    }
}

.item-meta .save-to-shelf {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 600;
}


/* Edit dialog: status and rating are one click, not a dropdown */

.chip-field {
    margin: 10px 0 0;
    padding: 0;
    border: none;
}

.chip-field legend {
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.chip-group,
.stars {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.chip-group input,
.stars input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip {
    padding: 5px 12px;
    border: var(--line);
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.chip-group input:checked + .chip[data-status="to_read"] { background: var(--sun); color: var(--on-color); }
.chip-group input:checked + .chip[data-status="reading"] { background: var(--sky); color: var(--on-color); }
.chip-group input:checked + .chip[data-status="done"] { background: var(--mint); color: var(--on-color); }

.chip-group input:focus-visible + .chip,
.stars input:focus-visible + label {
    outline: 2px solid var(--pop);
    outline-offset: 2px;
}

/* Stars are written 5 to 1 and shown 1 to 5, so a chosen star lights itself and every lower one. */
.stars {
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
}

.stars label {
    padding: 0 2px;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.stars input:checked ~ label:not(.stars-clear),
.stars label:not(.stars-clear):hover,
.stars label:not(.stars-clear):hover ~ label:not(.stars-clear) {
    color: var(--star);
}

.stars .stars-clear {
    margin-right: 10px;
    font-size: 0.85rem;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.stars input:checked + .stars-clear {
    color: var(--ink);
    text-decoration: none;
}

/* The hidden attribute must win over component display rules (toolbar, quick-add, week line) */

[hidden] {
    display: none !important;
}


/* Paid shelf: a heading per week. Free archive: one folded group per week. */

.items-list .week-heading {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 16px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--dot);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
}

.items-list .week-heading:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.week-heading small {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--muted);
}

.archive-week {
    border-top: 1px solid var(--dot);
}

.archive-week summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
    padding: 10px 0;
    cursor: pointer;
}

.archive-week-title {
    font-family: var(--font-display);
    font-weight: 700;
}

.archive-week-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

/* People lists: Explore, "People to follow" */

.shelf-list {
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.shelf-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--dot);
}

.shelf-list li > div {
    min-width: 0;
}

.shelf-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.shelf-handle,
.shelf-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.shelf-bio {
    margin: 2px 0 0;
    max-width: 52ch;
}

.shelf-meta {
    margin: 2px 0 0;
}

.suggestions {
    margin: 8px 0 24px;
}

.suggestions h3,
.explore-heading {
    margin: 24px 0 4px;
    font-family: var(--font-display);
    font-size: 1.15rem;
}

.page-title-links {
    display: flex;
    gap: 8px;
}

.explore-note {
    margin: 32px 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.saved-by {
    font-weight: 600;
}

/* Public forms (report, contact): a honeypot field people never see */

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-wide {
    max-width: 560px;
}

.form-wide input[type="text"],
.form-wide input[type="email"],
.form-wide select,
.form-wide textarea {
    width: 100%;
    padding: 10px 12px;
}

/* Announcement banner in the app and on the landing page */

.announcement {
    padding: 8px 16px;
    background: var(--sky);
    color: var(--on-color);
    border-bottom: var(--line);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.announcement-warn {
    background: var(--sun);
}


/* Header, right side: the Upgrade pill (free accounts) and Log out, always visible */

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-actions form {
    margin: 0;
}

/* The wordmark on the sign-in pages leads home */

.auth-card h1 a.auth-logo {
    color: inherit;
    text-decoration: none;
}

.auth-card h1 a.auth-logo:hover {
    background: none;
    color: inherit;
}
