/* Wagtail-specific overrides for Monobase theme */

@font-face {
    font-family: "JetBrains Mono Inline";
    src: url("../fonts/JetBrainsMono-Medium.63282f58f349.woff2") format("woff2");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

:root, :host {
    --radius: 0.375rem;
    --inline-code-color: var(--color-900);
    --inline-code-bg: color-mix(in srgb, var(--color-950), transparent 94%);
}

.theme-dark {
    --inline-code-color: var(--color-900);
    --inline-code-bg: color-mix(in srgb, var(--color-950), transparent 88%);
}

.wagtail-userbar {
    z-index: 9999;
}

/* About/Tool pages without posts sidebar use full width for main-box */
.main-box-full {
    border-inline-start: none;
}

@media screen and (min-width: 90rem) {
    .template-aboutpage .site-box,
    .template-toolpage .site-box,
    .template-searchresults .site-box {
        grid-template-columns: 20rem minmax(300px, 1fr);
    }
    .template-aboutpage .site-box .actions-box,
    .template-toolpage .site-box .actions-box,
    .template-searchresults .site-box .actions-box {
        width: calc(100% - 20rem);
    }
}

/* Article separators in listing pages */
article.section-box + article.section-box {
    margin-block-start: 3rem;
    padding-block-start: 3rem;
    border-block-start: 1px dotted var(--color-400);
}

/* Excerpt fade-out effect */
.excerpt-fade {
    position: relative;
    max-height: 6.5em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
}

.excerpt-fade p {
    margin: 0;
}

/* "Read more" link in post listings */
.read-more-link {
    display: inline-block;
    margin-block-start: 0.5rem;
    font-weight: 600;
    font-size: 0.875em;
    color: var(--color-500);
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 0.25em;
    transition: color var(--transition);
}

.read-more-link:hover {
    color: var(--color-950);
    text-decoration-style: solid;
}

/* Search page form in content area */
.search-form-page {
    margin-block: 1rem;
    max-width: 30rem;
}

/* Archive page header */
.archive-header {
    padding-block-end: var(--block-spacing);
    border-block-end: 1px dashed var(--color-300);
}

.archive-count {
    color: var(--color-500);
    font-size: 0.875em;
}

/* Post navigation matching monobase style */
.post-navigation {
    max-width: 50rem;
    margin-inline: auto;
    padding-inline: var(--site-padding-inline);
    padding-block: var(--block-spacing);
}

.post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.post-navigation .nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-700);
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color var(--transition);
}

.post-navigation .nav-links a:hover {
    color: var(--color-950);
}

.post-navigation .nav-next {
    margin-inline-start: auto;
}

/* =============================================
   Comments area — matching monobase style
   ============================================= */
.comments-area {
    margin-block-start: var(--block-spacing);
    padding-inline: 1rem;
    border-block-start: 0.0625rem solid var(--color-300);
    padding-block: var(--block-spacing) 1rem;
}

.comments-title {
    font-size: 1.125rem;
    font-weight: 600;
    text-wrap: balance;
}

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

.comment-list .children {
    margin-inline-start: 0;
    padding-inline-start: 1.25rem;
}

.comment-list .comment {
    position: relative;
}

.comment-list .comment.parent {
    padding-inline-start: 0.75rem;
}

.comment-list .comment.parent:after {
    content: "";
    position: absolute;
    inset: 2.5rem auto auto 0.125rem;
    width: 0.125rem;
    height: calc(100% - 2.5rem);
    border-inline-start: 0.0625rem dashed var(--color-300);
}

.comment-body {
    display: grid;
    gap: 0.5rem;
    position: relative;
    grid-template-areas: "comment-meta comment-reply" "comment-content comment-content";
    grid-template-columns: 1fr auto;
    margin-block: 0.5rem;
}

.comment-body .reply {
    grid-area: comment-reply;
}

.comment-meta {
    grid-area: comment-meta;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.comment-content {
    min-height: 3.75rem;
    margin-inline-start: 0;
    margin-block: 0.75rem;
    grid-area: comment-content;
}

.comment-content p {
    margin: 0;
    line-height: 1.75;
}

.comment-content .biaoqing {
    display: inline;
    vertical-align: text-bottom;
    height: 1.75em;
    width: auto;
    margin: 0 0.1em;
}

.comment-author {
    display: flex;
    gap: 0.375rem;
    align-items: baseline;
    flex-wrap: wrap;
}

.comment-author .fn {
    font-weight: 700;
    color: var(--color-950);
}

.comment-badge.admin {
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1;
    color: var(--color-50);
    background-color: var(--color-600);
    padding: 0.125rem 0.3rem;
    border-radius: 0.1875rem;
    vertical-align: baseline;
    white-space: nowrap;
    user-select: none;
}

.comment-metadata {
    position: static;
    transform: none;
    font-size: 0.625rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.comment-metadata time {
    color: var(--color-300);
}

.reply-to {
    font-size: 0.75em;
    color: var(--color-400);
}

.comment-reply-link {
    color: var(--color-600);
    position: relative;
    height: 2rem;
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-small);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    padding: 0;
    transition: background-color var(--transition);
}

.comment-reply-link:hover {
    background-color: var(--color-100);
}

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

.no-comments {
    list-style: none;
    color: var(--color-400);
    padding-block: 1rem;
}

/* =============================================
   Comment form — matching monobase style
   ============================================= */
.comment-respond {
    margin-block-start: var(--block-spacing);
}

.comment .comment-respond {
    background-color: var(--color-50);
    padding: 1rem;
    border-radius: var(--radius-medium);
    margin-inline-start: 2.5rem;
    margin-block: 1rem;
}

.comment-reply-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-block-end: 0.5rem;
    text-wrap: balance;
}

.comment-notes {
    font-size: 0.875rem;
    color: var(--color-500);
    margin-block-end: 1rem;
}

.comment-notes .required,
.comment-form .required {
    color: var(--color-950);
    font-size: 0.875rem;
    font-weight: 700;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-form-comment label,
.comment-form-author label,
.comment-form-email label {
    display: inline-block;
    font-weight: 500;
    position: relative;
    padding-inline-end: 0.75rem;
    margin-block-end: 0.5rem;
}

.comment-form-comment label .required,
.comment-form-author label .required,
.comment-form-email label .required {
    position: absolute;
    inset: 0 0 auto auto;
    transform: translateY(-0.125rem);
}

.comment-form textarea,
.comment-form input[type="text"],
.comment-form input[type="email"] {
    width: 100%;
    appearance: none;
    background-color: var(--color-50);
    border: 0.0625rem solid var(--color-300);
    border-radius: var(--radius-small);
    padding-block: calc(0.5rem - 0.0625rem);
    padding-inline: 0.75rem;
    font-family: var(--font-family);
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--color-900);
}

.comment-form textarea:focus,
.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus {
    outline: 2px solid var(--color-200);
    outline-offset: 2px;
}

.comment-form-comment {
    order: 2;
}

.comment-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    order: 1;
}

@media screen and (max-width: 40rem) {
    .comment-form-fields {
        grid-template-columns: 1fr;
    }
}

.comment-form-author,
.comment-form-email {
    margin: 0;
}

.comment-form-cookies-consent {
    font-size: 0.875rem;
}

.comment-form-cookies-consent label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: normal;
}

.comment-form-cookies-consent input[type="checkbox"] {
    margin-block-start: 0.2rem;
    flex-shrink: 0;
}

.form-submit {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    order: 3;
}

.form-submit .is-primary {
    background-color: var(--color-600);
    border-color: var(--color-600);
    color: var(--color-50);
}

.form-submit .is-primary:hover,
.form-submit .is-primary:focus {
    background-color: var(--color-700);
    border-color: var(--color-700);
    color: var(--color-50);
}

.form-submit .is-primary:active {
    background-color: var(--color-800);
    border-color: var(--color-800);
    color: var(--color-50);
}

.form-submit .is-primary:disabled,
.form-submit .is-primary[aria-disabled=true] {
    opacity: 0.5;
}

/* Textarea with embedded OwO toolbar */
.textarea-wrapper {
    border: 0.0625rem solid var(--color-300);
    border-radius: var(--radius-small);
    background: var(--color-50);
    position: relative;
}

.textarea-wrapper:focus-within {
    outline: 2px solid var(--color-200);
    outline-offset: 2px;
}

.textarea-wrapper textarea {
    border: none !important;
    border-radius: var(--radius-small) var(--radius-small) 0 0 !important;
    outline: none !important;
    background: transparent !important;
    resize: vertical;
}

.textarea-toolbar {
    padding: 0.25rem 0.5rem;
    border-block-start: 0.0625rem solid var(--color-200);
    background: var(--color-50);
    border-radius: 0 0 var(--radius-small) var(--radius-small);
    position: relative;
}

.error-message {
    display: block;
    font-size: 0.75em;
    color: oklch(55% 0.2 25);
    margin-block-start: 0.25rem;
}

.form-message {
    margin-block-start: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875em;
    border-radius: var(--radius-small);
}

.form-message:empty {
    display: none;
}

.form-message.success {
    background-color: color-mix(in srgb, oklch(60% 0.15 145), transparent 85%);
    color: oklch(35% 0.1 145);
}

.form-message.error {
    background-color: color-mix(in srgb, oklch(55% 0.2 25), transparent 85%);
    color: oklch(40% 0.15 25);
}

/* =============================================
   Entry summary (excerpt) — blockquote style
   matching monobase .entry-summary
   ============================================= */
.entry-summary {
    color: var(--color-500);
    font-size: 1.25em;
    line-height: 1.6;
    font-style: italic;
    font-weight: 500;
    border-inline-start-width: 0.25rem;
    border-inline-start-style: solid;
    border-inline-start-color: var(--color-200);
    padding-inline-start: 1em;
}

/* Images in content area — covers both markdown and richtext */
.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-block: 1em;
}

/* Inline code — MDN-inspired highlight, adapted to Monobase */
.entry-content :where(:not(pre) > code) {
    font-family: "JetBrains Mono Inline", "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--inline-code-color);
    background-color: var(--inline-code-bg);
    border-radius: 0.25rem;
    padding: 0.125em 0.25em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.entry-content :where(:not(pre) > code)::before,
.entry-content :where(:not(pre) > code)::after {
    content: none;
}

/* Code blocks use the same self-hosted code font as inline code. */
.entry-content :where(pre, pre code, .codehilite, .codehilite code) {
    font-family: "JetBrains Mono Inline", "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
}

/* Sidebar posts list item styling — grid layout matching monobase */
.sidebar-posts .post-item,
.sidebar-posts .post-item.has-date {
    grid-template-areas:
        "post-list-title post-list-meta"
        "post-list-description post-list-meta";
    padding-inline-end: 2.5rem;
}

.sidebar-posts .post-item .post-badge {
    position: absolute;
    inset: 0 0.75rem 0 auto;
    display: flex;
    align-items: center;
    font-size: 0.625rem;
    color: var(--color-300);
    pointer-events: none;
}

.sidebar-posts .post-item .post-badge .mb-icon {
    position: static;
    height: auto;
}

.sidebar-posts .post-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-posts .post-description {
    -webkit-line-clamp: 1;
    line-clamp: 1;
}

.sidebar-posts .post-meta {
    grid-area: post-list-meta;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.sidebar-posts .post-date {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--color-400);
    white-space: nowrap;
}

.sidebar-posts .post-views {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    font-size: 0.675rem;
    color: var(--color-300);
    white-space: nowrap;
}

.sidebar-posts .post-views .icon-eye {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Entry title link styling */
.entry-title a {
    color: inherit;
    text-decoration: none;
}

.entry-title a:hover {
    text-decoration: underline;
    text-decoration-style: dashed;
}

/* Footer card tag items */
.tag-item {
    display: inline;
}

/* Page-specific layout rules matching monobase patterns */
.template-searchresults .action-group,
.template-aboutpage .action-group,
.template-toolpage .action-group {
    display: flex;
}

@media screen and (max-width: 60rem) {
    .template-searchresults .search-box,
    .template-aboutpage .search-box,
    .template-toolpage .search-box {
        display: none;
    }
}

.template-blogpage .action-group {
    display: flex;
}

@media screen and (max-width: 60rem) {
    .template-blogpage #copy-url {
        display: none;
    }
}

/* Branding link in header */
.branding .title a {
    color: inherit;
    text-decoration: none;
}

/* Footer links in sidebar */
.footer-links-group {
    padding: 0.75rem 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
}

.footer-links-row a {
    font-size: 0.75rem;
    color: var(--color-400);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links-row a:hover {
    color: var(--color-950);
}

/* Copyright at the bottom of main content area */
.main-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.section-box {
    min-width: 0;
    max-width: min(50rem, 100%);
}

.entry-content {
    min-width: 0;
    overflow-wrap: break-word;
}

.main-copyright {
    margin-block-start: auto;
    padding-block: 2rem 1.5rem;
    padding-inline: var(--site-padding-inline);
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-300);
    line-height: 1.6;
}

.main-copyright p {
    margin: 0;
}

.main-copyright a {
    color: var(--color-400);
    text-decoration: none;
    transition: color var(--transition);
}

.main-copyright a:hover {
    color: var(--color-700);
}

/* =============================================
   Comment code blocks — reuse monobase pre panel
   ============================================= */
.comment-content pre {
    color: var(--color-200);
    background-color: var(--color-800);
    overflow-x: auto;
    font-weight: 400;
    font-size: 0.875em;
    line-height: 1.7142857;
    border-radius: var(--radius);
    padding: 0.8571429em 1.1428571em;
    margin: 0.75em 0;
}

.comment-content pre code {
    background-color: transparent;
    border-width: 0;
    border-radius: 0;
    padding: 0;
    font-weight: inherit;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
}

.comment-content pre code::before,
.comment-content pre code::after {
    content: none;
}

.comment-inline-code {
    font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
    color: var(--color-900);
    font-weight: 600;
    font-size: 0.875em;
}

/* =============================================
   KaTeX math rendering
   ============================================= */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25em 0;
}

.katex {
    color: var(--color-950);
}

/* =============================================
   Series Folder (Collapsible) in Middle Column
   ============================================= */
.series-folder {
    /* No custom border wrapper needed, native post-item styles will render cleanly */
}

.series-summary {
    cursor: pointer;
    list-style: none; /* Hide default triangle */
    transition: background-color var(--transition);
    position: relative;
    user-select: none;
}

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

.series-summary {
    padding-inline-end: 3.5rem !important;
}

.series-summary:hover {
    background-color: var(--color-50);
}

.series-header {
    grid-area: post-list-title;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.folder-icon {
    flex-shrink: 0;
    color: var(--color-500);
}

.series-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-950);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.series-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.series-count {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--color-400);
}

.series-indicator {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-400);
    transition: transform 0.25s ease;
    font-size: 0.75rem;
}

.series-folder[open] .series-indicator {
    transform: translateY(-50%) rotate(90deg);
}
.series-folder.is-closing .series-indicator {
    transform: translateY(-50%) rotate(0deg);
}

.series-summary .post-meta {
    margin-right: 1.5rem;
}

.series-folder .sub-list {
    margin: 0;
    padding: 0;
    margin-inline-start: 0.75rem;
    padding-inline-start: 0.5rem;
    margin-block-end: 0.5rem;
}

.series-folder .sub-list .post-item {
    /* No custom inner height override */
}

/* =============================================
   Structural Blocks in StreamField
   ============================================= */

/* Alert Block */
.alert-block {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-block: 1.5rem;
    border: 1px solid transparent;
    background-color: var(--color-50);
}

/* Colors for different alert types using modern oklch */
.alert-info {
    background-color: color-mix(in srgb, oklch(55% 0.15 250), transparent 90%);
    border-color: color-mix(in srgb, oklch(55% 0.15 250), transparent 50%);
}
.alert-info .alert-icon { color: oklch(55% 0.15 250); }

.alert-success {
    background-color: color-mix(in srgb, oklch(60% 0.15 145), transparent 90%);
    border-color: color-mix(in srgb, oklch(60% 0.15 145), transparent 50%);
}
.alert-success .alert-icon { color: oklch(60% 0.15 145); }

.alert-warning {
    background-color: color-mix(in srgb, oklch(75% 0.18 70), transparent 85%);
    border-color: color-mix(in srgb, oklch(75% 0.18 70), transparent 50%);
}
.alert-warning .alert-icon { color: oklch(75% 0.18 70); }

.alert-danger {
    background-color: color-mix(in srgb, oklch(55% 0.2 25), transparent 90%);
    border-color: color-mix(in srgb, oklch(55% 0.2 25), transparent 50%);
}
.alert-danger .alert-icon { color: oklch(55% 0.2 25); }

.alert-tip {
    background-color: color-mix(in srgb, oklch(65% 0.15 100), transparent 90%);
    border-color: color-mix(in srgb, oklch(65% 0.15 100), transparent 50%);
}
.alert-tip .alert-icon { color: oklch(65% 0.15 100); }

.alert-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex-grow: 1;
    min-width: 0;
}

.alert-content > *:first-child { margin-top: 0; }
.alert-content > *:last-child { margin-bottom: 0; }

/* Collapsible Block */
.collapsible-block {
    margin-block: 1.5rem;
    border: 1px solid var(--color-200);
    border-radius: var(--radius);
    background-color: var(--color-25);
    overflow: hidden;
}

.collapsible-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-950);
    list-style: none; /* Hide default triangle */
    user-select: none;
    transition: background-color var(--transition);
}

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

.collapsible-summary:hover {
    background-color: var(--color-50);
}

.collapsible-indicator {
    color: var(--color-400);
    transition: transform var(--transition);
    display: flex;
    align-items: center;
}

.collapsible-block[open] .collapsible-indicator {
    transform: rotate(90deg);
}

.collapsible-block[open] .collapsible-summary {
    border-bottom: 1px solid var(--color-200);
    background-color: var(--color-50);
}

.collapsible-content {
    padding: 1.25rem;
    background-color: var(--color-25);
}

.collapsible-content > *:first-child { margin-top: 0; }
.collapsible-content > *:last-child { margin-bottom: 0; }

/* =============================================
   Audio Player Block
   ============================================= */
.audio-player-block {
    margin-block: 1.5rem;
    border: 1px solid var(--color-200);
    border-radius: var(--radius);
    background-color: var(--color-25, var(--color-50));
    overflow: hidden;
}

.audio-player-title {
    padding: 0.75rem 1.25rem 0;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-700);
    line-height: 1.4;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
}

/* Play / Pause button */
.audio-play-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background-color: var(--color-600);
    color: var(--color-50);
    cursor: pointer;
    transition: background-color var(--transition);
    padding: 0;
}

.audio-play-btn:hover {
    background-color: var(--color-700);
}

.audio-play-btn:active {
    background-color: var(--color-800);
}

.audio-play-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.audio-play-btn svg {
    display: block;
}

/* Progress container (bar + time) */
.audio-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

/* Progress bar track */
.audio-progress-bar {
    flex: 1;
    position: relative;
    height: 6px;
    background-color: var(--color-150, var(--color-200));
    border-radius: 3px;
    cursor: pointer;
    min-width: 4rem;
}

.audio-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: var(--color-600);
    border-radius: 3px;
    pointer-events: none;
    transition: none;
}

/* Seek handle */
.audio-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-600);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.audio-progress-bar:hover .audio-progress-handle,
.audio-progress-bar:focus .audio-progress-handle {
    opacity: 1;
}

/* Expanded hit area for the progress bar */
.audio-progress-bar::before {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: 0;
    right: 0;
}

/* Time display */
.audio-time {
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    gap: 0.125rem;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-400);
    white-space: nowrap;
    user-select: none;
}

.audio-time-sep {
    opacity: 0.5;
}

/* Volume button */
.audio-volume-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius-small, 0.25rem);
    background: none;
    color: var(--color-500);
    cursor: pointer;
    padding: 0;
    transition: background-color var(--transition), color var(--transition);
}

.audio-volume-btn:hover {
    background-color: var(--color-100);
    color: var(--color-700);
}

.audio-volume-btn svg {
    display: block;
}

/* Loading state */
.audio-loading .audio-progress-bar {
    overflow: hidden;
}

.audio-loading .audio-progress-fill {
    width: 30% !important;
    animation: audio-loading-pulse 1.5s ease-in-out infinite;
}

@keyframes audio-loading-pulse {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Error state */
.audio-error {
    border-color: color-mix(in srgb, oklch(55% 0.2 25), transparent 50%);
}

.audio-error .audio-progress-fill {
    display: none;
}

.audio-error .audio-duration {
    color: oklch(55% 0.2 25);
}

/* Responsive: on very small screens, hide volume button */
@media screen and (max-width: 28rem) {
    .audio-volume-btn {
        display: none;
    }
}

