/*
 * Recurring patterns, one section per component. The inventory with markup
 * is in docs/design-system.md and rendered on /docs.
 *
 * Source order matters in a few places (equal-specificity rules), so keep
 * sections in this order when editing.
 */

/* container: the cloud-colored card the whole page sits on */
body .container {
    background-color: var(--color-surface);
    margin: var(--space-8);
    border-radius: var(--radius);
}

/* image grid: output of the {% grid %} shortcode */
.image-grid p {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.image-grid img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* callout: Obsidian callouts (markdown-it-obsidian-callouts) */
.callout {
    max-width: 100%;
    display: block;
    margin: var(--space-8) 0;
    border-radius: var(--radius);
    padding: var(--space-24) var(--space-36);
    background-color: var(--color-surface-sunken);
}

.callout-title {
    font-family: var(--pixel);
    color: var(--color-text-subtle);
    text-transform: lowercase;
    font-size: var(--text-2xl);
    margin-top: 0;
}

.callout-title-icon {
    display: none;
}

.callout-content > p {
    font-size: var(--text-base);
}

/* footnotes (markdown-it-footnote) */
.footnotes ol {
    padding-inline-start: var(--space-24);
}

.footnotes ol li::marker {
    content: counter(list-item) " ";
    font-family: var(--mono);
    color: var(--color-text-subtle);
}

.footnote-item {
    font-size: var(--text-xs);
}

sup.footnote-ref {
    font-feature-settings: "sups";
    line-height: 0;
}

.footnote-ref a {
    text-decoration: none;
}

.footnote-backref {
    text-decoration: none;
    font-family: var(--mono);
    color: var(--color-link);
    font-size: var(--text-base);
}

/* blog index body */
.blog_post {
    width: 50%;
    margin: 0 auto;
}

/* shelf filters */
.shelf-filters {
    margin-bottom: var(--space-24);
}

.shelf-filter {
    margin-left: 0;
}

.shelf-filter.active {
    background-color: var(--color-fill-inverse);
    color: var(--color-surface);
}

.shelf-empty {
    color: var(--color-text-subtle);
    font-family: var(--mono);
    font-size: var(--text-label);
    padding: var(--space-8) 0;
}

/* shelf table */
.shelf-table {
    margin-bottom: var(--space-24);
}

.shelf-table table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.shelf-table th {
    padding: var(--space-8) 0;
    text-align: left;
    font-family: var(--mono);
    font-weight: 300;
    border-bottom: var(--border-dashed);
    text-transform: uppercase;
}

.shelf-table td {
    padding: var(--space-8) 0;
    line-height: 16px;
    text-transform: capitalize;
}

/* status swatch: colored dot, used in shelf tables and shelf info */
.shelf-table .swatch,
.shelf-info .swatch {
    float: left;
    width: 12px;
    height: 12px;
    margin: var(--space-2) var(--space-8) 0 0px;
    border-radius: 100%;
    border: var(--border);
}

.shelf-table .see-more {
    margin-top: var(--space-8);
}

.shelf-table .see-more a {
    font-family: var(--mono);
    color: var(--color-text-subtle);
    text-transform: uppercase;
    text-decoration: none;
    margin-top: var(--space-8);
}

.shelf-table .see-more a:hover {
    color: var(--color-accent);
}

/* shelf info: cover + meta header on book/game pages */
.shelf-info {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-12);
    align-items: flex-end;
    margin-bottom: var(--space-36);
    font-family: var(--mono);
}

.shelf-info .meta {
    padding-bottom: var(--space-4);
}

.shelf-info p,
.shelf-info a {
    margin: var(--space-2);
    font-size: var(--text-sm);
}

.shelf-cover-img {
    max-height: 180px;
}

.shelf-info-status .swatch {
    margin: 0 0 0 2px;
}

.shelf-info-status {
    text-transform: capitalize;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--space-4);
}

/* overview: home page illustration + latest posts */
.overview {
    display: flex;
    flex-flow: wrap-reverse;
}

.overview > .illustration {
    margin: 0 -30px;
    max-width: 300px;
}

.overview > .illustration > img {
    margin: -48px auto;
}

.latest_posts > h2 {
    color: var(--color-link);
}

.latest_posts > ul {
    margin: 0;
}

.latest_posts > ul > li:before {
    content: "→ ";
    font-family: var(--sans-serif);
}

.latest_posts > ul > li > a {
    color: var(--color-text);
    text-decoration: none;
}

.latest_posts > ul > p {
    padding: 0;
    margin: 0;
}

/* button variants (the plain <button> is in base.css) */
button.secondary {
    background-color: var(--color-fill-inverse);
    color: var(--color-fill);
}

button.secondary:hover {
    background-color: var(--color-fill-inverse);
    color: var(--color-fill);
    opacity: 0.8;
}

button.secondary:active,
button.secondary:active:hover {
    opacity: 1;
}

button.secondary:disabled,
button.secondary:disabled:hover {
    background-color: var(--color-fill-inverse);
    color: var(--color-fill);
    opacity: 0.7;
}

/* button link: a link styled as a button, e.g. "see more" */
.button_style {
    font-family: var(--mono), sans-serif;
    text-transform: uppercase;
    font-size: var(--text-label);
    margin-top: var(--space-16);
}

.button_style > a {
    background-color: var(--color-fill);
    color: var(--color-text);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius);
    text-decoration: none;
}

.button_style > a:hover {
    background-color: var(--color-fill-hover);
    color: var(--color-text);
}

/* label: small uppercase mono caption */
.label {
    font-family: var(--mono);
    text-transform: uppercase;
    font-size: var(--text-label);
    margin: 0;
    padding: 0;
}

/*
 * teashop: classes rendered by the Svelte game (src/svelte). Not part of
 * the general component set; kept here so the page renders the same.
 */
.game-data {
    display: grid;
    grid-auto-rows: 1fr;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-8) var(--space-8);
    justify-content: space-around;
    justify-items: stretch;
    margin-bottom: var(--space-36);
}

.teashop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--space-8) var(--space-8);
}

/* dropdown: <details> panel */
.dropdown {
    margin-top: 14px;
    display: block;
}

.dropdown details {
    background-color: var(--color-fill);
    padding: var(--space-16);
    border-radius: var(--radius);
    margin-bottom: var(--space-12);
}

.dropdown summary {
    list-style: none;
    font-family: var(--mono), sans-serif;
    text-transform: uppercase;
    font-size: var(--text-label);
}

.dropdown summary:hover {
    cursor: pointer;
}

.dropdown .label {
    margin-top: var(--space-16);
    margin-bottom: 0;
}

.dropdown h2 {
    margin-top: var(--space-6);
}

.dropdown p.stat-display {
    margin: 0;
    padding: 0;
}

.teashop-serve {
    margin-top: var(--space-36);
    text-align: right;
}

/* toasts */
.toast-container {
    position: fixed;
    bottom: 0;
    left: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}

.toast {
    position: absolute;
    bottom: 0;
    left: 4px;
    padding: var(--space-8);
    font-size: 14px;
    font-family: var(--mono);
    color: var(--color-text);
    animation: float-up 4s ease-out forwards;
    white-space: nowrap;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
}

.toast.success {
    bottom: 12px;
    color: var(--color-success);
    animation: float-up 8s ease-out forwards;
}

.toast.error {
    bottom: 12px;
    color: var(--color-error);
    animation: float-up 8s ease-out forwards;
}

.toast.info {
    bottom: 12px;
    color: var(--color-info);
    animation: float-up 8s ease-out forwards;
}

.toast.sunrise {
    bottom: 36px;
    color: var(--beam);
    animation: float-up 12s ease-out forwards;
}

.toast.sunset {
    bottom: 36px;
    color: var(--beam);
    animation: float-up 12s ease-out forwards;
}

.toast.night {
    bottom: 36px;
    color: var(--joycon);
    animation: float-up 12s ease-out forwards;
}

@keyframes float-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

/* time of day indicator */
.time-indicator {
    margin-bottom: 1em;
}

.time-indicator.sunrise > p {
    color: var(--beam);
}

.time-indicator.day > p {
    color: var(--comfy);
}

.time-indicator.sunset > p {
    color: var(--beam);
}

.time-indicator.night > p {
    color: var(--joycon);
}

/* gardens & teapots */
.garden-plot,
.teapot {
    background-color: var(--color-surface-raised);
    border: var(--border-dashed);
    border-radius: var(--radius);
    padding: var(--space-8);
    width: 100%;
}

.garden-box,
.harvest-box {
    display: grid;
    grid-template-columns: 3fr 1fr;
    grid-template-rows: auto 1fr;
    align-items: center;
    justify-items: start;
}

.teapot {
    display: grid;
    grid-template-columns: 4fr 0.5fr 0.5fr;
    grid-template-rows: 1fr 1fr;
    grid-template-areas:
        ". progress progress"
        ". . bottom-right";
    align-items: center;
    justify-items: start;
}

.teapot progress[value] {
    grid-area: progress;
}

.tea-selection {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
}

.garden-plot select {
    font-family: var(--mono);
    font-size: var(--text-label);
    text-transform: uppercase;
    margin: var(--space-4);
    background-color: var(--color-surface);
    border-color: var(--color-border);
    border-radius: var(--radius-sm);
}

.tea-inventory {
    margin-bottom: var(--space-4);
}

.garden-plot button,
.teapot button {
    margin: var(--space-4);
}

.dropdown button {
    margin-left: 0;
    margin-top: 0;
}

button.save-game {
    margin: 0;
    padding: 3px 6px;
}

.teashop-serve button,
.teashop-serve button:active,
.teashop-serve button:disabled:active {
    border: 3px solid var(--color-border);
    margin-right: 0;
}

.teashop-serve button:active {
    border: 3px solid var(--matcha);
    opacity: 1;
}

.garden-plot.paused {
    border: var(--border-inactive);
    opacity: 0.8;
}

.garden-plot,
.teapot {
    position: relative;
}

.teapot.paused {
    border: var(--border-inactive);
    opacity: 0.8;
}

.control-buttons {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    gap: var(--space-4);
}

.teapot .control-buttons {
    position: static;
    grid-area: bottom-right;
    justify-self: end;
}

/* round icon buttons */
.delete-button,
.pause-button {
    width: 24px;
    height: 24px;
    padding: 0;
    background: var(--color-surface);
    border: var(--border-control);
    border-radius: var(--radius-round);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background-color var(--duration-base);
}

.pause-button {
    font-size: 10px;
}

.pause-button:hover,
.delete-button:hover {
    background-color: var(--color-fill-hover);
}

.teapot .pause-button {
    position: static;
    justify-self: end;
    grid-area: bottom-right;
}

/* stats tables */
.stats-tables {
    width: 100%;
    margin-top: 20px;
}

.stats-tables * {
    font-family: var(--mono);
    color: var(--color-text);
    font-weight: normal;
    font-size: var(--text-label);
    text-transform: uppercase;
    text-align: left;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.stats-table td {
    border-top: 1px solid var(--color-border-strong);
}

.stats-table th,
.stats-table td {
    padding: var(--space-6);
}

.stats-tables h3 {
    font-family: var(--pixel);
    text-transform: lowercase;
    font-size: 1.4em;
    margin-bottom: var(--space-6);
}

.stats-section {
    margin: 28px 0;
}

.stats-tea-type {
    width: 25%;
}

/* teacup icons */
.teacup-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin: 0 var(--space-4);
}

.toast-teacup-icon {
    display: inline;
    width: 18px;
    height: 18px;
    margin-right: var(--space-6);
}

/*
 * Below: styles that used to sit in <style> blocks inside the partials.
 * They came after everything above in the cascade, and still do.
 */

/* site header: tea cup + breadcrumbs (partials/head.html) */
.head {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-rows: 1fr;
    gap: 0px var(--space-24);
    justify-items: start;
}

.head > div > h1 {
    margin-bottom: -6px;
}

.tea_container {
    position: relative;
    display: inline-block;
}
.tea_cup {
    width: 48px;
    cursor: pointer;
    transition: transform var(--duration-slow) ease;
}
.tea_cup:hover {
    transform: scale(1.1);
}
@keyframes wiggle {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    50% {
        transform: rotate(10deg);
    }
    75% {
        transform: rotate(-10deg);
    }
    100% {
        transform: rotate(0deg);
    }
}
.wiggle {
    animation: wiggle 0.5s ease;
}
.speech_bubble {
    position: absolute;
    top: 80px;
    width: 180px;
    background-color: var(--color-surface-raised);
    border: var(--border-control);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    font-size: 14px;
    opacity: 0;
    transition:
        opacity var(--duration-slow) ease,
        transform var(--duration-slow) ease;
    transform: translateY(10px);
    font-family: var(--mono);
}
.speech_bubble.show {
    opacity: 1;
    transform: translateY(0);
}

/* breadcrumbs (partials/breadcrumbs.html) */
nav[aria-label="breadcrumb"] {
    text-transform: lowercase;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: var(--text-xl);
    margin-top: var(--space-8);
    line-height: 24px;
}

ul.breadcrumb-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

ul.breadcrumb-list > span.separator {
    color: var(--color-text-quiet);
}

/* post list: thumbnail cards (partials/thumbnails.html) */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-item {
    display: flex;
    align-items: stretch;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: var(--border-dashed);
    border-radius: var(--radius-lg);
    background-color: var(--color-surface-raised);
}

.post-thumbnail {
    flex-shrink: 0;
    width: 160px;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    display: block;
}

.post-details {
    flex-grow: 1;
    margin: 1rem;
}

.post-details h2 {
    margin: 0;
}

.post-details time {
    display: block;
    margin: 0.25rem 0;
}

.post-details p {
    margin: 0;
    font-size: var(--text-base);
}

/* --bp-narrow */
@media (max-width: 600px) {
    .post-item {
        flex-direction: column;
        gap: 0;
    }

    .post-thumbnail {
        width: 100%;
        height: 200px;
    }

    .post-details {
        margin: 1rem;
    }
}

/* post grid: image cards (partials/grid.html) */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.grid-card {
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.grid-image {
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: block;
}

.grid-image p {
    margin: 0;
}

.grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
}

.grid-content {
    padding: 0.7rem;
}

.grid-content h2 {
    margin: 0;
    font-size: var(--text-xl);
}

.grid-content time {
    color: var(--color-text-quiet);
}

/* footer nav (partials/nav.html); `nav ul` itself is in base.css */
.footer-nav ul li a {
    margin-right: var(--space-8);
}

.footer-nav ul li {
    font-family: var(--serif);
}

.footer-nav ul li a {
    text-decoration: underline;
    color: var(--color-text) !important;
}

/* style guide (/docs) */
.font-guide > h3 {
    font-size: var(--text-2xl);
}

.font-guide > p {
    font-size: var(--text-base);
}

.font-guide > h3.font-mono {
    font-size: var(--text-base);
}

.font-guide > p.font-mono {
    font-size: var(--text-sm);
}

.swatch-list .swatch {
    float: left;
    width: 16px;
    height: 16px;
    margin: 0 var(--space-8) 0 0px;
    border-radius: 100%;
    border: var(--border);
}

table.swatch-list {
    width: 100%;
    border-collapse: collapse;
}

.swatch-list th {
    padding: var(--space-8);
    text-align: left;
}

.swatch-list td {
    padding: var(--space-8);
    border-top: var(--border);
    line-height: 16px;
}

.hex-code {
    font-family: var(--mono);
    text-transform: uppercase;
    font-size: var(--text-xs);
}

.token-name {
    font-family: var(--mono);
    font-size: var(--text-xs);
}

.token-table td:first-child {
    width: 88px;
}

.token-bar {
    height: var(--space-8);
    background-color: var(--color-accent);
}

.token-box {
    width: 48px;
    height: 32px;
    background-color: var(--color-surface-raised);
    border: var(--border);
}

/* frame around each live example on /docs */
.component-demo {
    border: var(--border-dashed);
    border-radius: var(--radius);
    padding: var(--space-16);
    margin: var(--space-8) 0 var(--space-16);
}
