/* Locked CSS Variables */
:root {
    --bg: #0a0b10;
    --surface: #13151c;
    --surface2: #1c1f29;
    --border: rgba(255, 255, 255, 0.06);
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-glow: rgba(124, 58, 237, 0.4);
    --text: #e8e9ed;
    --muted: #7c8494;
    --success: #10b981;
    --sub-text-size: 0.72rem;
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

.page-top-anchor {
    position: absolute;
    width: 1px;
    height: 1px;
    left: 0;
    top: 0;
    pointer-events: none;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0.5rem;
    z-index: 200;
    padding: 0.5rem 1rem;
    background: var(--surface);
    color: var(--accent);
    text-decoration: underline;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.skip-link:focus,
.skip-link:focus-visible {
    left: 1rem;
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 150;
    background: var(--border);
    pointer-events: none;
}

.scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 100ms linear;
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* Navbar */
.navbar {
    height: 56px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-wrap: nowrap;
    animation: slideInFromTop 300ms ease;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-logo-icon {
    font-size: 28px;
    color: var(--accent);
}

.navbar-logo-text {
    font-family: 'DM Serif Display', serif;
    font-size: 32px;
    color: var(--text);
}

.navbar-logo-text a {
    color: inherit;
    text-decoration: none;
    font: inherit;
}

.navbar-blog-link {
    margin-left: 12px;
    padding: 0.35rem 0.75rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) {
    .navbar-blog-link:hover {
        color: var(--text);
        background: var(--surface2);
    }
}

.navbar-blog-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    gap: 20px;
}

.content-column {
    flex: 0 0 63%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 500ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar-column {
    flex: 0 0 37%;
    animation: slideInFromRight 400ms ease;
}

@keyframes slideInFromRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Editor Card */
.editor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    height: 48px;
}

.toolbar-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.font-size-adjuster {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.font-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.font-btn:hover {
    border-color: var(--accent);
}

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

.char-limit-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: 22px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
    background: white;
}

.toolbar-label {
    font-size: 0.78rem;
    color: var(--muted);
}

/* Main Textarea */
.textarea-wrapper {
    position: relative;
}

.main-textarea {
    width: 100%;
    box-sizing: border-box;
    height: 40vh;
    min-height: 240px;
    max-height: 90vh;
    padding: 1.5rem;
    padding-bottom: 2rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.9;
    color: var(--text);
    background: transparent;
    border: none;
    border-left: 3px solid var(--accent);
    border-radius: 0;
    outline: none;
    resize: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.main-textarea:focus {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px var(--accent-glow); opacity: 0.3; }
    50% { box-shadow: 0 0 20px var(--accent-glow); opacity: 0.9; }
}

.main-textarea::placeholder {
    color: rgba(107, 114, 128, 0.4);
}

/* Bottom-center drag strip — height only (see js/index.js pointer handlers) */
.resize-handle {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 7rem;
    padding: 4px 1.75rem;
    color: var(--muted);
    cursor: ns-resize;
    pointer-events: auto;
    touch-action: none;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    z-index: 10;
    user-select: none;
}

.resize-handle:hover,
.resize-handle:focus-visible {
    color: var(--accent);
    background: var(--surface2);
    outline: none;
}

.resize-handle i {
    font-size: 14px;
    pointer-events: none;
}

/* Character Limit Input */
.char-limit-input {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.input {
    padding: 0.6rem 0.75rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}

.input:focus {
    border-color: var(--accent);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-fill.danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.char-count-display {
    font-size: var(--sub-text-size);
    color: var(--muted);
    min-width: 80px;
    text-align: right;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 0.75rem 0;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.live-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 0 10px;
    margin-bottom: 6px;
}

.live-stat {
    display: flex;
    align-items: baseline;
    gap: 5px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
}

.live-stat-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--accent);
    font-family: 'DM Sans', sans-serif;
}

.live-stat-label {
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
}

.live-stat-divider {
    font-size: 18px;
    font-weight: 400;
    color: var(--border);
    margin: 0 4px;
}

.stat-updated {
    animation: colorFlash 400ms ease-out;
}

@keyframes colorFlash {
    0% { color: var(--accent); }
    100% { color: var(--text); }
}

.save-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--success);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-status.visible {
    opacity: 1;
}

/* Mobile-only textarea actions (Copy/Clear below textarea) */
.textarea-actions-mobile {
    display: none;
}

.textarea-action-btn {
    width: 40px;
    height: 40px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease, color 0.15s ease;
    padding: 0;
}

.textarea-action-btn:active {
    background: var(--accent);
    color: white;
    transform: scale(0.92);
}

/* Mobile-only Download button in toolbar */
.toolbar-download-btn {
    display: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.toolbar-download-btn:active {
    background: var(--accent);
    color: white;
}

.char-limit-icon {
    font-size: 12px;
    color: var(--muted);
    display: none;
}

/* Keywords Section */
.keywords-section {
    margin-top: 1rem;
    padding: 1rem;
    transition: margin-top 200ms ease;
}

.keywords-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.keywords-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.keywords-badge {
    font-size: var(--sub-text-size);
    color: var(--accent);
    background: var(--surface2);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

.keywords-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--surface2);
    scroll-snap-type: x mandatory;
}

.keywords-pills::-webkit-scrollbar {
    height: 4px;
}

.keywords-pills::-webkit-scrollbar-track {
    background: var(--surface2);
    border-radius: 2px;
}

.keywords-pills::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
}

.keywords-pills.expanded {
    flex-wrap: wrap;
}

.keyword-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    white-space: nowrap;
    scroll-snap-align: start;
    animation: fadeIn 0.3s ease;
}

.keyword-pill-word {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.keyword-pill-count {
    font-family: 'DM Sans', sans-serif;
    font-size: var(--sub-text-size);
    font-weight: 700;
    color: var(--accent);
    background: var(--surface);
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.placeholder-pill {
    color: var(--muted);
    font-style: italic;
}

.show-more-btn {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.show-more-btn:hover {
    background: var(--surface2);
    border-color: var(--accent);
}

.show-more-btn i {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.show-more-btn.expanded i {
    transform: rotate(180deg);
}

/* Stat Sidebar */
.stat-sidebar {
    background: var(--surface);
    border-left: 1px solid var(--accent);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.25rem;
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
}

.stat-sidebar::-webkit-scrollbar {
    width: 6px;
}

.stat-sidebar::-webkit-scrollbar-track {
    background: var(--surface2);
    border-radius: 3px;
}

.stat-sidebar::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.live-stats-label {
    font-size: var(--sub-text-size);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.active-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.stats-list {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    height: auto;
    min-height: 36px;
    position: relative;
    transition: all 0.2s ease;
}

.stat-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(124, 58, 237, 0.08);
    transition: width 0.2s ease;
}

.stat-row:hover::before {
    width: 100%;
}

.stat-row-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.stat-row-icon {
    font-size: 13px;
    color: var(--accent);
    width: 14px;
    text-align: center;
}

.stat-row-label {
    font-size: var(--sub-text-size);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-row-value {
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    transition: transform 0.15s ease;
}

.stat-row-value.updated {
    animation: valueUpdate 0.15s ease;
}

@keyframes valueUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.stat-row.active-flash {
    border-left: 3px solid var(--accent);
    animation: flashLeft 0.3s ease;
}

@keyframes flashLeft {
    0%, 100% { border-left-color: transparent; }
    50% { border-left-color: var(--accent); }
}

.stat-divider {
    height: 1px;
    background: var(--border);
}

.stat-divider:last-of-type {
    display: none;
}

/* Sidebar Actions */
.sidebar-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    overflow: visible;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
    align-items: stretch;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.35rem 0.5rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (hover: hover) {
    .action-btn:hover {
        background: var(--surface);
        border-color: var(--accent);
    }
}

.action-btn:active {
    transform: scale(0.96);
}

.action-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.action-dropdown-wrap {
    position: relative;
    min-width: 0;
}

.action-btn-dropdown {
    width: 100%;
    gap: 0.2rem;
    padding-inline: 0.35rem;
}

.action-btn-dropdown .action-btn-chevron {
    font-size: 0.58rem;
    margin-left: 0.05rem;
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.action-dropdown-wrap.is-open .action-btn-dropdown .action-btn-chevron {
    transform: rotate(180deg);
}

.sidebar-download-menu {
    left: auto;
    right: 0;
    min-width: 12rem;
}

/* Keep format labels (e.g. Markdown) on a single line */
.sidebar-download-menu .extra-dropdown-item,
.mobile-download-menu .extra-dropdown-item,
#downloadMenu .extra-dropdown-item {
    white-space: nowrap;
}

.mobile-download-wrap {
    position: relative;
    flex: 1;
}

.mobile-download-menu {
    left: auto;
    right: 0;
    bottom: calc(100% + 8px);
    top: auto;
    min-width: 10rem;
}

.mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 64px;
    background: rgba(10, 11, 16, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0 16px;
    box-sizing: border-box;
}

.mobile-action-bar .action-btn {
    flex: 1;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, transform 0.1s ease;
    padding: 0;
}

.mobile-action-bar .action-btn:active {
    color: var(--accent);
    transform: scale(0.92);
}

@media (min-width: 769px) {
    .mobile-action-bar {
        display: none;
    }
}

@media (max-width: 768px) {
    .mobile-action-bar {
        display: flex;
        position: fixed;
        bottom: 16px;
        right: 16px;
        left: auto;
        top: auto;
        width: auto;
        height: auto;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        padding: 0;
        z-index: 100;
        justify-content: flex-end;
        gap: 8px;
    }
    
    .mobile-action-bar .action-btn {
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: rgba(10, 11, 16, 0.92);
        border: 1px solid var(--border);
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }
    
    .mobile-download-wrap {
        flex: 0 0 auto;
        display: flex;
    }

    .mobile-download-wrap > .action-btn {
        flex: 0 0 auto;
        width: 48px;
    }
    
    .sidebar-actions {
        display: none;
    }
    
    .action-grid {
        display: none;
    }
}
/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    padding: 3rem 24px 1.5rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-brand {
    align-items: flex-start;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-logo i {
    color: var(--accent);
    font-size: 1.5rem;
}

@media (hover: hover) {
    .footer-logo:hover {
        color: var(--accent);
    }
}

.footer-tagline {
    font-size: var(--sub-text-size);
    color: var(--muted);
    line-height: 1.5;
    margin: 0;
}

.footer-explore {
    align-items: flex-start;
}

.footer-explore-label {
    font-size: var(--sub-text-size);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}


.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--sub-text-size);
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 4px 0;
}

.footer-link i {
    font-size: 14px;
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    .footer-link:hover {
        color: var(--accent);
        text-decoration: underline;
        text-underline-offset: 3px;
    }
    
    .footer-link:hover i {
        transform: scale(1.1);
        text-decoration: none;
    }
}

.footer-link:active {
    color: var(--accent);
}

.footer-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    text-decoration: none;
    border-radius: 4px;
}

.footer-copyright {
    font-size: var(--sub-text-size);
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}

.footer-inline-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .footer-inline-link:hover {
        color: var(--accent);
        text-decoration: underline;
        text-underline-offset: 3px;
    }
}

.footer-inline-link:active {
    color: var(--accent);
}

.footer-inline-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--accent-glow);
    animation: slideInFromBottom 0.3s ease;
}

@keyframes slideInFromBottom {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast i {
    color: var(--success);
}

.toast span {
    font-size: 0.9rem;
    color: var(--text);
}

.toast--clear i {
    color: var(--muted);
}

.toast-undo-btn {
    margin-left: 0.5rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toast-undo-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        gap: 16px;
    }
    
    .sidebar-column {
        flex: 0 0 36%;
    }
    
    .stat-row-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    body {
        /* Horizontal padding lives on .main-container so the sticky
           navbar can stretch full-width to the viewport edges. */
        overflow-x: hidden;
    }
    
    .textarea-actions-mobile {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 12px;
    }
    
    .toolbar-download-btn {
        display: flex;
    }
    
    /* Compact toolbar on mobile */
    .editor-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        width: 100%;
        height: auto;
        min-height: 44px;
        padding: 8px 0;
        gap: 8px;
        margin-bottom: 0.5rem;
    }
    
    .toolbar-title {
        font-size: 14px;
        font-weight: 500;
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .toolbar-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }
    
    .font-size-adjuster {
        gap: 4px;
    }
    
    .font-btn {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        font-size: 11px;
        min-height: 28px;
        min-width: 28px;
    }
    
    .font-label {
        font-size: 11px;
        margin: 0 2px;
    }
    
    .char-limit-toggle {
        gap: 6px;
    }
    
    .char-limit-toggle .toggle-switch {
        width: 32px;
        height: 18px;
    }
    
    .char-limit-toggle .toggle-slider {
        border-radius: 9px;
    }
    
    .char-limit-toggle .toggle-slider:before {
        height: 12px;
        width: 12px;
        left: 1px;
        bottom: 1px;
    }
    
    .char-limit-toggle input:checked + .toggle-slider:before {
        transform: translateX(14px);
    }
    
    .toolbar-label {
        font-size: 11px;
    }
    
    .navbar {
        height: 56px;
        padding: 0 16px;
    }
    
    .navbar-logo-text {
        font-size: 1.05rem;
    }
    
    .main-container {
        flex-direction: column;
        padding: 0 16px;
        gap: 1rem;
    }
    
    .content-column {
        flex: none;
        gap: 1rem;
    }
    
    .sidebar-column {
        flex: none;
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .stat-sidebar {
        border-left: none;
        border-top: 1px solid var(--accent);
    }
    
    .stats-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-row {
        flex-direction: row;
        text-align: left;
        padding: 8px 10px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: 10px;
        height: auto;
        min-height: 0;
        gap: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .stat-row:hover::before {
        display: none;
    }
    
    .stat-row:active {
        transform: scale(0.96);
        background: var(--surface);
    }
    
    .stat-row-left {
        margin-bottom: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }
    
    .stat-row-icon {
        font-size: 13px;
        color: var(--accent);
    }
    
    .stat-row-value {
        font-family: 'DM Serif Display', serif;
        font-size: 1rem;
        font-weight: 700;
    }
    
    .stat-row-label {
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }
    
    .stat-divider {
        display: none;
    }
    
    .sidebar-actions {
        display: none;
    }
    
    /* Prevent iOS Safari from auto-zooming when inputs are focused
       (requires font-size >= 16px on all focusable form fields). */
    .input,
    .modal-input {
        font-size: 16px;
    }

    .main-textarea {
        height: 30vh;
        min-height: 180px;
        max-height: 85vh;
        padding: 12px;
        padding-bottom: 1.75rem;
        font-size: 16px;
        line-height: 1.6;
        resize: none;
    }
    
    .resize-handle {
        min-width: 6rem;
        padding: 3px 1.25rem;
    }
    
    .resize-handle i {
        font-size: 14px;
    }
    
    .keywords-title {
        font-size: 0.9rem;
    }
    
    .keyword-pill {
        height: 28px;
        padding: 0.4rem 0.6rem;
    }
    
    .keyword-pill-word {
        font-size: 0.8rem;
    }
    
    .keyword-pill-count {
        font-size: 0.7rem;
        padding: 0.1rem 0.3rem;
    }
    
    /* Mobile live stats strip */
    .status-bar {
        margin-top: 16px;
        padding: 0;
    }

    .live-stats {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .live-stat {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        gap: 4px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 6px 10px;
    }

    .live-stat-divider {
        display: none;
    }

    .live-stat-value {
        font-size: 18px;
        font-weight: 700;
    }

    .live-stat-label {
        font-size: 11px;
        font-weight: 500;
    }
    
    /* Mobile Footer */
    .footer {
        padding: 32px 16px 24px;
        margin-top: 32px;
    }
    
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 28px;
        margin-bottom: 24px;
    }
    
    .footer-col {
        width: 100%;
        text-align: center;
        align-items: center;
    }
    
    .footer-brand,
    .footer-explore {
        align-items: center;
    }
    
    .footer-tagline {
        font-size: 13px;
        max-width: 280px;
    }
    
    
    .footer-bottom {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding-top: 20px;
    }
    
    .footer-links {
        justify-content: center;
        gap: 16px 20px;
    }
    
    .footer-link {
        min-height: 44px;
        min-width: 44px;
        justify-content: center;
        padding: 8px 4px;
    }
    
    .footer-copyright {
        font-size: 11px;
        text-align: center;
    }
    
    /* Minimum tap targets */
    .action-btn,
    .show-more-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Disable hover on mobile */
    @media (hover: none) {
        .keyword-pill:hover,
        .show-more-btn:hover,
        .font-btn:hover {
            color: inherit;
            background: inherit;
        }
    }
    
    /* Add active states for mobile */
    .keyword-pill:active {
        transform: scale(0.96);
    }
    
    .show-more-btn:active {
        transform: scale(0.96);
    }
    
    .show-more-btn:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
    
    
    .font-btn:active {
        transform: scale(0.96);
    }
    
    .font-btn:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
    
    .toggle-switch:active .toggle-slider {
        transform: scale(0.96);
    }
    
    .toggle-switch:focus-within .toggle-slider {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0 12px;
    }
    
    .char-limit-toggle .toolbar-label {
        display: none;
    }
    
    .char-limit-icon {
        display: inline-block;
    }
    
    /* Compact mobile footer */
    .footer {
        padding: 24px 12px 20px;
    }
    
    .footer-content {
        gap: 24px;
    }
    
    .footer-links {
        justify-content: center;
        gap: 10px;
    }

    .footer-link span {
        display: none;
    }
    
    .footer-link {
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
        background: var(--surface2);
        border: 1px solid var(--border);
    }
    
    .footer-link i {
        font-size: 15px;
    }
    
    .footer-copyright {
        font-size: 10px;
        padding: 0 8px;
    }
    
    .stats-list {
        grid-template-columns: 1fr;
    }
    
    .stat-row-value {
        font-size: 1rem;
    }
    
    .action-btn i {
        font-size: 20px;
    }
}

@media (max-width: 380px) {
    .navbar-logo-text {
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    /* Very small phones - reduced font sizes */
    .navbar-logo-text {
        font-size: 0.9rem;
    }
}

/* ============ Reduced-motion accessibility ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto !important;
    }

    .scroll-progress-bar {
        transition: none !important;
    }
}

/* ============ Extra Toolbar ============ */
.extra-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.extra-toolbar::-webkit-scrollbar { display: none; }

.extra-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px;
    height: 32px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}
.extra-btn i { font-size: 0.8rem; }
@media (hover: hover) {
    .extra-btn:hover { color: var(--text); border-color: var(--accent); background: var(--surface); }
}
.extra-btn:active { transform: scale(0.96); }
.extra-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.extra-btn-group {
    position: relative;
    flex-shrink: 0;
}

.extra-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 150px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 5px;
    z-index: 200;
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}
.extra-dropdown.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.extra-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}
.extra-dropdown-item:hover { background: var(--surface); }
.extra-dropdown-item i { color: var(--accent); font-size: 0.85rem; }

/* ============ Keyword Density Tabs ============ */
.keywords-tabs {
    display: flex;
    gap: 4px;
    margin-left: auto;
}
.keyword-tab {
    padding: 0.25rem 0.6rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.keyword-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
@media (hover: hover) {
    .keyword-tab:hover:not(.active) { border-color: var(--accent); color: var(--text); }
}

/* ============ Find & Replace Modal ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    backdrop-filter: blur(4px);
    padding: 16px;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: transform 200ms ease;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.modal-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.modal-input {
    padding: 0.6rem 0.85rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease;
}
.modal-input:focus { border-color: var(--accent); }
.modal-options {
    display: flex;
    gap: 1rem;
    padding-top: 0.25rem;
}
.modal-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.modal-checkbox input { accent-color: var(--accent); cursor: pointer; }

.modal-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 1.25rem;
    justify-content: flex-end;
}
.modal-btn {
    padding: 0.5rem 1rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}
.modal-btn.secondary { color: var(--text); background: var(--surface2); }
.modal-btn.secondary:hover { border-color: var(--accent); }
.modal-btn.primary { color: white; background: var(--accent); border-color: var(--accent); }
.modal-btn.primary:hover { opacity: 0.85; }
.modal-btn:active { transform: scale(0.96); }

/* ============ Print Styles ============ */
@media print {
    body { background: white !important; color: black !important; padding: 0 !important; }
    .navbar, .sidebar-column, .keywords-section, .footer, .toast-container,
    .mobile-action-bar, .modal-overlay, .extra-toolbar, .editor-toolbar,
    .live-stats, .status-bar, .char-limit-input, .resize-handle,
    .textarea-actions-mobile, .home-editorial { display: none !important; }
    .main-container { display: block !important; padding: 0 !important; }
    .content-column { flex: none !important; width: 100% !important; }
    .editor-card { border: none !important; padding: 0 !important; background: white !important; box-shadow: none !important; }
    .main-textarea {
        border: none !important;
        color: black !important;
        background: white !important;
        height: auto !important;
        min-height: unset !important;
        max-height: unset !important;
        padding: 0 !important;
        font-size: 12pt !important;
        resize: none !important;
    }
}

/* ============ Tools Bar ============ */
.tools-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 2px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

.tools-dropdown-wrapper {
    position: relative;
}

.tools-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 30px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

@media (hover: hover) {
    .tools-trigger-btn:hover { color: var(--text); border-color: var(--accent); }
}

.tools-trigger-btn.open {
    color: var(--text);
    border-color: var(--accent);
}

.tools-chevron {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.tools-trigger-btn.open .tools-chevron {
    transform: rotate(180deg);
}

.tools-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 215px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    padding: 5px;
    z-index: 300;
    opacity: 0;
    transform: scale(0.95) translateY(6px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.tools-panel.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.tools-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: background 0.15s ease;
}

.tools-panel-item:hover { background: var(--surface); }

.tools-panel-item > i {
    font-size: 12px;
    color: var(--accent);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.tools-panel-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tools-panel-text span {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text);
}

.tools-panel-text small {
    font-size: 0.68rem;
    color: var(--muted);
}

.tools-panel-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.tools-panel-dl {
    padding: 7px 10px;
}

.tools-panel-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    margin-bottom: 7px;
}

.tools-format-row {
    display: flex;
    gap: 5px;
}

.tools-dl-btn {
    flex: 1;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tools-dl-btn:hover { color: var(--text); border-color: var(--accent); }
.tools-dl-btn i { font-size: 0.7rem; color: var(--accent); }

/* ============ Advanced Stats Collapsible ============ */
.advanced-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: color 0.2s ease;
}

.advanced-toggle-btn:hover { color: var(--accent-light); }

.adv-chevron {
    font-size: 0.6rem;
    transition: transform 0.25s ease;
}

.advanced-toggle-btn.active .adv-chevron {
    transform: rotate(180deg);
}

.advanced-stats-section {
    display: none;
    border-top: 1px solid var(--border);
    padding-top: 2px;
    animation: fadeIn 200ms ease;
}

.advanced-stats-section.open {
    display: block;
}

/* ============ Homepage editorial (below tool) ============ */
.home-editorial {
    border-top: 1px solid var(--border);
    background: var(--bg);
    content-visibility: auto;
    contain-intrinsic-size: 1200px;
}

.home-section {
    border-top: 1px solid var(--border);
    padding: 2.5rem 1.5rem;
}

.home-section:first-child {
    border-top: none;
}

.home-section--last {
    padding-bottom: 3rem;
}

.home-section-inner {
    max-width: 48rem;
    margin: 0 auto;
}

.home-eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.65rem;
}

.home-section-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.65rem, 4vw, 2.25rem);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 1.35rem;
    letter-spacing: -0.02em;
}

.home-prose,
.home-usecases,
.home-features,
.home-why {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.home-prose p,
.home-prose-plain {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--muted);
    max-width: 65ch;
}

.home-prose p + p {
    margin-top: 0;
}

.home-steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.home-step-num {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.85rem, 4vw, 2.45rem);
    font-feature-settings: 'onum' 1;
    color: var(--accent);
    margin-bottom: 0.6rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
    display: inline-block;
    min-width: 5ch;
}

.home-step-heading {
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.home-step-body {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--muted);
    max-width: 65ch;
}

.home-usecases > div,
.home-features > div,
.home-why > div {
    margin-bottom: 0.5rem;
}

.home-usecases > div:last-child,
.home-features > div:last-child,
.home-why > div:last-child {
    margin-bottom: 0;
}

.home-subheading {
    font-family: 'DM Serif Display', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.65rem;
    line-height: 1.35;
}

.home-usecases .home-prose-plain,
.home-features .home-prose-plain,
.home-why .home-prose-plain {
    margin-top: 0;
}

.home-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.home-faq {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
}

.home-faq:last-of-type {
    margin-bottom: 0;
}

.home-faq-summary {
    list-style: none;
    cursor: pointer;
    font-family: 'DM Serif Display', serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0.65rem;
    margin: 0 -0.65rem;
    border-radius: 6px;
    line-height: 1.45;
    transition: color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) {
    .home-faq-summary:hover {
        color: var(--accent);
    }
}

.home-faq[open] .home-faq-summary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

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

.home-faq-icon {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.2s ease;
}

.home-faq[open] .home-faq-icon {
    transform: rotate(45deg);
}

.home-faq-answer {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--muted);
    max-width: 65ch;
    margin-top: 0.75rem;
}

.home-inline-link {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

@media (hover: hover) {
    .home-inline-link:hover {
        color: var(--accent);
        text-decoration-color: var(--accent);
    }
}

/* Homepage: magazine-style table of contents */
.home-contents-nav {
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    background: var(--bg);
}

@media (min-width: 768px) {
    .home-contents-nav {
        padding: 2.75rem 2.5rem;
    }
}

@media (min-width: 1024px) {
    .home-contents-nav {
        padding-left: 2.75rem;
        padding-right: 2.75rem;
    }
}

.home-contents-inner {
    max-width: 48rem;
    margin: 0 auto;
}

.home-contents-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .home-contents-label {
        margin-bottom: 1.25rem;
    }
}

.home-contents-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.home-contents-link {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    padding: 0.75rem 0;
    min-height: 44px;
    box-sizing: border-box;
    transition: color 0.2s ease;
}

@media (min-width: 640px) {
    .home-contents-link {
        padding: 0.5rem 0;
        min-height: 0;
        gap: 1rem;
    }
}

.home-contents-num {
    font-family: 'DM Serif Display', serif;
    font-size: 0.875rem;
    color: var(--muted);
    flex-shrink: 0;
    align-self: flex-start;
    padding-top: 0.15em;
}

nav[aria-label='On this page'] .tabular-nums,
nav[aria-label='On this page'] .home-contents-num {
    font-feature-settings: 'tnum', 'lnum';
}

@media (min-width: 768px) {
    .home-contents-num {
        font-size: 1rem;
    }
}

.home-contents-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.4;
    flex: 1 1 auto;
    min-width: 0;
}

@media (min-width: 768px) {
    .home-contents-title {
        font-size: 1.125rem;
    }
}

.home-contents-leader {
    display: none;
}

@media (min-width: 640px) {
    .home-contents-leader {
        display: block;
        flex: 1 1 auto;
        min-width: 2.5rem;
        max-width: 12.5rem;
        height: 0;
        margin-bottom: 0.35rem;
        align-self: center;
        border-bottom: 1px dotted var(--border);
        transition: border-color 0.2s ease;
    }
}

.home-contents-time {
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: 0.75rem;
    color: var(--muted);
    flex-shrink: 0;
    align-self: flex-start;
    padding-top: 0.2em;
    transition: color 0.2s ease;
}

@media (min-width: 640px) {
    .home-contents-time {
        font-size: 0.875rem;
    }
}

@media (hover: hover) {
    .home-contents-link:hover .home-contents-num,
    .home-contents-link:hover .home-contents-title,
    .home-contents-link:hover .home-contents-time {
        color: var(--accent);
    }

    .home-contents-link:hover .home-contents-leader {
        border-color: var(--accent);
    }
}

nav[aria-label='On this page'] a.active {
    color: var(--accent);
}

nav[aria-label='On this page'] a.active .home-contents-num,
nav[aria-label='On this page'] a.active .home-contents-title,
nav[aria-label='On this page'] a.active .home-contents-time {
    color: var(--accent);
}

nav[aria-label='On this page'] a.active .home-contents-title {
    font-weight: 500;
}

nav[aria-label='On this page'] a.active .home-contents-leader {
    border-color: var(--accent);
}

.home-lead {
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: clamp(1.05rem, 2.4vw, 1.2rem);
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: 1.1rem;
    max-width: 65ch;
}

.home-pull-quote {
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    line-height: 1.35;
    color: var(--text);
    border-left: 2px solid var(--accent);
    padding-left: 1.25rem;
    margin: 0.85rem 0 0.65rem;
    max-width: 52ch;
}

.home-section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem;
}

.home-section-divider-line {
    flex: 1;
    max-width: 12rem;
    height: 1px;
    background: var(--border);
}

.home-section-divider-mark {
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--muted);
}

.home-back-top {
    text-align: center;
    margin-top: 2rem;
}

.home-back-top-link {
    font-size: 0.88rem;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .home-back-top-link:hover {
        color: var(--accent);
    }
}

.floating-back-counter {
    position: fixed;
    bottom: 5rem;
    right: 1.25rem;
    z-index: 40;
    padding: 0.45rem 0.85rem;
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: 0.88rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .floating-back-counter:hover {
        color: var(--accent);
    }
}

@media (max-width: 520px) {
    .floating-back-counter {
        display: none;
    }
}

.first-visit-toast[hidden] {
    display: none !important;
}

.first-visit-toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(34rem, calc(100vw - 2rem));
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.first-visit-toast-text {
    margin: 0;
}

.first-visit-toast-dismiss {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 0;
}

.action-btn span.is-copied {
    color: var(--accent);
    transition: color 0.2s ease;
}

.footer-link.is-external .external-mark {
    font-size: 0.65em;
    vertical-align: super;
    margin-left: 3px;
    opacity: 0.75;
}

@media (min-width: 768px) {
    .home-section {
        padding: 3.25rem 2.5rem;
    }

    .home-section--last {
        padding-bottom: 4rem;
    }

    .home-section-title {
        margin-bottom: 1.65rem;
    }

    .home-steps {
        gap: 2.25rem;
    }

    .home-faq-summary {
        font-size: 1.15rem;
    }
}

@media (min-width: 1024px) {
    .home-section {
        padding: 4rem 4rem;
    }
}

@media (max-width: 480px) {
    .home-section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
