/*
 * 19Hole Design System v2 (#19)
 * 编辑式度假酒店风格：暖石色纸面、墨色文字、深绿品牌色，黄铜只做极少点缀。
 * 原则：不用渐变、不用卡片阴影、直角或 2–4px 圆角、1px 细线分隔、衬线标题常规字重。
 * 全站页面（index / search / course / companion）先引用本文件，页面内 <style> 只写页面布局。
 * 1. Tokens  2. Base  3. Accessibility  4. Components
 */

/* ========== 1. Tokens ========== */
:root {
  /* Color */
  --ink: #1b1f1a;              /* primary text, dark surfaces */
  --forest: #243f2f;           /* brand green: primary actions, footer */
  --forest-dark: #1a3024;
  --gold: #a8875a;             /* brass accent, used sparingly */
  --gold-light: #d9c59e;       /* brass on dark surfaces */
  --gold-text: #7a6040;        /* brass for text on light surfaces (AA) */
  --champagne: #efe7d6;
  --ivory: #f4f1ea;            /* page background: warm stone */
  --paper: #fbfaf6;            /* raised surface */
  --sand: #e9e3d6;             /* alternate section background */
  --warm-gray: #ece7dd;
  --border: #d8d1c3;
  --hairline: rgba(27,31,26,0.14);
  --dot: #9c9689;               /* middle-dot separators between inline items */
  --text: #1b1f1a;
  --muted: #5f5b52;            /* secondary text (AA on stone and paper) */
  --on-dark: #f6f2e8;
  --on-dark-muted: rgba(246,242,232,0.76);
  --danger: #a4271f;

  /* Typography: system fonts only, no web-font request */
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", Georgia, serif;
  --fs-min: 0.75rem;           /* 12px floor for any visible text */
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-display: clamp(2.2rem, 5vw, 4rem);

  /* Shape, depth, motion, layers */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --shadow-soft: none;
  --shadow-lift: 0 20px 40px -32px rgba(27,31,26,0.45);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --z-sticky: 500;
  --z-picker: 820;
  --z-modal: 900;

  /* Touch */
  --tap: 44px;                 /* minimum touch target */
}

/* ========== 2. Base ========== */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--ivory);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* clip (not hidden): hidden would make body a scroll container and break position: sticky */
  overflow-x: clip;
}
::selection { background: var(--champagne); color: var(--ink); }
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; text-decoration: none; }
p a { color: var(--forest); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
/* 16px+ keeps iOS Safari from zooming the page when a field gets focus. */
input, select, textarea { font-size: max(16px, 1em); }
img { max-width: 100%; }
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
@media (min-width: 960px) { .wrap { padding-left: max(40px, env(safe-area-inset-left)); padding-right: max(40px, env(safe-area-inset-right)); } }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ========== 3. Accessibility ========== */
/* Two-tone focus ring: the light inner ring shows on dark surfaces, the ink outer ring on light ones. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--gold-light);
}
a, button, summary, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== 4. Components ========== */

/* Line icon: inline SVG from ui-icons.js, stroke follows currentColor. Use sparingly. */
.i { display: inline-block; flex: none; width: 1em; height: 1em; vertical-align: -0.14em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Eyebrow: quiet uppercase label (only where a section genuinely needs a kicker) */
.eyebrow { display: block; margin: 0 0 10px; color: var(--muted); font-size: var(--fs-min); font-weight: 600; letter-spacing: 0.16em; line-height: 1.4; text-transform: uppercase; }
.eyebrow.on-dark { color: var(--on-dark-muted); }

/* Serif display heading */
.display { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: 0.01em; line-height: 1.3; color: var(--ink); }

/* Buttons: flat, square, solid or outlined. No gradients. */
.btn-primary, .btn-secondary, .btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 28px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary { display: flex; width: 100%; border: 1px solid var(--forest); background: var(--forest); color: var(--on-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary { min-height: var(--tap); padding: 0 20px; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
/* Kept for markup compatibility: renders as the same flat primary style. */
.btn-gold { border: 1px solid var(--forest); background: var(--forest); color: var(--on-dark); }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled), .btn-gold:hover { background: var(--forest-dark); border-color: var(--forest-dark); }
  .btn-secondary:hover { background: var(--ink); color: var(--on-dark); }
}
.btn-primary:active, .btn-secondary:active, .btn-gold:active { transform: translateY(1px); }

/* Text link with arrow: secondary actions (「查看球场 →」) */
.link-arrow { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.06em; border-bottom: 1px solid transparent; }
.link-arrow::after { content: "→"; transition: transform 0.2s ease; }
@media (hover: hover) { .link-arrow:hover::after { transform: translateX(4px); } }

/* Tag: attribute as plain text, separated by a middle dot */
.tag { display: inline; color: var(--muted); font-size: max(var(--fs-min), 0.85em); }
.tag + .tag::before { content: "·"; margin: 0 8px; color: var(--dot); }
.tag .i { display: none; }

/* Concierge band: calm sand block for the 「免费帮我推荐」 call to action */
.concierge-band {
  padding: 64px 24px;
  background: var(--sand);
  color: var(--ink);
  text-align: center;
}
.concierge-band h2 { margin: 0 0 12px; font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 400; letter-spacing: 0.02em; color: var(--ink); }
.concierge-band p { margin: 0 auto 28px; max-width: 460px; color: var(--muted); font-size: 0.95em; line-height: 1.8; text-wrap: balance; }
.concierge-band .btn-primary, .concierge-band .btn-gold { display: inline-flex; width: auto; }

/* Page header (results / course pages): light bar with a hairline */
.brand-nav { background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--hairline); }
.brand-nav .wrap { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.course-brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); color: var(--ink); font-size: 1.2em; font-weight: 700; letter-spacing: -0.02em; }
.course-brand-mark { width: 30px; height: 30px; flex: 0 0 auto; border-radius: var(--radius-sm); }
.course-brand .brand-number { color: var(--forest); }
.course-tagline { font-family: var(--serif); color: var(--muted); font-size: var(--fs-sm); letter-spacing: 0.08em; }
@media (max-width: 420px) { .course-tagline { display: none; } }

/* Sticky WeChat bar: full-width on phones, a floating reserve button on desktop */
.sticky-wechat {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--forest);
  color: var(--on-dark);
  padding: 14px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background 0.18s ease;
}
.sticky-wechat:hover, .sticky-wechat:active { background: var(--forest-dark); }
.sticky-wechat svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 960px) {
  .sticky-wechat {
    left: auto;
    right: 32px;
    bottom: 32px;
    width: auto;
    min-height: 52px;
    padding: 0 26px;
    border: 1px solid rgba(246,242,232,0.2);
    border-radius: var(--radius-sm);
    box-shadow: 0 18px 40px -18px rgba(27,31,26,0.55);
  }
}

/* Lead modal: bottom sheet on phones, centered dialog from 640px */
#lead-overlay { display: none; position: fixed; inset: 0; z-index: var(--z-modal); align-items: flex-end; justify-content: center; background: rgba(20,24,20,0.55); }
#lead-overlay.open { display: flex; animation: lead-fade 0.2s ease; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px 22px calc(24px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -12px 40px rgba(20,24,20,0.2);
  outline: none;
}
.modal-card::before { content: ""; position: absolute; top: 10px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 999px; background: var(--border); }
#lead-overlay.open .modal-card { animation: lead-sheet-up 0.28s var(--ease); }
@media (min-width: 640px) {
  #lead-overlay { align-items: center; padding: 20px; }
  .modal-card { padding: 40px 36px 32px; border-radius: var(--radius-lg); box-shadow: 0 30px 70px -20px rgba(20,24,20,0.4); }
  .modal-card::before { display: none; }
  #lead-overlay.open .modal-card { animation-name: lead-pop-in; }
}
.modal-close { position: absolute; top: 8px; right: 8px; width: var(--tap); height: var(--tap); display: grid; place-items: center; padding: 0; border: none; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer; transition: color 0.18s ease; }
.modal-close:hover { color: var(--ink); }
.modal-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.modal-card h2 { margin: 0 0 8px; padding-right: 36px; font-family: var(--serif); font-size: var(--fs-xl); font-weight: 400; letter-spacing: 0.02em; color: var(--ink); }
.modal-card label { display: block; margin: 18px 0 0; color: var(--muted); font-size: var(--fs-min); font-weight: 600; letter-spacing: 0.12em; }
.modal-card input { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--ink); font-weight: 400; letter-spacing: 0; transition: border-color 0.18s ease; }
.modal-card input:focus { outline: none; border-color: var(--ink); }
.modal-card input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
#lead-submit { margin-top: 24px; }
#lead-success { display: none; text-align: center; }
#lead-success h2 { padding-right: 0; }
.success-check { width: 52px; height: 52px; margin: 4px auto 14px; display: grid; place-items: center; border: 1px solid var(--forest); border-radius: 50%; color: var(--forest); }
.success-check svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#lead-success img { width: 160px; height: 160px; object-fit: contain; margin: 10px auto; display: block; background: var(--warm-gray); border-radius: var(--radius-sm); }
#lead-success .wechat-id { font-family: var(--serif); font-size: 1.2em; }
#copy-wechat-btn { margin-top: 10px; }
@keyframes lead-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lead-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes lead-pop-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Footer: deep green, flat. The sticky bar sits on top of the last 110px on phones. */
footer {
  padding: 56px 20px calc(110px + env(safe-area-inset-bottom));
  background: var(--forest);
  color: var(--on-dark-muted);
  text-align: center;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}
@media (min-width: 960px) { footer { padding-bottom: 56px; } }
footer strong { font-family: var(--serif); color: var(--on-dark); font-size: 1.25em; font-weight: 400; letter-spacing: 0.06em; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; margin-top: 12px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 4px; color: var(--on-dark-muted); font-size: var(--fs-min); letter-spacing: 0.14em; }
.footer-nav a:hover { color: var(--on-dark); text-decoration: underline; text-underline-offset: 4px; }
