:root {
    --ink: #1d1d1f;
    --muted: #6e6e73;
    --faint: #86868b;
    --blue: #0071e3;
    --blue-hover: #0077ed;
    --canvas: #f5f5f7;
    --paper: #ffffff;
    --line: rgba(0, 0, 0, 0.08);
    --nav-h: 52px;
    --radius: 18px;
    --field-h: 44px;
    --field-radius: 12px;
    --field-border: #d2d2d7;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
    --max: 1080px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    height: 100%;
}

body.cupertino {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.47;
    letter-spacing: -0.016em;
    -webkit-font-smoothing: antialiased;
}
.site-header { flex: 0 0 auto; }
.site-main { flex: 1 0 auto; }
.site-footer { flex: 0 0 auto; margin-top: auto; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--blue);
    color: #fff;
    padding: 8px 12px;
    z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
}
.nav-bar {
    max-width: var(--max);
    margin: 0 auto;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 18px;
    flex-wrap: nowrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 15px;
    font-weight: 650;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; opacity: 0.72; }
.brand .custom-logo { height: 22px; width: auto; }
.brand-mark {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    background: linear-gradient(180deg, #2c2c2e 0%, #000 100%);
}
.site-nav { flex: 0 1 auto; min-width: 0; }
.nav-list {
    display: flex;
    justify-content: flex-start;
    gap: 22px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-list a {
    color: var(--ink);
    font-size: 13px;
    opacity: 0.82;
    text-decoration: none;
}
.nav-list a:hover { opacity: 1; }
.nav-list .sub-menu { display: none; }
.nav-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}
.search-inline {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 34px;
}
.search-inline-form {
    width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: width 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
}
.search-inline.is-open .search-inline-form {
    width: 210px;
    margin-right: 6px;
    opacity: 1;
    pointer-events: auto;
}
body.cupertino .search-inline-form input[type="search"] {
    width: 210px;
    max-width: 210px;
    height: 32px;
    border: 1px solid var(--field-border);
    border-radius: 980px;
    background: #fff;
    padding: 0 14px;
    font-size: 13px;
    box-shadow: none;
}
body.cupertino .search-inline-form input[type="search"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}
.nav-account {
    margin-left: 14px;
    display: flex;
    align-items: center;
}
.icon-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ink);
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    cursor: pointer;
    border-radius: 999px;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.045); }
.menu-toggle { display: none; }
.menu-toggle span {
    display: block;
    width: 16px;
    height: 1.2px;
    background: currentColor;
    margin: 3px 0;
}
.text-login {
    border: 0;
    background: var(--blue);
    color: #fff;
    height: 30px;
    padding: 0 14px;
    border-radius: 980px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.text-login:hover { background: var(--blue-hover); }
.user-chip { position: relative; }
.user-avatar-btn {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 999px;
}
.user-avatar-btn img {
    width: 28px;
    height: 28px;
    border-radius: 999px;
}
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 168px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 8px;
    z-index: 20;
}
.user-dropdown-name {
    margin: 0;
    padding: 8px 10px 6px;
    font-size: 13px;
    font-weight: 600;
}
.user-dropdown a {
    display: block;
    padding: 8px 10px;
    color: var(--ink);
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
}
.user-dropdown a:hover { background: var(--canvas); }

.text-btn {
    border: 0;
    background: none;
    color: var(--blue);
    font: inherit;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 40px;
    padding: 0 18px;
    border-radius: 980px;
    border: 0;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-small { height: 32px; min-width: 72px; font-size: 13px; padding: 0 14px; }
.btn-block { width: 100%; }
.text-link-btn {
    border: 0;
    background: none;
    color: var(--blue);
    font: inherit;
    cursor: pointer;
    padding: 0;
}

/* Two column reading layout */
.layout {
    max-width: var(--max);
    margin: 0 auto;
    padding: 28px 20px 72px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 56px;
    align-items: start;
}
.layout-single { grid-template-columns: minmax(0, 720px); justify-content: center; }
.feed-header { margin-bottom: 8px; padding-bottom: 12px; }
.feed-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.02em;
}
.feed-desc { margin: 8px 0 0; color: var(--muted); }

.feed-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 168px;
    gap: 28px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}
.feed-title {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 650;
    letter-spacing: -0.02em;
}
.feed-title a { color: var(--ink); text-decoration: none; }
.feed-title a:hover { color: var(--blue); }
.feed-excerpt {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}
.feed-meta {
    color: var(--faint);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.feed-thumb {
    display: block;
    width: 168px;
    height: 108px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--canvas);
    flex-shrink: 0;
}
.feed-thumb img,
.feed-thumb-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.feed-thumb-fallback {
    display: block;
    background: linear-gradient(180deg, #ececf1, #d8d8de);
}

.side-card {
    background: var(--canvas);
    border-radius: var(--radius);
    padding: 18px 18px 8px;
    margin-bottom: 16px;
}
.side-card h2 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 650;
}
.side-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.side-list li { border-top: 1px solid rgba(0, 0, 0, 0.05); }
.side-list a {
    display: block;
    padding: 12px 0;
    color: var(--ink);
    text-decoration: none;
}
.side-list a:hover strong { color: var(--blue); }
.side-list strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}
.side-list span {
    display: block;
    margin-top: 4px;
    color: var(--faint);
    font-size: 12px;
}
.side-empty {
    color: var(--muted);
    font-size: 13px;
    padding-bottom: 10px;
}

/* Article */
.article { padding-top: 8px; }
.article-header { margin-bottom: 28px; }
.article-kicker {
    margin: 0 0 12px;
    color: var(--faint);
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.article-header h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.18;
    letter-spacing: -0.025em;
    font-weight: 650;
}
.lede {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 18px;
}
.article-hero {
    margin: 0 0 28px;
    border-radius: 16px;
    overflow: hidden;
}
.article-hero img { width: 100%; }
.article-body {
    font-size: 17px;
    line-height: 1.75;
    color: #333;
}
.article-body p { margin: 1.1em 0; }
.article-body h2,
.article-body h3 { letter-spacing: -0.02em; }
.article-footer { margin-top: 36px; }
.tags a {
    display: inline-block;
    margin: 0 8px 8px 0;
    padding: 4px 12px;
    border-radius: 980px;
    background: var(--canvas);
    color: var(--ink);
    font-size: 13px;
    text-decoration: none;
}
.empty { color: var(--muted); padding: 40px 0; }
.pagination { margin-top: 36px; text-align: center; }
.pagination .nav-links { display: inline-flex; gap: 8px; }
.pagination a,
.pagination span {
    display: inline-flex;
    min-width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--ink);
}
.pagination .current { background: var(--ink); color: #fff; }

.comments {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}
.comments h2 { font-size: 18px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-login-hint { margin: 20px 0 0; }
.field-block { display: block; margin-bottom: 18px; }
.field-label,
.field-block > span,
.auth-form label span,
.account-card label span,
.write-toolbar .field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
}
body.cupertino input[type="text"],
body.cupertino input[type="email"],
body.cupertino input[type="password"],
body.cupertino input[type="search"],
body.cupertino textarea,
body.cupertino .comment-form textarea,
body.cupertino .comment-form input[type="text"],
body.cupertino .comment-form input[type="email"] {
    width: 100%;
    max-width: 100%;
    height: var(--field-h);
    border: 1px solid var(--field-border);
    border-radius: var(--field-radius);
    padding: 0 14px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: #fff;
    outline: none;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.cupertino textarea,
body.cupertino .comment-form textarea {
    height: auto;
    min-height: 120px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.55;
}
body.cupertino input:focus,
body.cupertino textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}


/* Footer */
.site-footer {
    background: var(--canvas);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}
.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 24px 20px 36px;
}
.footer-eyebrow {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 650;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    list-style: none;
    margin: 0 0 18px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--line);
}
.footer-links a { color: var(--muted); }
.footer-meta p { margin: 0; }

.search-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.search-form input { min-width: 220px; }

/* Auth modal */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 80;
    display: none;
    place-items: center;
    padding: 20px;
}
.auth-overlay.is-open {
    display: grid;
}
.auth-overlay[hidden] {
    display: none !important;
}
.auth-site-title {
    margin: 4px 0 18px;
    font-size: 22px;
    letter-spacing: -0.03em;
    text-align: center;
    font-weight: 650;
}
.auth-modal {
    position: relative;
    width: min(400px, 100%);
    background: #fff;
    border-radius: 22px;
    padding: 28px 28px 32px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}
.auth-close {
    position: absolute;
    right: 12px;
    top: 10px;
    border: 0;
    background: none;
    font-size: 28px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--canvas);
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 22px;
}
.auth-tabs button {
    border: 0;
    background: transparent;
    height: 34px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    color: var(--muted);
}
.auth-tabs button.is-active {
    background: #fff;
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.auth-form h2 {
    margin: 0 0 18px;
    font-size: 24px;
    letter-spacing: -0.03em;
}
.auth-form label,
.account-card label {
    display: block;
    margin-bottom: 12px;
}
.auth-form label span,
.account-card label span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--muted);
}
.account-card textarea { min-height: 96px; }
.auth-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin: 4px 0 14px;
}
.auth-hint { color: var(--faint); font-size: 12px; margin: 0 0 14px; }
.auth-msg {
    margin: 0 0 12px;
    font-size: 13px;
    color: #c41e3a;
}
.auth-msg.is-ok { color: #248a3d; }

/* Account */
.account-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 24px 80px;
}
.account-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 36px;
}
.account-top h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.03em;
}
.account-guest {
    text-align: center;
    padding: 80px 0;
    color: var(--muted);
}
.account-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}
.account-identity {
    text-align: center;
    margin-bottom: 28px;
}
.account-identity img {
    width: 88px;
    height: 88px;
    border-radius: 999px;
    margin: 0 auto 14px;
}
.account-identity h2 {
    margin: 0;
    font-size: 20px;
}
.account-identity p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.account-nav { display: grid; gap: 4px; }
.account-nav a {
    color: var(--ink);
    text-decoration: none;
    font-size: 15px;
    padding: 6px 0;
}
.account-nav a.is-active {
    color: var(--blue);
    font-weight: 600;
}
.account-heading { margin-bottom: 22px; }
.account-heading h2 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.03em;
}
.account-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 15px;
}
.account-notice {
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}
.account-notice.is-success { background: #e8f8ed; color: #1e7a36; }
.account-notice.is-error { background: #fdecee; color: #c41e3a; }
.account-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.account-card {
    background: var(--canvas);
    border-radius: 18px;
    padding: 22px 22px 20px;
    margin: 0;
}
.account-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.account-card h3 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.02em;
}
.account-card-meta {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 14px;
}
.account-avatar-row {
    display: flex;
    gap: 14px;
    align-items: center;
}
.account-avatar-row img { border-radius: 999px; }
.account-avatar-row p { margin: 0; color: var(--muted); font-size: 14px; }
.account-comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.account-comment-list li { border-bottom: 1px solid var(--line); }
.account-comment-list a {
    display: block;
    padding: 16px 0;
    color: var(--ink);
    text-decoration: none;
}
.account-comment-list strong { display: block; margin-bottom: 4px; }
.account-comment-list span { display: block; color: var(--muted); font-size: 14px; }
.account-comment-list time { display: block; margin-top: 6px; color: var(--faint); font-size: 12px; }
.account-actions { margin: 0 0 12px; }
.account-post-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}
.account-post-row > a { flex: 1; }
.account-post-ops {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.account-post-ops a,
.account-post-ops button {
    border: 0;
    background: none;
    color: var(--blue);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.account-post-ops button { color: #c41e3a; }

.write-form { max-width: 680px; }
.write-cover { margin-bottom: 18px; }
.cover-pick {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 180px;
    border: 1px solid var(--field-border);
    border-radius: var(--field-radius);
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    color: var(--muted);
    font: inherit;
    font-size: 15px;
}
.cover-pick:hover { border-color: var(--blue); }
.cover-pick img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.write-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.write-toolbar .field-label { margin: 0; }
.write-form .wp-editor-wrap,
.write-form .wp-editor-container,
.write-form .mce-tinymce,
.write-form .tox-tinymce {
    border: 1px solid var(--field-border) !important;
    border-radius: var(--field-radius) !important;
    box-shadow: none !important;
    overflow: hidden;
}
.write-form .mce-toolbar,
.write-form .mce-top-part::before,
.write-form .tox-toolbar,
.write-form .tox-editor-header {
    background: #fff !important;
    box-shadow: none !important;
    border-bottom: 1px solid var(--field-border) !important;
}
.write-form .mce-edit-area,
.write-form iframe {
    min-height: 280px;
}
.write-form .wp-editor-tools { display: none; }
.write-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}
.btn-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}

@media (max-width: 900px) {
    .layout,
    .account-grid,
    .account-cards,
    .feed-item {
        grid-template-columns: 1fr;
    }
    .feed-thumb { width: 100%; height: 180px; }
    .menu-toggle { display: grid; }
    .site-nav {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: var(--nav-h);
        background: #fff;
        padding: 8px 20px 20px;
        border-bottom: 1px solid var(--line);
    }
    .site-header.is-open .site-nav { display: block; }
    .nav-list { flex-direction: column; gap: 0; }
    .nav-list a {
        display: block;
        padding: 14px 0;
        font-size: 22px;
        font-weight: 650;
        opacity: 1;
        border-bottom: 1px solid var(--line);
    }
    .account-identity { text-align: left; display: flex; gap: 14px; align-items: center; }
    .account-identity img { margin: 0; width: 56px; height: 56px; }
    .account-nav { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
