/*
Theme Name: Selarik
Description: Tema personal blog minimalis, terinspirasi dari tema "Logs" HTMLy. Dibuat khusus untuk selarik.net.
Author: Fani
Version: 1.0
*/

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

:root {
    --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --bg-page: #FAFAFA;
    --bg-surface: #FFFFFF;
    --text-main: #2b2b2b;
    --text-heading: #111111;
    --text-muted: #6B7280;
    --text-faint: #9CA3AF;
    --border-color: #E5E7EB;
    --border-faint: #F0F0F0;
    --link-color: #2563eb;
    --link-hover: #1d4ed8;
    --thumb-bg: #eee;
    --search-bg: #FFFFFF;
}

/* System preference (default, unless manually overridden) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-page: #15181D;
        --bg-surface: #1B1F26;
        --text-main: #D1D5DB;
        --text-heading: #F3F4F6;
        --text-muted: #9CA3AF;
        --text-faint: #6B7280;
        --border-color: #2D323C;
        --border-faint: #23272F;
        --link-color: #60A5FA;
        --link-hover: #93C5FD;
        --thumb-bg: #2D323C;
        --search-bg: #23272F;
    }
}

/* Manual override via toggle (saved in localStorage) */
:root[data-theme="dark"] {
    --bg-page: #15181D;
    --bg-surface: #1B1F26;
    --text-main: #D1D5DB;
    --text-heading: #F3F4F6;
    --text-muted: #9CA3AF;
    --text-faint: #6B7280;
    --border-color: #2D323C;
    --border-faint: #23272F;
    --link-color: #60A5FA;
    --link-hover: #93C5FD;
    --thumb-bg: #2D323C;
    --search-bg: #23272F;
}

body {
    font-size: 16px;
    line-height: 1.7em;
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

img { border: 0 none; height: auto; max-width: 100%; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    line-height: 1.3;
    margin: 0.5em 0;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

a { color: var(--link-color); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

p { margin: 1em 0; }

blockquote {
    font-style: italic;
    margin: 1em 0 1em 1em;
    border-left: 3px solid var(--border-color);
    padding-left: 1em;
    color: var(--text-muted);
}

ul, ol { padding-left: 30px; margin: 1em 0; }
ul li, ol li { margin: 0.25em 0; }

/* ---- Layout ---- */
#cover { padding: 0 0 20px 0; }

/* Sticky header bar: title + menu + search in one row */
#site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}
#site-header-inner {
    max-width: 950px;
    margin: 0 auto;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 24px;
}

#site-branding { flex: 0 0 auto; }
#site-branding a { text-decoration: none; color: var(--text-heading); }
#site-branding a:hover { text-decoration: none; color: var(--link-color); }
#site-branding h1, #site-branding h2 {
    font-size: 19px;
    font-family: var(--font-sans);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    white-space: nowrap;
}

#menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 4px;
    align-items: center;
    flex: 0 0 auto;
}
#menu-close { display: none; }

#menu { flex: 1 1 auto; min-width: 0; }
#menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
#menu ul li { padding: 0 14px 0 0; margin: 0; position: relative; }
#menu ul li:first-child { padding-left: 0; }
#menu a { text-decoration: none; font-family: var(--font-sans); font-size: 14px; font-weight: 600; color: var(--text-main); }
#menu a:hover { text-decoration: none; color: var(--link-color); }

/* Dropdown submenu (desktop) */
#menu .menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-left: 5px;
    margin-bottom: 1px;
}
#menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    z-index: 50;
    flex-direction: column;
    flex-wrap: nowrap;
}
#menu .sub-menu li { padding: 0; width: 100%; }
#menu .sub-menu a { display: block; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
#menu .sub-menu a:hover { background: var(--bg-page); }
#menu .menu-item-has-children:hover > .sub-menu,
#menu .menu-item-has-children.submenu-open > .sub-menu { display: flex; }

#menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 150;
}
#menu-overlay.is-open { display: block; }

#search-wrap { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
}
#theme-toggle:hover { color: var(--link-color); }
#theme-toggle #icon-moon { display: none; }
:root[data-theme="dark"] #theme-toggle #icon-sun { display: none; }
:root[data-theme="dark"] #theme-toggle #icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #theme-toggle #icon-sun { display: none; }
    :root:not([data-theme="light"]) #theme-toggle #icon-moon { display: block; }
}

#search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
}
#search-toggle:hover { color: var(--link-color); }

#search-form {
    display: none;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}
#search-form.is-open { display: flex; }

#search-form input[type="search"] {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 14px;
    background: var(--search-bg);
    color: var(--text-main);
    width: 160px;
}
#search-form input[type="submit"] {
    background: var(--link-color);
    border: 1px solid var(--link-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
}
#search-form input[type="submit"]:hover { background: var(--link-hover); }

/* Tagline banner — homepage only, not sticky */
#tagline-banner {
    max-width: 950px;
    margin: 0 auto;
    padding: 20px 15px 0 15px;
}
#tagline-banner p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
}

#main-wrapper {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
#main {
    max-width: 950px;
    margin: 0 auto;
    padding: 36px 15px;
    overflow: hidden;
}

#content { width: 700px; float: left; padding-right: 50px; }

.post {
    margin: 0 0 28px 0;
    overflow: hidden;
    border-bottom: 1px solid var(--border-faint);
    padding-bottom: 28px;
}
.post:last-child { border-bottom: none; }

.title-index a { border: none; color: var(--text-heading); }
.title-index a:hover { color: var(--link-color); text-decoration: none; }

.date {
    color: var(--text-faint);
    font-size: 13px;
    font-family: var(--font-sans);
    margin: 0.6em 0;
}
.date a { color: var(--text-muted); }

.teaser-body, .post-body { margin-top: 0.5em; color: var(--text-main); }
.teaser-body.has-thumb { overflow: hidden; }
.teaser-body p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.thumbnail {
    float: left;
    height: 72px;
    width: 72px;
    margin: 0 16px 5px 0;
    overflow: hidden;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-color: var(--thumb-bg);
    border-radius: 8px;
}

.pager {
    text-align: center;
    margin: 1.5em 0;
    font-size: 15px;
}
.pager .nav-previous, .pager .nav-next { display: inline-block; margin: 0 1em; }

/* single post extras */
.title-post { margin-top: 0; }
.tags { margin-top: 1.5em; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 999px;
}
.tag-pill:hover { color: var(--link-color); border-color: var(--link-color); text-decoration: none; }

/* ---- Share tools ---- */
.share-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 1.5em;
    padding-top: 1.5em;
    border-top: 1px solid var(--border-faint);
}
.share-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-right: 4px; }
.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
}
.share-btn:hover { color: var(--link-color); border-color: var(--link-color); }
.share-btn .dashicons { font-size: 16px; width: 16px; height: 16px; line-height: 16px; }

/* ---- Related posts ---- */
.related-posts { margin-top: 2.5em; padding-top: 1.5em; border-top: 1px solid var(--border-faint); }
.related-posts h3 { font-size: 16px; margin-bottom: 1em; }
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.related-card {
    display: block;
    color: var(--text-main);
    border: 1px solid var(--border-faint);
    border-radius: 10px;
    overflow: hidden;
}
.related-card:hover { border-color: var(--border-color); text-decoration: none; }
.related-thumb {
    width: 100%;
    height: 100px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-color: var(--thumb-bg);
}
.related-thumb-empty { background: linear-gradient(135deg, var(--border-faint), var(--thumb-bg)); }
.related-info { padding: 10px 12px; }
.related-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.4;
}
.related-date { display: block; margin-top: 6px; font-size: 12px; color: var(--text-faint); }
.postnav { margin-top: 2em; overflow: hidden; font-size: 15px; }
.postnav .nav-previous { float: left; }
.postnav .nav-next { float: right; }

/* ---- Sidebar ---- */
#sidebar {
    float: left;
    width: 200px;
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}
#sidebar h3 {
    color: var(--text-heading);
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 1em 0;
    padding-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#sidebar ul { list-style: none; margin: 0; padding: 0; }
#sidebar li { margin: 0.5em 0; font-size: 14px; }
.views-count { display: block; color: var(--text-faint); font-size: 12px; }
.widget { margin-bottom: 2em; }

/* ---- Footer ---- */
#social-follow-wrapper {
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
}
#social-follow {
    max-width: 950px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: center;
    gap: 12px;
}
.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.social-btn:hover { color: var(--link-color); border-color: var(--link-color); text-decoration: none; }
.social-btn .dashicons { font-size: 17px; width: 17px; height: 17px; line-height: 17px; }

#copyright-wrapper {
    margin: 0;
    font-size: 13px;
    padding: 16px 0;
}
#copyright {
    text-align: center;
    color: var(--text-faint);
    max-width: 950px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ---- Comments ---- */
#comments-area { margin-top: 3em; }

.comments-title {
    font-size: 18px;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--border-color);
}

.comment-list { list-style: none; margin: 0 0 2em 0; padding: 0; }
.comment-list ul { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 0; padding: 0 0 0 40px; }

.comment-body {
    display: flex;
    gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-faint);
    align-items: flex-start;
}

.comment-avatar { flex: 0 0 auto; }
.comment-avatar img {
    border-radius: 50%;
    display: block;
}

.comment-content-wrap { flex: 1; min-width: 0; }

.comment-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-author-name {
    font-weight: 700;
    color: var(--text-heading);
    font-size: 14px;
}

.comment-date {
    font-size: 12px;
    color: var(--text-faint);
}
.comment-date:hover { color: var(--link-color); text-decoration: none; }

.edit-link a { font-size: 12px; color: var(--text-faint); }

.comment-text p { margin: 0.5em 0; font-size: 15px; color: var(--text-main); }
.comment-text p:first-child { margin-top: 0; }

.comment-awaiting-moderation {
    font-size: 13px;
    font-style: italic;
    color: var(--text-muted);
    margin: 0.3em 0;
}

.reply { margin-top: 8px; }
.reply a {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 3px 10px;
    border-radius: 999px;
}
.reply a:hover { color: var(--link-color); border-color: var(--link-color); text-decoration: none; }

.comment-respond {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 22px;
}
.comment-reply-title { margin: 0 0 1em 0; font-size: 17px; }

.comment-form-comment textarea,
.comment-form-author input,
.comment-form-email input,
.comment-form-url input {
    width: 100%;
    border: 1px solid var(--border-color);
    background: var(--search-bg);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.comment-form-comment textarea { resize: vertical; }
.comment-form-comment textarea:focus,
.comment-form-author input:focus,
.comment-form-email input:focus,
.comment-form-url input:focus {
    outline: none;
    border-color: var(--link-color);
}

.comment-form-cookies-consent { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.form-submit input[type="submit"] {
    background: var(--link-color);
    border: 1px solid var(--link-color);
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
}
.form-submit input[type="submit"]:hover { background: var(--link-hover); }

.no-comments { color: var(--text-muted); font-size: 14px; }

/* ---- WordPress image alignment (from Classic Editor) ---- */
.post-body img,
.post-body .wp-caption { max-width: 100%; height: auto; }

.alignleft {
    float: left;
    margin: 6px 20px 12px 0;
}
.alignright {
    float: right;
    margin: 6px 0 12px 20px;
}
.aligncenter {
    display: block;
    margin: 1.2em auto;
    float: none;
}
.alignnone {
    margin: 1em 0;
}

.wp-caption.alignleft { margin: 6px 20px 12px 0; }
.wp-caption.alignright { margin: 6px 0 12px 20px; }
.wp-caption.aligncenter { margin: 1.2em auto; }
.wp-caption-text {
    font-size: 13px;
    color: var(--text-faint);
    text-align: center;
    margin-top: 6px;
}

/* clear floats after post content so following elements don't wrap awkwardly */
.post-body::after { content: ""; display: table; clear: both; }
@media all and (max-width: 1024px) {
    #site-header-inner, #main, #tagline-banner { max-width: 95%; }
    #content { width: 73%; padding-right: 5%; }
    #sidebar { width: 22%; }
}

@media all and (max-width: 640px) {
    #content { width: 100%; padding-right: 0; float: none; }
    #sidebar { width: 100%; float: none; }
    #site-header-inner { gap: 10px 16px; }

    #menu-toggle { display: flex; order: 1; }
    #site-branding { order: 2; }
    #search-wrap { order: 3; margin-left: auto; }

    #menu {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 82%;
        max-width: 300px;
        background: var(--bg-surface);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
        padding: 60px 22px 30px;
        overflow-y: auto;
        box-shadow: 2px 0 24px rgba(0,0,0,0.15);
        flex: none;
    }
    #menu.is-open { transform: translateX(0); }
    #menu ul { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; }
    #menu ul li { padding: 0; width: 100%; }
    #menu a { display: block; padding: 11px 0; font-size: 15px; border-bottom: 1px solid var(--border-faint); }

    #menu-close {
        display: flex;
        position: absolute;
        top: 16px;
        right: 16px;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-muted);
    }

    /* Sub-menu: always expanded inline in off-canvas, no dropdown/hover */
    #menu .menu-item-has-children > a::after { float: right; margin-top: 6px; }
    #menu .sub-menu {
        display: flex;
        position: static;
        flex-direction: column;
        border: none;
        box-shadow: none;
        background: none;
        padding: 0 0 0 14px;
        min-width: 0;
    }

    #search-form.is-open { width: 100%; margin-left: 0; margin-top: 10px; order: 4; flex: 1 1 100%; }
    #search-form.is-open input[type="search"] { flex: 1; }
    .related-grid { grid-template-columns: 1fr; }
}

body.menu-open { overflow: hidden; }
