/* ===========================================================================
   policy-site
   Light theme only. Layout follows design-reference/terms-design-reference.png:
   a centred, generously spaced text column, a bold document title on the left
   of the header row, and bordered dropdowns on the right.
   =========================================================================== */

:root {
  --max-width: 960px;
  --page-pad: 40px;

  --bg: #ffffff;
  --text: #333333;
  --text-strong: #1a1a1a;
  --text-muted: #8a8a8a;
  --link: #2b6cb0;

  --border: #e0e0e0;
  --divider: #f0f0f0;
  --hover: #f5f5f5;
  --selected: #f0f0f0;

  --radius: 5px;
  --radius-lg: 6px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
          "Apple SD Gothic Neo", "Noto Sans KR", Roboto, sans-serif;

  --body-size: 14px;
  --body-line: 1.78;
  --control-height: 36px;
}

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

html {
  /* Stop iOS from re-scaling text when the device is rotated. */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--body-size);
  line-height: var(--body-line);
  /* Long unbroken strings (URLs, hashes) must never widen the page. */
  overflow-wrap: break-word;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px var(--page-pad) 96px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
  z-index: 50;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------------------
   Document tabs
   --------------------------------------------------------------------------- */

.doc-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--divider);
}

.tab {
  appearance: none;
  border: 0;
  background: none;
  margin: 0;
  /* 44px keeps the touch target at the Apple HIG minimum on every viewport. */
  min-height: 44px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-current="true"] {
  color: var(--text-strong);
  font-weight: 700;
  border-bottom-color: var(--text-strong);
}

.tab:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------------------
   Header: title + dropdowns
   --------------------------------------------------------------------------- */

.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  /* Reference layout keeps a wide gap between the header row and the first
     article heading, whose own top margin is suppressed. */
  margin-bottom: 40px;
}

.doc-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.doc-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   Dropdown (custom listbox)
   --------------------------------------------------------------------------- */

.dropdown {
  position: relative;
}

.dropdown-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--control-height);
  min-width: 104px;
  padding: 0 10px 0 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.dropdown-toggle:hover {
  border-color: #cfcfcf;
}

.dropdown-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

.dropdown-toggle[aria-expanded="true"] {
  border-color: #c4c4c4;
}

.dropdown-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-chevron {
  flex: none;
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.dropdown-toggle[aria-expanded="true"] .dropdown-chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 100%;
  max-height: 296px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.09);
}

.dropdown-menu[hidden] {
  display: none;
}

.dropdown-option {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}

.dropdown-option:hover,
.dropdown-option.is-active {
  background: var(--hover);
}

.dropdown-option[aria-selected="true"] {
  background: var(--selected);
  font-weight: 600;
  color: var(--text-strong);
}

/* ---------------------------------------------------------------------------
   Document body
   --------------------------------------------------------------------------- */

.doc-content {
  /* Korean legal text reads best when it wraps on word boundaries. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

.doc-content:focus {
  outline: none;
}

.doc-content > :first-child {
  margin-top: 0;
}

/* Document title, which each source file repeats above its body ("이용약관",
   "GOLF SUPER CREW TERMS OF SERVICE"). The header already names the document at
   24px, so this sits a step below: enough to open the text, not so much that it
   reads as a second page title. The effective-date line that follows it is kept
   with it as one block. */
.doc-content h1 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.doc-content h1 + p {
  margin-bottom: 26px;
}

/* Article headings ("제1조 (목적 및 적용범위)") */
.doc-content h2 {
  margin: 46px 0 14px;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  color: var(--text-strong);
}

.doc-content h3 {
  margin: 30px 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
}

.doc-content p {
  margin: 0 0 12px;
}

.doc-content strong {
  font-weight: 700;
  color: var(--text-strong);
}

.doc-content a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-content a:hover {
  text-decoration-thickness: 2px;
}

/* Hierarchical numbering (1. / 1.1. / 1.1.1.) is generated with CSS counters,
   so the markdown source stays as plain nested lists and renumbers itself
   whenever an item is inserted or removed. */
.doc-content ol {
  counter-reset: item;
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.doc-content ol > li {
  counter-increment: item;
  position: relative;
  padding-left: 1.8em;   /* hanging indent: text clears the number */
  margin-bottom: 8px;
}

.doc-content ol > li::before {
  content: counters(item, ".") ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.doc-content li > ol {
  padding-left: 0.2em;   /* each level steps further right */
  margin-top: 8px;
  margin-bottom: 4px;
}

.doc-content ol ol > li {
  padding-left: 2.5em;
}

.doc-content ol ol ol > li {
  padding-left: 3.2em;
}

.doc-content ul {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.doc-content ul li {
  margin-bottom: 6px;
}

.doc-content li:last-child {
  margin-bottom: 0;
}

.doc-content hr {
  border: 0;
  border-top: 1px solid var(--divider);
  margin: 32px 0;
}

.doc-content blockquote {
  margin: 16px 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--divider);
  color: #555;
}

/* Wide tables scroll inside their own box rather than widening the page.
   The wrapper is emitted by the markdown renderer in scripts/build.js. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 18px 0;
}

.doc-content table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 13px;
  line-height: 1.6;
}

.doc-content th,
.doc-content td {
  border: 1px solid var(--divider);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

.doc-content th {
  background: #fafafa;
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Status / error
   --------------------------------------------------------------------------- */

.doc-status {
  margin: 24px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.doc-status:empty {
  display: none;
}

.doc-status--error {
  color: #b4232a;
}

.doc-retry {
  appearance: none;
  margin-left: 10px;
  min-height: 32px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* Placeholder bars shown while a version is being fetched. */
.doc-skeleton {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.doc-skeleton span {
  display: block;
  height: 13px;
  border-radius: 3px;
  background: linear-gradient(90deg, #f2f2f2 0%, #e9e9e9 50%, #f2f2f2 100%);
  background-size: 200% 100%;
  animation: doc-skeleton 1.3s ease-in-out infinite;
}

.doc-skeleton span:nth-child(3n) {
  width: 72%;
}

@keyframes doc-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .doc-skeleton span,
  .dropdown-chevron {
    animation: none;
    transition: none;
  }
}

/* ===========================================================================
   Responsive
   Breakpoints: >=960px desktop, 600-959px tablet (fluid), <=599px mobile.
   Verified at 375px / 768px / 1280px.
   =========================================================================== */

/* Tablet: fluid width, tighter gutters, desktop type scale retained. */
@media (max-width: 959px) {
  :root {
    --page-pad: 28px;
  }
}

/* Mobile: minimal gutters, stacked header, larger touch targets. */
@media (max-width: 599px) {
  :root {
    --page-pad: 16px;
    --body-size: 13.5px;   /* smaller type, same generous line-height */
    --control-height: 44px;
  }

  .page {
    padding-top: 20px;
    padding-bottom: 64px;
  }

  .doc-tabs {
    gap: 0;
    margin-bottom: 26px;
  }

  .tab {
    /* Three tabs share the width evenly and may wrap onto two lines. */
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 4px;
    font-size: 13px;
    line-height: 1.3;
    white-space: normal;
    word-break: keep-all;
  }

  /* Title on its own line, dropdowns on the line below. */
  .doc-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 28px;
  }

  .doc-title {
    font-size: 21px;
  }

  .doc-content h1 {
    font-size: 18px;
  }

  .doc-controls {
    gap: 8px;
  }

  .dropdown {
    /* Two dropdowns side by side; they wrap to a second row if the labels
       are too long for the viewport. */
    flex: 1 1 46%;
    min-width: 140px;
  }

  .dropdown-toggle {
    width: 100%;
    min-width: 0;
    /* >=16px avoids iOS Safari's automatic zoom on focus. */
    font-size: 16px;
    padding: 0 10px 0 12px;
  }

  .dropdown-menu {
    left: 0;
    right: auto;
    max-height: 60vh;
  }

  .dropdown-option {
    min-height: 44px;
    font-size: 15px;
  }

  .doc-content h2 {
    margin-top: 36px;
    font-size: 16px;
  }

  .doc-content ol > li {
    padding-left: 1.9em;
  }

  .doc-content li > ol {
    padding-left: 0;
  }

  .doc-content ol ol > li {
    padding-left: 2.4em;
  }

  .doc-content table {
    min-width: 460px;
  }
}

@media print {
  .doc-tabs,
  .doc-controls,
  .skip-link,
  .doc-status {
    display: none;
  }

  .page {
    max-width: none;
    padding: 0;
  }
}
