/* 달빛카페 - 어두운 남색 테마 (모바일 우선) */

:root {
    --bg: #0c1630;            /* 깊은 남색 */
    --bg-top: #16244d;        /* 위쪽 남색 (배경 그라데이션) */
    --panel: #132042;         /* 카드 바탕 */
    --panel-line: #263869;    /* 카드 테두리 */
    --field: #0e1936;         /* 입력창 바탕 */
    --text: #f4efd9;          /* 크림색 글자 */
    --muted: #a9b4d3;         /* 보조 글자 */
    --gold: #f2c94c;          /* 달빛 노랑 (포인트) */
    --gold-deep: #d9a521;
    --on-gold: #0c1630;       /* 노랑 바탕 위 글자는 남색 */
    --danger: #ff9aa8;
    --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 360px);
    background-repeat: no-repeat;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] { display: none !important; }

/* 헤더 */
.site-header {
    padding: 28px 16px 8px;
    text-align: center;
}

.moon-art {
    display: block;
    width: min(78vw, 300px);
    height: auto;
    margin: 0 auto 6px;
    filter: drop-shadow(0 0 18px rgba(242, 201, 76, 0.35));
}

.site-header h1 {
    margin: 4px 0 2px;
    font-size: 2rem;
    letter-spacing: 0.04em;
    color: var(--gold);
}

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

/* 본문 */
main {
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 16px 8px;
}

.panel {
    margin: 16px 0;
    padding: 18px 16px;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 1.2rem;
    color: var(--gold);
}

input[type="search"],
input[type="text"],
textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--panel-line);
    border-radius: 10px;
}

input::placeholder,
textarea::placeholder { color: #6f7ca3; }

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

textarea { resize: vertical; min-height: 84px; }

/* 분류 버튼 */
.category-bar {
    display: flex;
    gap: 8px;
    margin: 12px 0 8px;
}

.category-btn {
    flex: 1;
    min-height: 44px;
    padding: 0 8px;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--panel-line);
    border-radius: 999px;
    cursor: pointer;
}

.category-btn[aria-pressed="true"] {
    color: var(--on-gold);
    background: linear-gradient(180deg, #ffe27a, var(--gold-deep));
    border-color: var(--gold);
}

/* 메뉴 목록 */
.menu-list,
.cart-list,
.review-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--panel-line);
}

.menu-item:last-child { border-bottom: 0; }

.menu-name { font-weight: 600; }

.menu-category {
    display: inline-block;
    margin-top: 2px;
    padding: 0 8px;
    font-size: 0.78rem;
    color: var(--gold);
    border: 1px solid rgba(242, 201, 76, 0.45);
    border-radius: 999px;
}

.menu-price {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.add-btn,
.primary-btn {
    min-height: 44px;
    padding: 0 16px;
    font: inherit;
    font-weight: 700;
    color: var(--on-gold);
    background: linear-gradient(180deg, #ffe27a, var(--gold-deep));
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.primary-btn { width: 100%; margin-top: 4px; }

.add-btn:active,
.primary-btn:active { filter: brightness(0.92); }

/* 담은 메뉴 */
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--panel-line);
}

.cart-item .cart-name { font-weight: 600; }

.cart-sub {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty button {
    width: 44px;
    height: 44px;
    font: inherit;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--panel-line);
    border-radius: 10px;
    cursor: pointer;
}

.qty-num {
    min-width: 28px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.total {
    margin: 16px 0 0;
    padding-top: 14px;
    text-align: right;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gold);
    border-top: 1px dashed var(--panel-line);
    font-variant-numeric: tabular-nums;
}

/* 후기 */
.field { margin-bottom: 12px; }

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

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

.counter {
    margin: 4px 0 0;
    text-align: right;
    font-size: 0.82rem;
    color: var(--muted);
}

.error {
    margin: 0 0 10px;
    color: var(--danger);
    font-size: 0.92rem;
}

.review-list { margin-top: 18px; }

.review-item {
    padding: 12px 0;
    border-top: 1px solid var(--panel-line);
}

.review-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.review-nick { font-weight: 700; color: var(--gold); }

.review-date { color: var(--muted); font-size: 0.82rem; }

.review-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.empty {
    margin: 10px 0 0;
    padding: 14px 0;
    text-align: center;
    color: var(--muted);
}

/* 푸터 */
.site-footer {
    padding: 20px 16px 32px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer p { margin: 2px 0; }

/* 아래에서 위로 올라오며 나타나는 애니메이션 */
@keyframes rise-up {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 첫 화면: 위에서부터 차례로 올라온다 */
.moon-art,
.site-header h1,
.tagline,
.panel {
    animation: rise-up 0.7s ease-out both;
}

.site-header h1 { animation-delay: 0.15s; }
.tagline { animation-delay: 0.3s; }
.panel:nth-child(1) { animation-delay: 0.45s; }
.panel:nth-child(2) { animation-delay: 0.6s; }
.panel:nth-child(3) { animation-delay: 0.75s; }

/* 메뉴가 그려질 때 (딜레이는 cafe.js에서 줄마다 다르게 줌) */
.menu-item { animation: rise-up 0.4s ease-out both; }

/* 새로 담은 메뉴, 새로 등록한 후기만 올라온다 */
.enter { animation: rise-up 0.4s ease-out both; }

/* 움직임을 줄여 달라고 설정한 사용자는 애니메이션을 끈다 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
    }
}

/* 화면이 넓을 때 */
@media (min-width: 640px) {
    .site-header h1 { font-size: 2.4rem; }
    .panel { padding: 22px 24px; }
}
