:root {
    --max-width: 1100px;
    --accent: #2b6cb0;
    --muted: #718096;
    --card-radius: 12px;
    --gap: 16px;
    --bg: #f7fafc;
    --text: #1a202c;
    --card-bg: #fff;
    --card-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    --chip-bg: #f3f5f7;
    --chip-text: #293036;
    --link-color: #1a73e8; /* default link color */
    --link-decoration-color: #1a73e8; /* underline color */
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.45;
}

/* Dark theme */
html[data-theme="dark"] {
    --bg: #1a202c;
    --text: #edf2f7;
    --accent: #63b3ed;
    --muted: #a0aec0;
    --card-bg: #2d3748;
    --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    --chip-bg: #f3f5f7;
    --chip-text: #293036;
    --link-color: #8ab4f8;
    --link-decoration-color: #8ab4f8;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-color: var(--link-decoration-color); /* theme-aware underline */
    text-underline-offset: 2px;
}

a:hover {
    opacity: 0.8;
}

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 8px 12px;
    background: #000;
    color: #fff;
    border-radius: 6px;
    margin: 8px;
    z-index: 999;
}

/* Header */
.site-header {
    width: 100%;
    max-width: var(--max-width);
    margin-bottom: 18px;
    padding: 8px 12px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* header actions layout */
.header-left { display:flex; flex-direction:column; }
.header-actions { display:flex; align-items:center; gap:8px; }

.site-title {
    margin: 0;
    font-size: 1.25rem
}

.site-title a {
    color: inherit;
    text-decoration: none
}

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

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
}

.theme-toggle a,
.theme-toggle a:visited,
.theme-toggle a:hover,
.theme-toggle a:active {
    text-decoration: none;
    color: inherit;
}


/* Main container */
.main-container {
    width: 100%;
    max-width: var(--max-width);
    padding: 6px;
}

/* Month & Tag pills */
.month-list, .tag-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Updated month pills */
.month-pill {
    background: var(--bg);
    color: var(--text);
    border: 1px solid rgba(15, 23, 42, 0.06);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    transition: transform 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.month-pill[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.month-pill:hover {
    transform: translateY(-2px);
    background: rgba(15, 23, 42, 0.1); /* stronger than 0.05 for light theme */
}

html[data-theme="dark"] .month-pill:hover {
    background: rgba(255, 255, 255, 0.1); /* subtle for dark theme */
}

html[data-theme="dark"] .month-pill[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

/* Tag pills */
.tag-pill {
    background: var(--card-bg);
    border: 1px solid rgba(15, 23, 42, 0.06);
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--muted);
    transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.tag-pill:hover {
    transform: translateY(-2px);
}

.tag-pill[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

/* Tag badges inside card */
.tag-badge {
    display: inline-block;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    margin-left: 6px;
    font-size: 0.75rem;
    color: var(--muted);
}

.tag-pill.small {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--muted);
    border: none;
}

.tag-pill.more-tags {
    background: rgba(0, 0, 0, 0.05);
    color: var(--muted);
    font-style: italic;
}

html[data-theme="dark"] .tag-pill.more-tags {
    background: rgba(255, 255, 255, 0.08);
}

/* Clear filters button */
.clear-filters {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: rgba(170, 130, 0, 1);
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease, opacity 120ms ease;
    outline: none;
    opacity: 0;
    pointer-events: none;
}

.clear-filters.active {
    opacity: 1;
    pointer-events: auto;
}

.clear-filters:hover {
    transform: translateY(-2px);
    background: rgba(255, 215, 0, 0.2);
}

.clear-filters:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.5);
}

/* Card grid */
.card-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
    align-items: start;
    margin: 0;
    padding: 0;
}

/* Card */
.card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--card-shadow);
    transition: transform 180ms ease, box-shadow 180ms ease;
    min-height: 220px;
    height: 100%;
}

.card:focus, .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.09);
    outline: none;
}

.card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1
}

.card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--text);
}

.card p.excerpt {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    flex: 1
}

.card .meta {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--muted)
}

.card-tags {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

/* Empty state */
.empty-state {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: var(--muted);
    box-shadow: var(--card-shadow);
}

/* Post view */

.publish-btn {
    margin-left: 8px;
    padding: 4px 10px;
    font-size: 0.9rem;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.publish-btn:hover {
    background-color: #43a047;
}

.edit-btn {
    margin-left: 8px;
    padding: 4px 10px;
    font-size: 0.9rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.edit-btn:hover {
    opacity: 0.8;
}

.confirm-modal-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.confirm-modal-btn‑yes { background:#4caf50; color:white; }
.confirm-modal-btn-cancel { background:#ddd; color:#111; margin-right:8px; }
.confirm-modal { background:#fff; color:#111; }
.confirm-modal .confirm-modal-btn-cancel { background:#eee; color:#111; }
.confirm-modal .confirm-modal-btn-yes { background:#4caf50; color:white; }

.delete-btn {
    margin-left: 8px;
    padding: 4px 10px;
    font-size: 0.9rem;
    background-color: #d53939;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.delete-btn:hover {
    background-color: #af2d2d;
}

.intro-block {
    position: relative;
    border: 0;
    border-radius: 12px;
    padding: 10px;
    background: #f7fafc;
}

.intro-block-text {
    position: relative;
    z-index: 1;        /* behind the icon */
    font-size: 16px;
    text-align: justify;
}

.intro-block-text.greyed{
    color: #888888;    /* greyed out */
}

.toastui-editor-toolbar-icons {
    /* Ensures the button itself is the standard size */
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent; /* Ensure button background is clear */
}

.toastui-editor-toolbar-icons.save-image-button {
    /* Use background image property */
    background-image: url('images/save.png');
    /* Ensure the image fits nicely without repeating */
    background-size: 24px 24px; /* A common icon size within the 24px button area */
    background-repeat: no-repeat;
    /* Optional: Hide any default inner HTML/text */
    text-indent: -9999px;
    margin-top: 2px;
}

.edit-intro-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: white;
    border-radius: 4px;
    opacity: 1;
    z-index: 2;
}

.post {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 12px;
}

.post h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--text);
}

.post-header {
    display: flex;
    flex-direction: row;
    align-items: baseline;
}

.post-header button {
    width: 96px;
}

.post .post-date {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 12px
}

.post img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    display: block
}

.post p {
    margin: 0 0 12px;
    color: var(--text);
}

/* Remove unwanted focus border on post content */
.post:focus,
.post:active {
    outline: none;
}

.post-author {
    font-size: 0.8rem;
    font-style: italic;
    text-align: right;
}

.post-tags {
    margin: 8px 0 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-tags .tag-pill {
    background: rgba(100, 100, 100, 0.1);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: default;
    pointer-events: none;
    transition: none;
}

.post-content-full {
    display: flex;
    text-align: justify;
}
.post-content-full.full {
    flex: 100%;
    height: auto;
}

.post-content-two-columns {
    display: flex;
    display: -webkit-flex;
    gap: 24px;
}
.post-content-two-columns.left {
    flex: 50%;
    height: auto;
}
.post-content-two-columns.right {
    flex: 50%;
    height: auto;
}
.block-alignment-full {
    text-align: justify;
    justify-content: center;
}
.block-alignment-left {
    text-align: left;
    justify-content: left;
    -webkit-justify-content: flex-start;
}
.block-alignment-center {
    text-align: center;
    justify-content: center;
    -webkit-justify-content: center;
}
.block-alignment-right {
    text-align: right;
    justify-content: right;
    -webkit-justify-content: flex-end;
}
@media (max-width: 640px) {
    .post-content-two-columns {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
    }
}

.gallery {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
}

.gallery img {
    object-fit: cover;
    width: 100px;
    height: auto;
}

.gallery-label {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--muted);
    margin-top: 8px;
}

html[data-theme="dark"] .post-tags .tag-pill {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Back link */
.back-link {
    margin: 6px 0 24px
}

.back-link a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    box-shadow: var(--card-shadow);
    transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.back-link a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
    background: var(--accent);
    color: #fff;
}

.back-link a svg {
    vertical-align: middle;
    margin-right: 4px;
}

html[data-theme="dark"] .back-link a {
    background: var(--card-bg);
    color: var(--accent);
}

html[data-theme="dark"] .back-link a:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}


/* Footer */
.site-footer {
    width: 100%;
    max-width: var(--max-width);
    text-align: center;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.9rem
}

/* small icon button used for auth/edit/publish */
.icon-btn{
    background: var(--card-bg);
    border:1px solid rgba(15,23,42,0.06);
    padding:6px 8px;
    border-radius:8px;
    cursor:pointer;
    font-size:1rem;
}
.icon-btn:focus{ outline:2px solid var(--accent); outline-offset:2px; }

/* edit tag styling */
.tag-area {
    position: relative;
    /*max-width: 600px;*/
    width: 100%;
    margin: 0 auto;
}

.tag-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    font-size: 16px;
    border: 1px solid var(--accent);
    border-radius: var(--card-radius);
}

.suggestions {
    position: absolute;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: white;
    border: 1px solid var(--accent);
    border-radius: var(--card-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    max-height: 200px;
    overflow-y: auto;
    z-index: 20;
}

.suggest-item {
    padding: 10px 14px;
    cursor: pointer;
}

.suggest-item:hover,
.suggest-item[aria-selected="true"] {
    background: #f6f9ff;
}

.suggest-create {
    color: var(--muted);
    font-style: italic;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--chip-bg);
    color: var(--chip-text);
    border-radius: 14px;
    font-size: 14px;
}

.chip button {
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: bold;
    cursor: pointer;
}

.hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
}
/* modal */
.modal{
    position:fixed;
    inset:0;
    display:none;
    align-items:center;
    justify-content:center;
    background:rgba(0,0,0,0.35);
    z-index:1200;
}
.modal[aria-hidden="false"]{ display:flex; }
.modal-panel{
    background:var(--card-bg);
    color:var(--text);
    padding:16px;
    border-radius:12px;
    box-shadow:var(--card-shadow);
    width:min(600px,calc(100% - 40px));
}
.modal-panel.wide{ width: min(1100px, calc(100% - 32px)); }
.modal-panel h3{ margin-top:0; }
.modal label{ display:block; margin:8px 0; font-size:0.95rem; }
.modal input[type="text"], .modal input[type="password"], .modal textarea{
    width:100%; padding:8px; border-radius:6px; border:1px solid rgba(15,23,42,0.06); background:var(--card-bg); color:var(--text);
}
.modal-actions{ display:flex; gap:8px; margin-top:10px; align-items:center; }

/* btn styles (small set) */
.btn{ background:var(--accent); color:#fff; border:none; padding:8px 12px; border-radius:8px; cursor:pointer; }
.btn-secondary{ background:transparent; border:1px solid rgba(15,23,42,0.2); color:var(--text); }
.btn-ghost{ background:transparent; color:var(--muted); border:none; }
html[data-theme="dark"] .modal-panel{ background:var(--card-bg); color:var(--text); }

/* Responsive tweaks */
@media (max-width: 900px) {
    :root {
        --max-width: 900px
    }

    .site-title {
        font-size: 1.15rem
    }

    .card img {
        height: 150px
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px
    }

    .header-inner {
        flex-direction: row; /* keep title and theme toggle on the same line */
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap; /* allows subtitle to wrap below */
        gap: 6px;
    }

    .header-left {
        display: flex;
        flex-direction: column;
    }

    .subtitle {
        margin-top: 2px;
        font-size: 0.9rem;
    }

    .card-grid {
        grid-template-columns:1fr;
        gap: 12px
    }

    .card img {
        height: 200px
    }

    .card {
        min-height: unset
    }

    .post {
        padding: 16px
    }

    .post h2 {
        font-size: 1.25rem
    }
}
