/* ═══════════════════════════════════════════════════════════
   Noto Cards v1.1 — Frontend Stylesheet
   Self-contained dark aesthetic. Supports text, HTML & images.
═══════════════════════════════════════════════════════════ */

/* ── Reset / Scope ─────────────────────────────────────── */
.noto-wrap *,
.noto-wrap *::before,
.noto-wrap *::after,
.noto-modal-overlay *,
.noto-modal-overlay *::before,
.noto-modal-overlay *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── CSS Variables ─────────────────────────────────────── */
:root {
    --noto-bg:           #0d0d14;
    --noto-sidebar-bg:   #12121c;
    --noto-card-bg:      #1a1a28;
    --noto-card-hover:   #1f1f30;
    --noto-border:       rgba(255,255,255,0.07);
    --noto-text:         #e8e8f0;
    --noto-text-muted:   #7878a0;
    --noto-text-dim:     #4a4a6a;
    --noto-accent:       #6c63ff;
    --noto-radius:       16px;
    --noto-radius-sm:    10px;
    --noto-shadow:       0 4px 24px rgba(0,0,0,0.4);
    --noto-shadow-hover: 0 8px 40px rgba(0,0,0,0.6);
    --noto-transition:   0.2s cubic-bezier(0.4,0,0.2,1);
    --noto-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    --noto-sidebar-w:    260px;
}

/* ── Outer Wrapper ─────────────────────────────────────── */
.noto-wrap {
    display: flex;
    min-height: 85vh;
    background: var(--noto-bg);
    color: var(--noto-text);
    font-family: var(--noto-font);
    font-size: 15px;
    line-height: 1.6;
    border-radius: var(--noto-radius);
    overflow: hidden;
    box-shadow: var(--noto-shadow);
    position: relative;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.noto-sidebar {
    width: var(--noto-sidebar-w);
    min-width: var(--noto-sidebar-w);
    background: var(--noto-sidebar-bg);
    border-right: 1px solid var(--noto-border);
    display: flex;
    flex-direction: column;
    transition: transform var(--noto-transition);
    z-index: 10;
}

.noto-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 28px 20px 20px;
    border-bottom: 1px solid var(--noto-border);
}

.noto-logo { font-size: 26px; line-height: 1; }

.noto-logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--noto-text);
}

/* ── Search ─────────────────────────────────────────────── */
.noto-search-wrap {
    position: relative;
    padding: 16px 16px 8px;
}

.noto-search {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--noto-border);
    border-radius: var(--noto-radius-sm);
    color: var(--noto-text);
    font-family: var(--noto-font);
    font-size: 13px;
    padding: 9px 36px 9px 12px;
    outline: none;
    transition: border-color var(--noto-transition), background var(--noto-transition);
}
.noto-search::placeholder { color: var(--noto-text-dim); }
.noto-search:focus {
    border-color: var(--noto-accent);
    background: rgba(108,99,255,0.08);
}
.noto-search-icon {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-25%);
    font-size: 13px;
    pointer-events: none;
    opacity: 0.5;
}

/* ── Deck Nav ────────────────────────────────────────────── */
.noto-deck-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--noto-border) transparent;
}

.noto-deck-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    border-radius: var(--noto-radius-sm);
    color: var(--noto-text-muted);
    cursor: pointer;
    font-family: var(--noto-font);
    font-size: 14px;
    padding: 9px 12px;
    text-align: left;
    transition: background var(--noto-transition), color var(--noto-transition);
    margin-bottom: 2px;
}
.noto-deck-btn:hover { background: rgba(255,255,255,0.05); color: var(--noto-text); }
.noto-deck-btn.active { background: rgba(108,99,255,0.15); color: #a29bff; }
.noto-deck-icon { font-size: 15px; flex-shrink: 0; }
.noto-deck-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.noto-deck-count {
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    flex-shrink: 0;
    color: var(--noto-text-muted);
}
.noto-deck-btn.active .noto-deck-count { background: rgba(108,99,255,0.3); color: #c5c0ff; }
.noto-no-decks { color: var(--noto-text-dim); font-size: 13px; padding: 12px; text-align: center; font-style: italic; }

/* ── Sidebar Footer ─────────────────────────────────────── */
.noto-sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--noto-border); }
.noto-total-label { font-size: 12px; color: var(--noto-text-dim); }

/* ═══════════════════════════════════════════════════════════
   MAIN AREA
═══════════════════════════════════════════════════════════ */
.noto-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ── Topbar ─────────────────────────────────────────────── */
.noto-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 18px;
    border-bottom: 1px solid var(--noto-border);
    position: sticky;
    top: 0;
    background: var(--noto-bg);
    z-index: 5;
}
.noto-topbar-left { display: flex; align-items: center; gap: 14px; }
.noto-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--noto-text);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
}
.noto-deck-title { font-size: 22px; font-weight: 700; color: var(--noto-text); letter-spacing: -0.4px; }
.noto-result-count { font-size: 13px; color: var(--noto-text-dim); }

/* ═══════════════════════════════════════════════════════════
   CARD GRID
═══════════════════════════════════════════════════════════ */
.noto-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax(260px, 1fr) );
    gap: 20px;
    padding: 28px;
    align-content: start;
}

/* ── Base Card ───────────────────────────────────────────── */
.noto-card {
    background: var(--noto-card-bg);
    border: 1px solid var(--noto-border);
    border-radius: var(--noto-radius);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    overflow: hidden;
    position: relative;
    transition:
        transform var(--noto-transition),
        box-shadow var(--noto-transition),
        background var(--noto-transition),
        border-color var(--noto-transition);
}

.noto-card:hover,
.noto-card:focus-visible {
    transform: translateY(-5px);
    background: var(--noto-card-hover);
    border-color: color-mix(in srgb, var(--card-color) 40%, transparent);
    box-shadow:
        0 12px 32px rgba(0,0,0,0.5),
        0 0 0 1px color-mix(in srgb, var(--card-color) 30%, transparent),
        0 0 40px -10px var(--card-color);
    outline: none;
}

/* ── Text-only card: colour accent stripe ────────────────── */
.noto-card-accent {
    height: 4px;
    background: var(--card-color, var(--noto-accent));
    border-radius: var(--noto-radius) var(--noto-radius) 0 0;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   IMAGE CARD
═══════════════════════════════════════════════════════════ */
.noto-card--has-image { min-height: 280px; }

/* The image panel */
.noto-card-image {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
    flex-shrink: 0;
    /* colour accent lives as a bottom gradient */
    border-bottom: 3px solid var(--card-color, var(--noto-accent));
}

/* Subtle dark vignette so the emoji is always readable */
.noto-card-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0,0,0,0.08) 0%,
        rgba(0,0,0,0.45) 100%
    );
    border-radius: 0;
}

/* Emoji badge overlaid on the image (bottom-left) */
.noto-card-emoji--overlay {
    position: absolute;
    bottom: 10px;
    left: 14px;
    font-size: 22px;
    line-height: 1;
    z-index: 2;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* Card body (shared) */
.noto-card-body {
    flex: 1;
    padding: 16px 18px 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.noto-card-top { display: flex; justify-content: flex-end; }

/* Emoji (text-only cards) */
.noto-card-emoji {
    font-size: 22px;
    line-height: 1;
}

.noto-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--noto-text);
    line-height: 1.35;
    letter-spacing: -0.2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.noto-card-excerpt {
    font-size: 13px;
    color: var(--noto-text-muted);
    line-height: 1.55;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.noto-card-excerpt--hint {
    font-style: italic;
    color: var(--noto-text-dim);
    font-size: 12px;
}

/* Card footer */
.noto-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 14px;
    gap: 8px;
}

.noto-card-deck-tag {
    background: color-mix(in srgb, var(--card-color) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--card-color) 30%, transparent);
    border-radius: 20px;
    color: color-mix(in srgb, var(--card-color) 90%, white);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.noto-card-date { font-size: 11px; color: var(--noto-text-dim); white-space: nowrap; flex-shrink: 0; }

/* ── Empty states ────────────────────────────────────────── */
.noto-empty,
.noto-filter-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: var(--noto-text-dim);
    font-size: 14px;
    text-align: center;
}
.noto-empty-icon { font-size: 48px; opacity: 0.4; }
.noto-filter-empty { padding: 60px 20px; }

/* ═══════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════ */
.noto-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.noto-modal-overlay.open { opacity: 1; pointer-events: all; }

.noto-modal {
    background: #1c1c2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
    max-width: 680px;
    width: 100%;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.93) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.noto-modal-overlay.open .noto-modal { transform: scale(1) translateY(0); }

.noto-modal-accent { height: 5px; flex-shrink: 0; border-radius: 20px 20px 0 0; }

.noto-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255,255,255,0.07);
    border: none;
    border-radius: 50%;
    color: var(--noto-text-muted);
    cursor: pointer;
    font-size: 14px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    transition: background var(--noto-transition), color var(--noto-transition);
    z-index: 2;
}
.noto-modal-close:hover { background: rgba(255,255,255,0.13); color: var(--noto-text); }

.noto-modal-inner {
    padding: 28px 32px 36px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.noto-modal-emoji { font-size: 36px; margin-bottom: 12px; }

.noto-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--noto-text);
    line-height: 1.3;
    letter-spacing: -0.4px;
    margin-bottom: 10px;
}

.noto-modal-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.noto-modal-deck-tag {
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 12px;
    border: 1px solid;
}

.noto-modal-date { font-size: 12px; color: var(--noto-text-dim); }

/* ═══════════════════════════════════════════════════════════
   RICH CONTENT — HTML typography inside modal
   Scoped to .noto-rich-content to avoid bleed.
═══════════════════════════════════════════════════════════ */
.noto-rich-content {
    font-size: 15px;
    color: var(--noto-text-muted);
    line-height: 1.8;
    word-break: break-word;
}

/* Paragraphs */
.noto-rich-content p {
    margin-bottom: 1em;
}
.noto-rich-content p:last-child { margin-bottom: 0; }

/* Headings */
.noto-rich-content h1,
.noto-rich-content h2,
.noto-rich-content h3,
.noto-rich-content h4,
.noto-rich-content h5,
.noto-rich-content h6 {
    color: var(--noto-text);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.2px;
    margin-top: 1.6em;
    margin-bottom: 0.5em;
}
.noto-rich-content h1 { font-size: 1.7em; }
.noto-rich-content h2 { font-size: 1.45em; }
.noto-rich-content h3 { font-size: 1.25em; }
.noto-rich-content h4 { font-size: 1.1em; }
.noto-rich-content h5,
.noto-rich-content h6 { font-size: 1em; }

/* Lists */
.noto-rich-content ul,
.noto-rich-content ol {
    padding-left: 1.6em;
    margin-bottom: 1em;
}
.noto-rich-content ul { list-style: disc; }
.noto-rich-content ol { list-style: decimal; }
.noto-rich-content li { margin-bottom: 0.3em; }
.noto-rich-content li:last-child { margin-bottom: 0; }
.noto-rich-content ul ul,
.noto-rich-content ol ol,
.noto-rich-content ul ol,
.noto-rich-content ol ul { margin-top: 0.3em; margin-bottom: 0.3em; }

/* Links */
.noto-rich-content a {
    color: #a29bff;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--noto-transition);
}
.noto-rich-content a:hover { color: #c5c0ff; }

/* Strong / em */
.noto-rich-content strong { color: var(--noto-text); font-weight: 700; }
.noto-rich-content em     { font-style: italic; }
.noto-rich-content s,
.noto-rich-content del    { opacity: 0.55; }

/* Inline code */
.noto-rich-content code {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.88em;
    padding: 1px 6px;
    color: #e2b857;
}

/* Code block */
.noto-rich-content pre {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85em;
    line-height: 1.65;
    overflow-x: auto;
    padding: 18px 20px;
    margin-bottom: 1em;
    color: #c8ccd4;
}
.noto-rich-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Blockquote */
.noto-rich-content blockquote {
    border-left: 3px solid var(--noto-accent);
    color: var(--noto-text-muted);
    font-style: italic;
    margin: 1.2em 0;
    padding: 10px 0 10px 20px;
}
.noto-rich-content blockquote p { margin-bottom: 0; }

/* Horizontal rule */
.noto-rich-content hr {
    border: none;
    border-top: 1px solid var(--noto-border);
    margin: 1.8em 0;
}

/* Tables */
.noto-rich-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
    font-size: 0.92em;
}
.noto-rich-content th,
.noto-rich-content td {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 9px 13px;
    text-align: left;
    vertical-align: top;
}
.noto-rich-content th {
    background: rgba(255,255,255,0.05);
    color: var(--noto-text);
    font-weight: 600;
}
.noto-rich-content tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* ═══════════════════════════════════════════════════════════
   IMAGES — both inside modal content and inline in HTML
═══════════════════════════════════════════════════════════ */

/* Any <img> inside the rich content area */
.noto-rich-content img {
    border-radius: 10px;
    display: block;
    height: auto;
    margin: 1.2em auto;
    max-width: 100%;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* WordPress-generated figure/caption from the block editor */
.noto-rich-content figure {
    margin: 1.4em 0;
}
.noto-rich-content figure img { margin: 0 auto 8px; }
.noto-rich-content figcaption {
    color: var(--noto-text-dim);
    font-size: 0.82em;
    text-align: center;
    font-style: italic;
}

/* WordPress alignment classes */
.noto-rich-content .alignleft  { float: left;  margin: 0.5em 1.2em 0.5em 0; }
.noto-rich-content .alignright { float: right; margin: 0.5em 0 0.5em 1.2em; }
.noto-rich-content .aligncenter { display: block; margin: 1em auto; }
.noto-rich-content .alignfull,
.noto-rich-content .alignwide  { max-width: 100%; width: 100%; }

/* WordPress caption block */
.noto-rich-content .wp-caption { max-width: 100%; }
.noto-rich-content .wp-caption-text {
    color: var(--noto-text-dim);
    font-size: 0.82em;
    text-align: center;
    font-style: italic;
    margin-top: 6px;
}

/* Gutenberg image block wrapper */
.noto-rich-content .wp-block-image {
    margin: 1.4em 0;
}
.noto-rich-content .wp-block-image img { margin: 0; }
.noto-rich-content .wp-block-image figcaption {
    color: var(--noto-text-dim);
    font-size: 0.82em;
    text-align: center;
    font-style: italic;
    margin-top: 6px;
}

/* Gutenberg gallery */
.noto-rich-content .wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin: 1.4em 0;
}
.noto-rich-content .wp-block-gallery figure,
.noto-rich-content .wp-block-gallery .blocks-gallery-item {
    margin: 0;
}
.noto-rich-content .wp-block-gallery img {
    margin: 0;
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
}

/* Gutenberg columns */
.noto-rich-content .wp-block-columns {
    display: flex;
    gap: 20px;
    margin: 1.4em 0;
    flex-wrap: wrap;
}
.noto-rich-content .wp-block-column { flex: 1; min-width: 200px; }

/* Clearfix for floated images */
.noto-rich-content::after { content: ''; display: table; clear: both; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .noto-sidebar {
        position: absolute;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.4);
    }
    .noto-sidebar.mobile-open { transform: translateX(0); }
    .noto-hamburger { display: block; }

    .noto-grid {
        grid-template-columns: repeat( auto-fill, minmax(220px, 1fr) );
        padding: 18px;
        gap: 14px;
    }
    .noto-topbar { padding: 16px 18px 14px; }
    .noto-deck-title { font-size: 18px; }

    .noto-modal-inner { padding: 22px 22px 28px; }
    .noto-modal-title { font-size: 20px; }

    .noto-rich-content .alignleft,
    .noto-rich-content .alignright { float: none; margin: 1em auto; }

    .noto-rich-content .wp-block-columns { flex-direction: column; }
}

@media (max-width: 480px) {
    .noto-grid { grid-template-columns: 1fr; }
    .noto-rich-content .wp-block-gallery {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* ── Scrollbars ──────────────────────────────────────────── */
.noto-main::-webkit-scrollbar,
.noto-deck-nav::-webkit-scrollbar,
.noto-modal-inner::-webkit-scrollbar { width: 4px; }
.noto-main::-webkit-scrollbar-track,
.noto-deck-nav::-webkit-scrollbar-track,
.noto-modal-inner::-webkit-scrollbar-track { background: transparent; }
.noto-main::-webkit-scrollbar-thumb,
.noto-deck-nav::-webkit-scrollbar-thumb,
.noto-modal-inner::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* ── Card stagger animation ──────────────────────────────── */
@keyframes notoCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.noto-card { animation: notoCardIn 0.35s ease both; }
.noto-card:nth-child(1)  { animation-delay: 0.03s; }
.noto-card:nth-child(2)  { animation-delay: 0.06s; }
.noto-card:nth-child(3)  { animation-delay: 0.09s; }
.noto-card:nth-child(4)  { animation-delay: 0.12s; }
.noto-card:nth-child(5)  { animation-delay: 0.15s; }
.noto-card:nth-child(6)  { animation-delay: 0.18s; }
.noto-card:nth-child(7)  { animation-delay: 0.21s; }
.noto-card:nth-child(8)  { animation-delay: 0.24s; }
.noto-card:nth-child(9)  { animation-delay: 0.27s; }
.noto-card:nth-child(10) { animation-delay: 0.30s; }
