/* Shared layout and components. Design tokens live in theme.css. */
body {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100svh;
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

.page, .auth-page, .error-page {
    width: 100%;
    max-width: 800px;
    margin: var(--page-gap) auto;
    padding: 0 20px;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

button, input, select, textarea {
    font-family: inherit;
}

h1, h2, h3, h4, h5, h6, .page-title, .site-logo,
:where([data-view="home"]) .home-link {
    font-family: var(--font-heading);
    font-weight: 400;
}

.page-title {
    font-size: 2rem;
    letter-spacing: -0.8px;
    min-width: 0;
    line-height: 1.25;
}

.subtitle {
    font-size: 1rem;
    color: var(--muted);
    font-weight: 400;
}

.page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 44px;
    gap: 12px;
    margin-bottom: 24px;
}

.page-head > .d-flex {
    flex-wrap: wrap;
}

.page > *, .auth-page > *, .error-page > * {
    flex-shrink: 0;
}

.account-section, .page > .course-section {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.page > .pager, .account-section > .pager, .page > .course-section > .pager {
    margin-top: auto;
    padding-top: 24px;
}

@media (max-height: 800px) and (min-width: 769px) {
    :root {
        --page-gap: 24px;
    }
}

@media (max-width: 768px) {
    :root {
        --page-gap: 24px;
    }
    .page-title {
        font-size: 1.6rem;
    }
}

/* 공통 - 버튼과 카드 */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
.panel {
    border: 2px solid #000;
    border-radius: var(--frame-radius, 12px);
    padding: 16px;
    margin-bottom: 20px;
}

/* 공통 - 입력 필드와 폼 동작 */
.email-fields {
    display: flex;
    align-items: center;
    gap: 8px;
}
.email-fields .field {
    flex: 1;
    min-width: 0;
}
.email-separator {
    flex-shrink: 0;
}
.field-label {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.field {
    width: 100%;
    border: 2px solid #000;
    border-radius: var(--frame-radius);
    padding: 12px;
    font-size: .95rem;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.6;
    outline: none;
}
.field:focus {
    border-color: #000;
    outline: 1px solid #000;
}
.field::placeholder {
    color: var(--muted);
}
.field.is-invalid {
    border-color: var(--danger);
}
.field.is-invalid:focus {
    border-color: var(--danger);
    outline-color: var(--danger);
}
textarea.field {
    resize: vertical;
}
.field-group {
    margin-bottom: 16px;
}
.field-feedback {
    color: var(--danger);
    font-size: .85rem;
    margin-top: 6px;
    font-weight: 500;
}
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

@media (max-height: 800px) and (min-width: 769px) {
    .field-group {
        margin-bottom: 8px;
    }
    .page .field-label {
        margin-bottom: 4px;
    }
}

/* Home - 공통 헤더와 메뉴 */

.nav-form {
    display: inline;
    margin: 0;
}

.site-nav {
    min-height: 64px;
    flex-shrink: 0;
    padding: 18px var(--nav-pad, 40px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
    width: 100%;
    gap: 20px;
    color: var(--ink);
    font-weight: 600;
}

.site-nav > div {
    min-width: 0;
}

.site-nav :is(a, button):focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
    border-radius: 2px;
}

.site-logo {
    color: inherit;
    font-weight: 600;
    font-size: 1.15rem;
    text-decoration: none;
    letter-spacing: -0.2px;
    opacity: 1;
    transition: opacity 0.2s;
}

.site-logo:hover {
    color: inherit;
    opacity: 0.75;
}

.site-menu {
    font-size: 0.95rem;
    letter-spacing: -0.1px;
}

.site-links {
    display: flex;
    gap: var(--nav-gap, 24px);
    align-items: center;
}

.site-link {
    color: inherit;
    text-decoration: none;
    opacity: 1;
    transition: opacity 0.2s;
}

.site-link:hover {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.site-user {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    transition: opacity 0.2s, color 0.2s;
    overflow-wrap: anywhere;
}

.site-user:hover {
    color: inherit;
    text-decoration: underline;
}

.btn-logout {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    opacity: 1;
    cursor: pointer;
    transition: opacity 0.2s;
    font-size: inherit;
    font-weight: inherit;
}

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

@media (max-width: 768px) {
    .site-nav {
        --nav-pad: 20px;
        --nav-gap: 12px;
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .site-menu {
        max-width: 100%;
    }

    .site-links {
        flex-wrap: wrap;
    }
}


/* Walk - 지도와 코스 목록 */

.course-section {
    margin-top: 24px;
}

.entry-list, .account-list {
    display: flex;
    flex-direction: column;
}

.entry-list {
    gap: 0;
}

/* Talk - 게시글 목록과 상세 정보 */

.post-footer {
    padding: 0 4px 16px 4px;
    margin-bottom: 8px;
}

.author-meta {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.meta-divider {
    color: var(--line);
    margin: 0 6px;
    font-size: 0.75rem;
}

.post-card {
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    min-height: 180px;
}

.entry-link {
    display: block;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.2px;
    transition: color 0.2s ease;
}

.entry-link:hover {
    color: var(--accent);
}

.post-card, .course-text, .comment-content, .item-card {
    overflow-wrap: anywhere;
}
.entry-date {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
    text-align: right;
}

/* Talk - 추천과 더보기 메뉴 */

.btn-menu {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    padding: 2px 10px;
    height: 38px;
    border-radius: 980px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-menu:hover {
    background-color: var(--surface);
    color: var(--ink);
}

.menu {
    border-radius: 12px;
    border: 1px solid #000;
    background: var(--paper);
    box-shadow: none;
    padding: 6px;
    min-width: 130px;
    z-index: 1050;
}

.menu .dropdown-item:hover {
    color: var(--accent);
    background-color: var(--surface);
}

.menu .dropdown-item {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 500;
}

.menu .dropdown-item.text-danger:hover {
    background-color: #fff2f2;
}


/* Cart · Purchase - 주문 금액 요약 */

.summary-card {
    padding-top: 20px;
    border-top: 1px solid var(--line);
    margin-top: 28px;
}

.summary-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.summary-label {
    color: var(--muted);
    font-size: .95rem;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}


/* Error - 오류 안내 */

.error-page {
    max-width: 500px;
    text-align: center;
}

.error-code {
    font-size: 5rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 20px;
}

.error-message {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 30px;
    color: var(--ink);
}

.modal-content {
    background: var(--paper);
    border: 2px solid #000;
    border-radius: var(--frame-radius);
}
@media (max-width: 600px) {
    .page-head {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 40px;
    }
    .page-head > :last-child {
        justify-self: start;
    }
}
