/*
Theme Name: TMSSTORY Research
Theme URI: https://tmsstory.co.kr/
Author: TMSSTORY
Description: Lightweight custom research theme for TMSSTORY.
Version: 0.1.0
Requires at least: 6.0
Text Domain: tmsstory
*/

:root {
    --tms-ink: #101828;
    --tms-muted: #667085;
    --tms-line: #e4e7ec;
    --tms-soft: #f7f9fc;
    --tms-blue: #155eef;
    --tms-white: #ffffff;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--tms-ink);
    background: var(--tms-white);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans KR",
        Arial,
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
}

.tms-site-shell {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}

@media (min-width: 900px) {
    .tms-site-shell {
        padding-left: 32px;
        padding-right: 32px;
    }
}


/* ==========================================================
   TMSSTORY STANDARD CTA
   Core Button style: TMS 링크 버튼
   Lightweight internal-link card
   ========================================================== */

.wp-block-button.is-style-tms-cta {
    width: 100%;
    margin: 1.6rem 0;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link,
.wp-block-button.is-style-tms-cta .wp-element-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    width: 100%;
    min-height: 58px;

    padding: 15px 18px;

    box-sizing: border-box;

    border: 1px solid #dfe3e8;
    border-radius: 14px;

    background: #f8f9fa;
    color: #20242a !important;

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);

    font-size: 1rem;
    font-weight: 650;
    line-height: 1.45;
    text-align: left;
    text-decoration: none !important;

    transition:
        background-color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link::after,
.wp-block-button.is-style-tms-cta .wp-element-button::after {
    content: "→";

    flex: 0 0 auto;

    color: #6b7280;

    font-size: 1.2em;
    font-weight: 500;
    line-height: 1;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link:visited,
.wp-block-button.is-style-tms-cta .wp-element-button:visited {
    color: #20242a !important;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link:hover,
.wp-block-button.is-style-tms-cta .wp-block-button__link:focus,
.wp-block-button.is-style-tms-cta .wp-element-button:hover,
.wp-block-button.is-style-tms-cta .wp-element-button:focus {
    background: #f2f4f6;
    border-color: #c8ced6;

    color: #111827 !important;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);

    text-decoration: none !important;

    transform: translateY(-1px);
}

@media (max-width: 768px) {

    .wp-block-button.is-style-tms-cta {
        margin: 1.35rem 0;
    }

    .wp-block-button.is-style-tms-cta .wp-block-button__link,
    .wp-block-button.is-style-tms-cta .wp-element-button {
        min-height: 54px;

        padding: 14px 15px;

        border-radius: 12px;

        font-size: .97rem;
    }
}


/* ==========================================================
   TMS CTA V2 - ACCENT CARD
   ========================================================== */

.wp-block-button.is-style-tms-cta .wp-block-button__link,
.wp-block-button.is-style-tms-cta .wp-element-button {
    min-height: 62px;

    padding: 16px 18px 16px 20px;

    border: 1px solid #bfd4f7;
    border-radius: 14px;

    background: #f3f7fd;
    color: #14233b !important;

    box-shadow: 0 2px 6px rgba(24, 78, 160, 0.06);

    font-weight: 700;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link::after,
.wp-block-button.is-style-tms-cta .wp-element-button::after {
    content: "→";

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    border-radius: 50%;

    background: #e1ecff;
    color: #1769d2;

    font-size: 18px;
    font-weight: 700;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link:hover,
.wp-block-button.is-style-tms-cta .wp-block-button__link:focus,
.wp-block-button.is-style-tms-cta .wp-element-button:hover,
.wp-block-button.is-style-tms-cta .wp-element-button:focus {
    background: #eaf2ff;
    border-color: #8fb7ef;

    color: #0f1f36 !important;

    box-shadow: 0 5px 14px rgba(24, 78, 160, 0.10);

    transform: translateY(-1px);
}

@media (max-width: 768px) {

    .wp-block-button.is-style-tms-cta .wp-block-button__link,
    .wp-block-button.is-style-tms-cta .wp-element-button {
        min-height: 58px;
        padding: 14px 15px;
    }

    .wp-block-button.is-style-tms-cta .wp-block-button__link::after,
    .wp-block-button.is-style-tms-cta .wp-element-button::after {
        width: 29px;
        height: 29px;
        font-size: 16px;
    }
}


/* ==========================================================
   TMS CTA V3 - CENTERED CONTENT
   ========================================================== */

.wp-block-button.is-style-tms-cta .wp-block-button__link,
.wp-block-button.is-style-tms-cta .wp-element-button {
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.wp-block-button.is-style-tms-cta .wp-block-button__link::after,
.wp-block-button.is-style-tms-cta .wp-element-button::after {
    margin-left: 2px;
}


/* === TMS NATIVE H2 TOC === */

/*
 * Lightweight native TOC
 * - HTML details/summary
 * - no JavaScript
 * - closed by default
 */

.tms-toc {
    margin: 24px 0 32px;
    border: 1px solid #dce6f4;
    border-radius: 12px;
    background: #f8fafc;
    overflow: hidden;
}

.tms-toc__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    color: #17243a;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.tms-toc__summary::-webkit-details-marker {
    display: none;
}

.tms-toc__summary::marker {
    content: "";
}

.tms-toc__heading {
    display: flex;
    align-items: baseline;
    gap: 9px;
    min-width: 0;
}

.tms-toc__title {
    color: #17243a;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
}

.tms-toc__meta {
    color: #7a8798;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.tms-toc__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #edf4ff;
    color: #1769d2;
    font-size: 19px;
    font-weight: 500;
    line-height: 1;
}

.tms-toc__toggle::before {
    content: "+";
}

.tms-toc[open] .tms-toc__toggle::before {
    content: "−";
}

.tms-toc__body {
    padding: 4px 14px 14px;
    border-top: 1px solid #e6edf6;
}

.tms-toc__list {
    display: grid;
    gap: 1px;
    margin: 0;
    padding: 8px 0 0;
    list-style: none;
}

.tms-toc__item {
    margin: 0;
    padding: 0;
}

.tms-toc a.tms-toc__link,
.tms-toc a.tms-toc__link:visited {
    position: relative;
    display: block;
    padding: 7px 9px 7px 21px;
    border: 0;
    border-radius: 7px;
    box-shadow: none;
    color: #294766;
    font-size: 15px;
    font-weight: 550;
    line-height: 1.5;
    text-decoration: none !important;
}

.tms-toc a.tms-toc__link::before {
    content: "›";
    position: absolute;
    top: 7px;
    left: 8px;
    color: #1769d2;
    font-weight: 700;
}

.tms-toc a.tms-toc__link:hover,
.tms-toc a.tms-toc__link:focus {
    background: #edf4ff;
    color: #1769d2;
    text-decoration: none !important;
}

.tms-entry h2[id] {
    scroll-margin-top: 90px;
}

@media (max-width: 768px) {

    .tms-toc {
        margin: 20px 0 28px;
        border-radius: 10px;
    }

    .tms-toc__summary {
        padding: 12px 14px;
    }

    .tms-toc__title {
        font-size: 16px;
    }

    .tms-toc__meta {
        font-size: 12px;
    }

    .tms-toc__toggle {
        flex-basis: 26px;
        width: 26px;
        height: 26px;
        font-size: 18px;
    }

    .tms-toc__body {
        padding: 3px 9px 11px;
    }

    .tms-toc a.tms-toc__link,
    .tms-toc a.tms-toc__link:visited {
        padding: 6px 7px 6px 19px;
        font-size: 14px;
    }

    .tms-toc a.tms-toc__link::before {
        top: 6px;
        left: 6px;
    }
}


/* ==================================================
 * TMS Lightweight Native Search
 * ================================================== */

.tms-header__inner {
    position: relative;
}

.tms-search {
    position: relative;
    flex: 0 0 auto;
}

.tms-search > summary {
    list-style: none;
}

.tms-search > summary::-webkit-details-marker {
    display: none;
}

.tms-search__toggle {
    display: grid;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    place-items: center;
    border-radius: 50%;
    cursor: pointer;
    color: inherit;
    font-size: 25px;
    line-height: 1;
    user-select: none;
}

.tms-search__toggle:hover,
.tms-search__toggle:focus-visible {
    background: rgba(127, 127, 127, 0.10);
    outline: none;
}

.tms-search__panel {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 12px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    padding: 10px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
}

.tms-search__form {
    display: flex;
    gap: 7px;
}

.tms-search__field {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #c3c4c7;
    border-radius: 5px;
    background: #fff;
    color: #1d2327;
    font: inherit;
}

.tms-search__field:focus {
    border-color: #646970;
    outline: 1px solid #646970;
}

.tms-search__submit {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    background: #1d2327;
    color: #fff;
    font: inherit;
    font-weight: 600;
}


/* Search results */

.tms-search-page {
    padding-top: 48px;
    padding-bottom: 64px;
}

.tms-search-page__header {
    margin-bottom: 30px;
}

.tms-search-page__eyebrow {
    margin: 0 0 6px;
    color: #646970;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
}

.tms-search-page__header h1 {
    margin: 0 0 22px;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.25;
}

.tms-search-page__form {
    display: flex;
    max-width: 620px;
    gap: 8px;
}

.tms-search-page__form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    border: 1px solid #c3c4c7;
    border-radius: 5px;
    font: inherit;
}

.tms-search-page__form button {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    background: #1d2327;
    color: #fff;
    font: inherit;
    font-weight: 600;
}

.tms-search-results {
    border-top: 1px solid #dcdcde;
}

.tms-search-result {
    padding: 24px 0;
    border-bottom: 1px solid #dcdcde;
}

.tms-search-result__meta {
    display: flex;
    gap: 7px;
    margin-bottom: 7px;
    color: #646970;
    font-size: 12px;
}

.tms-search-result__title {
    margin: 0 0 8px;
    font-size: clamp(18px, 2.5vw, 23px);
    line-height: 1.4;
}

.tms-search-result__title a {
    color: inherit;
    text-decoration: none;
}

.tms-search-result__title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tms-search-result__excerpt {
    max-width: 760px;
    color: #50575e;
    font-size: 14px;
    line-height: 1.7;
}

.tms-search-pagination {
    margin-top: 32px;
}

.tms-search-pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tms-search-pagination .page-numbers {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
}

.tms-search-pagination .current {
    background: #1d2327;
    border-color: #1d2327;
    color: #fff;
}

.tms-search-empty {
    padding: 28px 0;
    border-top: 1px solid #dcdcde;
}

@media (max-width: 720px) {

    .tms-search__panel {
        position: fixed;
        top: 70px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .tms-search-page {
        padding-top: 32px;
    }

    .tms-search-page__form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }
}
