/* ============================================================
   나나세골프장 디자인 토큰 — 라이트 럭셔리 (Blackstone 스타일)
   아이보리 · 딥그린 · 골드 · 우드톤 / 클린 프리미엄
   ============================================================ */

:root {
  /* ============ Surfaces ============ */
  --bg-page:     #F4EFE1;   /* 메인 페이지 — 따뜻한 아이보리 */
  --bg-page-2:   #EAE3D0;   /* 살짝 짙은 아이보리 (구분 섹션) */
  --bg-deep:     #F4EFE1;   /* alias for legacy refs */
  --bg-deep-2:   #EAE3D0;
  --bg-deep-3:   #DED6BD;
  --bg-card:     #FFFFFF;   /* 카드 흰색 */
  --bg-card-2:   #FBF7EC;   /* 카드 라이트 크림 */
  --bg-card-3:   #F7F1DF;
  --bg-dark:     #14110C;   /* 다크 컨테이너 (어드민 사이드바, 풋터 등) */
  --bg-dark-2:   #1F1B14;

  /* ============ Green — 프라이머리 ============ */
  --green-900: #0B1F14;
  --green-800: #142A1C;
  --green-700: #1E4029;    /* 시그니처 딥그린 */
  --green-600: #2B5A3A;
  --green-500: #3D7A50;
  --green-400: #5E9870;
  --green-300: #8FB89F;
  --green-200: #C2D8C9;
  --green-100: #E2EBE3;

  /* ============ Gold — 액센트 ============ */
  --gold-900: #5C4517;
  --gold-800: #7A5C20;
  --gold-700: #997431;
  --gold-600: #B8954E;     /* 시그니처 골드 */
  --gold-500: #C9A96A;
  --gold-400: #D8BC85;
  --gold-300: #E5CFA3;

  /* ============ Wood — 보조 액센트 ============ */
  --wood-900: #3D2D1C;
  --wood-800: #5A4226;
  --wood-700: #7A5B38;
  --wood-600: #8B6F47;
  --wood-500: #A48863;
  --wood-400: #C0A684;
  --wood-300: #D6C3A5;
  --wood-200: #E6D9C0;

  /* ============ Ink — 텍스트 ============ */
  --ink-900: #14110C;       /* 거의 검정 — 메인 헤딩 */
  --ink-800: #1F1B14;       /* 메인 본문 */
  --ink-700: #2A2620;
  --ink-600: #3D362C;
  --ink-500: #5A5044;
  --ink-400: #7A6F60;       /* 보조 텍스트 */
  --ink-300: #A39888;       /* 매우 약함 */
  --ink-200: #C9C0AF;
  --ink-100: #E6DFD0;

  /* ============ Cream — 다크 컨테이너 위 텍스트 ============ */
  --cream-50:  #FAF6E9;
  --cream-100: #F4EFE1;
  --cream-200: #E8E0CB;
  --cream-300: #D2C7AA;
  --cream-400: #ACA28A;
  --cream-500: #847D6A;
  --cream-600: #5F5A4D;

  /* ============ Status ============ */
  --status-success: #2D7A4D;
  --status-warn:    #B8800F;
  --status-danger:  #A33A2A;
  --status-info:    #2C5B7A;

  /* ============ Semantic Text ============ */
  --fg-primary:   var(--ink-900);
  --fg-secondary: var(--ink-700);
  --fg-muted:     var(--ink-500);
  --fg-faint:     var(--ink-400);
  --fg-on-deep:        var(--cream-100);
  --fg-on-deep-soft:   var(--cream-300);
  --fg-on-deep-mute:   var(--cream-500);
  --fg-accent:    var(--gold-600);

  /* ============ Borders ============ */
  --border-soft:    rgba(20, 17, 12, 0.06);
  --border-medium:  rgba(20, 17, 12, 0.12);
  --border-strong:  rgba(20, 17, 12, 0.28);
  /* legacy dark-surface borders (used by admin sidebar 등) */
  --border-on-deep-soft:   rgba(244, 239, 225, 0.08);
  --border-on-deep:        rgba(244, 239, 225, 0.16);
  --border-on-deep-strong: rgba(244, 239, 225, 0.32);
  /* legacy on-light aliases */
  --border-on-light-soft:  var(--border-soft);
  --border-on-light:       var(--border-medium);
  --border-on-light-strong:var(--border-strong);

  /* ============ Typography ============ */
  --font-display: "Noto Serif KR", "Cormorant Garamond", "Times New Roman", serif;
  --font-sans:    "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px;
  --fs-16: 16px; --fs-18: 18px; --fs-20: 20px; --fs-24: 24px; --fs-28: 28px;
  --fs-32: 32px; --fs-40: 40px; --fs-48: 48px; --fs-64: 64px; --fs-80: 80px;
  --fs-96: 96px; --fs-120: 120px;

  /* ============ Spacing ============ */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;
  --s-32: 128px; --s-40: 160px;

  /* ============ Radii ============ */
  --r-xs: 1px;  --r-sm: 2px;  --r-md: 3px;
  --r-lg: 6px;  --r-xl: 10px; --r-2xl: 16px;
  --r-pill: 999px;

  /* ============ Shadows ============ */
  --sh-1: 0 1px 2px rgba(20, 17, 12, 0.05);
  --sh-2: 0 2px 8px rgba(20, 17, 12, 0.07), 0 1px 2px rgba(20, 17, 12, 0.04);
  --sh-3: 0 8px 24px rgba(20, 17, 12, 0.10), 0 2px 6px rgba(20, 17, 12, 0.05);
  --sh-4: 0 16px 48px rgba(20, 17, 12, 0.14), 0 4px 12px rgba(20, 17, 12, 0.07);
  /* legacy dark-surface shadows */
  --sh-deep-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-deep-2: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --sh-deep-3: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  --sh-deep-4: 0 32px 80px rgba(0, 0, 0, 0.6);

  --t-fast: 120ms cubic-bezier(0.2, 0, 0, 1);
  --t-base: 220ms cubic-bezier(0.2, 0, 0, 1);
  --t-slow: 480ms cubic-bezier(0.2, 0, 0, 1);
  --t-cinema: 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-15);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(20, 17, 12, 0.16);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(20, 17, 12, 0.28); background-clip: content-box; }

/* dark surface scope (어드민 사이드바, 풋터, 좌측 위젯 등) */
.dark-scope { background: var(--bg-dark); color: var(--cream-100); }
.dark-scope ::-webkit-scrollbar-thumb { background: rgba(244,239,225,0.16); background-clip: content-box; }

.light-scope { background: var(--bg-page); color: var(--fg-primary); }

.serif { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.005em; }
.mono  { font-family: var(--font-mono); letter-spacing: 0; }

.tracking-wide { letter-spacing: 0.32em; text-transform: uppercase; }
.tracking-md   { letter-spacing: 0.18em; text-transform: uppercase; }

.hr-soft  { height: 1px; background: var(--border-soft); }
.hr-light { height: 1px; background: var(--border-soft); }

/* Animated underline for nav links */
.nav-link {
  position: relative;
  color: var(--ink-700);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 0;
  font-weight: 500;
  transition: color var(--t-fast);
}
.nav-link:hover { color: var(--ink-900); }
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--green-700);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-base);
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--green-700); }

/* On-deep nav variant (헤더가 풀블리드 히어로 위에 떠 있을 때) */
.nav-link-light { color: var(--cream-200); }
.nav-link-light:hover, .nav-link-light.active { color: var(--cream-50); }
.nav-link-light::after { background: var(--gold-500); }

/* Animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slowZoom {
  from { transform: scale(1.06); }
  to { transform: scale(1); }
}

.fade-up { animation: fadeUp 800ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.fade-in { animation: fadeIn 800ms ease-out both; }
.slow-zoom { animation: slowZoom 8s ease-out both; }

.site-menu-toggle,
.site-mobile-menu {
  display: none;
}

/* Mobile safeguards for admin, manage, member, and public pages */
.app-shell,
.app-main,
.app-page,
.app-topbar,
.app-sidebar,
.login-card {
  min-width: 0;
}

.responsive-table {
  width: 100%;
  overflow-x: auto;
}

@media (max-width: 900px) {
  html, body, #root {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
  }

  img, svg, video, canvas {
    max-width: 100%;
  }

  .login-card {
    max-width: calc(100vw - 28px) !important;
    padding: 34px 20px 28px !important;
  }

  .login-card h1 {
    font-size: 28px !important;
    line-height: 1.25 !important;
  }

  .app-shell {
    height: auto !important;
    min-height: 100vh !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
  }

  .app-main {
    width: 100% !important;
    min-width: 0 !important;
  }

  .app-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 46vh !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(244,239,225,0.12) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .app-sidebar nav {
    display: flex !important;
    gap: 4px !important;
    overflow-x: auto !important;
    padding: 10px 12px !important;
  }

  .app-sidebar nav button {
    width: auto !important;
    min-width: max-content !important;
    border-left: 0 !important;
    border-bottom: 2px solid transparent !important;
    padding: 10px 14px !important;
  }

  .app-topbar {
    min-height: auto !important;
    padding: 14px 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .app-topbar > div:last-child {
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .app-topbar input {
    min-width: 0 !important;
  }

  .app-page {
    height: auto !important;
    min-height: 0 !important;
    padding: 16px !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .app-page [style*="grid-template-columns"],
  body [style*="grid-template-columns: repeat"],
  body [style*="grid-template-columns: 1.5fr"],
  body [style*="grid-template-columns: 1.4fr"],
  body [style*="grid-template-columns: 1.2fr"] {
    grid-template-columns: 1fr !important;
  }

  .app-page [style*="font-size: 56px"],
  body [style*="font-size: 56px"] {
    font-size: 40px !important;
  }

  .app-page [style*="font-size: 40px"],
  body [style*="font-size: 40px"] {
    font-size: 32px !important;
  }

  .app-page table,
  body table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
  }

  .app-page [style*="grid-template-columns: 120px 90px"],
  .app-page [style*="grid-template-columns: 120px 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .site-header {
    height: 86px !important;
    padding: 0 22px !important;
    background: rgba(20,17,12,0.96) !important;
  }

  .site-header-inner {
    display: flex !important;
    justify-content: space-between !important;
    gap: 16px !important;
  }

  .site-nav,
  .site-actions {
    display: none !important;
  }

  .site-menu-toggle {
    width: 48px;
    height: 48px;
    display: grid !important;
    place-content: center;
    gap: 7px;
    background: transparent;
    border: 0;
    padding: 0;
  }

  .site-menu-toggle span {
    display: block;
    width: 34px;
    height: 3px;
    background: var(--cream-50);
  }

  .site-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(82vw, 380px);
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 7vh, 54px);
    background: #000;
    transform: translateX(105%);
    transition: transform 260ms cubic-bezier(0.2, 0, 0, 1);
    z-index: 90;
    box-shadow: -20px 0 60px rgba(0,0,0,0.35);
  }

  .site-mobile-menu.is-open {
    transform: translateX(0);
  }

  .site-mobile-menu button {
    background: transparent;
    border: 0;
    color: #fff;
    font-weight: 800;
    font-size: clamp(24px, 7vw, 36px);
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .site-mobile-menu .site-menu-close {
    position: absolute;
    top: 28px;
    right: 28px;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font-size: 42px;
    line-height: 1;
    font-weight: 300;
  }

  .home-hero {
    min-height: calc(100vh - 76px) !important;
    height: auto !important;
    padding-bottom: 92px !important;
  }

  .home-headline {
    left: 24px !important;
    right: 24px !important;
    top: 46% !important;
    max-width: none !important;
  }

  .home-headline h1 {
    white-space: normal !important;
    font-size: clamp(34px, 10vw, 50px) !important;
    line-height: 1.12 !important;
  }

  .home-strip {
    position: relative !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 24px 24px 104px !important;
    margin-top: 68vh !important;
  }

  .quick-widget {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    transform: none !important;
    z-index: 75 !important;
  }

  .quick-widget-panel {
    width: 100% !important;
    height: 76px !important;
    padding: 10px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    border: 0 !important;
    border-top: 1px solid rgba(244,239,225,0.16) !important;
    background: rgba(20,17,12,0.94) !important;
    overflow-x: auto !important;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.22) !important;
  }

  .quick-widget-panel > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-around !important;
    gap: 18px !important;
    width: 100% !important;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .login-card {
    padding: 28px 16px 24px !important;
  }

  .login-card h1 {
    font-size: 25px !important;
  }

  .nanase-btn {
    min-height: 42px;
  }

  body [style*="padding: 32px"],
  body [style*="padding: 40px"] {
    padding: 16px !important;
  }

  body [style*="font-size: 36px"] {
    font-size: 28px !important;
  }

  body [style*="font-size: 32px"] {
    font-size: 25px !important;
  }
}
