/* ============================================================
   Dugout Notes (수싸움) — design system, first draft
   Mobile-first · high contrast · dark mode · print
   ============================================================ */

:root {
  --bg: #f5f3ec;
  --surface: #ffffff;
  --surface-2: #ede9de;
  --text: #171b22;
  --text-muted: #4c5563;
  --border: #d8d2c2;
  --primary: #0f5c33;
  --primary-ink: #ffffff;
  --primary-soft: #e3efe8;
  --accent: #d98f1f;
  --accent-soft: #f7ecd6;
  --link: #0b5dcc;

  --target: #14703a;
  --target-bg: #e6f2ea;
  --avoid: #b0261d;
  --avoid-bg: #fbe9e6;
  --mistake: #7d5600;
  --mistake-bg: #faf0da;

  --cluster-pitcher: #1d4ed8;
  --cluster-pitcher-bg: #e8eefc;
  --cluster-hitter: #14703a;
  --cluster-hitter-bg: #e6f2ea;
  --cluster-neutral: #57534e;
  --cluster-neutral-bg: #f0eee8;
  --cluster-full: #a35a00;
  --cluster-full-bg: #faf0da;

  --dot: #171b22;
  --dot-empty: #c7c0ae;

  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;
  --maxw: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10151a;
    --surface: #1a2128;
    --surface-2: #232c35;
    --text: #edf1f5;
    --text-muted: #9aa5b0;
    --border: #303b45;
    --primary: #37a96b;
    --primary-ink: #0c1f14;
    --primary-soft: #16301f;
    --accent: #f0b45a;
    --accent-soft: #33280f;
    --link: #83b6ff;

    --target: #5cd18e;
    --target-bg: #12301e;
    --avoid: #f2796f;
    --avoid-bg: #34181a;
    --mistake: #f2c14e;
    --mistake-bg: #33280f;

    --cluster-pitcher: #8ab2ff;
    --cluster-pitcher-bg: #16233d;
    --cluster-hitter: #5cd18e;
    --cluster-hitter-bg: #12301e;
    --cluster-neutral: #c0c7cf;
    --cluster-neutral-bg: #242c33;
    --cluster-full: #f2c14e;
    --cluster-full-bg: #33280f;

    --dot: #edf1f5;
    --dot-empty: #3b4650;
  }
}

[data-theme="dark"] {
  --bg: #10151a;
  --surface: #1a2128;
  --surface-2: #232c35;
  --text: #edf1f5;
  --text-muted: #9aa5b0;
  --border: #303b45;
  --primary: #37a96b;
  --primary-ink: #0c1f14;
  --primary-soft: #16301f;
  --accent: #f0b45a;
  --accent-soft: #33280f;
  --link: #83b6ff;

  --target: #5cd18e;
  --target-bg: #12301e;
  --avoid: #f2796f;
  --avoid-bg: #34181a;
  --mistake: #f2c14e;
  --mistake-bg: #33280f;

  --cluster-pitcher: #8ab2ff;
  --cluster-pitcher-bg: #16233d;
  --cluster-hitter: #5cd18e;
  --cluster-hitter-bg: #12301e;
  --cluster-neutral: #c0c7cf;
  --cluster-neutral-bg: #242c33;
  --cluster-full: #f2c14e;
  --cluster-full-bg: #33280f;

  --dot: #edf1f5;
  --dot-empty: #3b4650;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: #10151a; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.1rem; }

/* ---------- header / nav ---------- */

.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.site-header .container {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  padding-top: .55rem; padding-bottom: .55rem;
}
.brand { display: flex; align-items: center; gap: .55rem; margin-right: auto; text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; }
.brand-name { font-weight: 800; font-size: 1.08rem; letter-spacing: .01em; line-height: 1.15; }
.brand-name small { display: block; font-weight: 600; font-size: .72rem; color: var(--text-muted); letter-spacing: .12em; }

/* ---------- logo display ---------- */

.logo-hero {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: .2rem 0 1.1rem;
}
.logo-hero .logo-mark { width: 76px; height: 76px; }
.logo-hero-name { font-weight: 800; font-size: 2rem; line-height: 1.05; letter-spacing: -.01em; }
.logo-hero-ko { display: block; font-size: .95rem; font-weight: 700; color: var(--text-muted); letter-spacing: .42em; margin-top: .3rem; }
@media (max-width: 420px) {
  .logo-hero .logo-mark { width: 62px; height: 62px; }
  .logo-hero-name { font-size: 1.65rem; }
}

.main-nav { display: flex; flex-wrap: wrap; gap: .15rem; align-items: center; }
.main-nav a {
  display: inline-flex; align-items: center; min-height: var(--tap);
  padding: .35rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .98rem;
}
.main-nav a:hover { background: var(--surface-2); text-decoration: none; }
.main-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap); margin-left: .15rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.05rem;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: inline; }
}

/* ---------- typography ---------- */

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.lead { font-size: 1.08rem; color: var(--text); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: .55rem 1.1rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }

/* ---------- scoreboard count selector ---------- */

.selector-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1rem 1rem; }
.selector-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 .1rem; display: flex; align-items: center; gap: .45rem; }
.selector-sub { color: var(--text-muted); font-size: .9rem; margin: 0 0 .9rem; }

.scoreboard { display: grid; grid-template-columns: 3.2rem repeat(4, 1fr); gap: .45rem; }
.sb-head { display: flex; align-items: flex-end; justify-content: center; font-weight: 800; font-size: .8rem; color: var(--text-muted); letter-spacing: .05em; padding-bottom: .2rem; }
.sb-row-label { display: flex; align-items: center; justify-content: flex-end; font-weight: 800; font-size: .8rem; color: var(--text-muted); padding-right: .2rem; }
.sb-strike-label { grid-column: 1; }

.count-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: 58px; padding: .35rem .2rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer; text-decoration: none;
}
.count-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.count-btn:active { transform: translateY(1px); }
.count-btn small { font-size: .68rem; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }

/* cluster tinting for the selector */
.count-btn.cl-hitter { background: var(--cluster-hitter-bg); border-color: color-mix(in srgb, var(--cluster-hitter) 45%, var(--border)); }
.count-btn.cl-pitcher { background: var(--cluster-pitcher-bg); border-color: color-mix(in srgb, var(--cluster-pitcher) 45%, var(--border)); }
.count-btn.cl-full { background: var(--cluster-full-bg); border-color: color-mix(in srgb, var(--cluster-full) 45%, var(--border)); }

/* count page header dots */
.count-dots { display: flex; gap: 1.6rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.dots-group { display: flex; flex-direction: column; gap: .3rem; }
.dots-label { font-size: .72rem; font-weight: 800; letter-spacing: .14em; color: var(--text-muted); }
.dots { display: flex; gap: .45rem; }
.dot { width: 15px; height: 15px; border-radius: 50%; background: var(--dot-empty); }
.dot.on { background: var(--dot); }
.dot.on.accent { background: var(--accent); }

/* ---------- cluster chips ---------- */

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .65rem; border-radius: 999px;
  font-size: .82rem; font-weight: 800; letter-spacing: .02em;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-pitcher { background: var(--cluster-pitcher-bg); color: var(--cluster-pitcher); }
.chip-hitter { background: var(--cluster-hitter-bg); color: var(--cluster-hitter); }
.chip-neutral { background: var(--cluster-neutral-bg); color: var(--cluster-neutral); }
.chip-full { background: var(--cluster-full-bg); color: var(--cluster-full); }

/* ---------- hero ---------- */

.hero { padding: 2.2rem 0 1.4rem; }
.hero .kicker { font-size: .82rem; font-weight: 800; letter-spacing: .12em; color: var(--primary); text-transform: uppercase; margin: 0 0 .5rem; }
.hero h1 { font-size: 2rem; margin: 0 0 .55rem; }
.hero p.tagline { font-size: 1.12rem; color: var(--text); margin: 0 0 .2rem; font-weight: 600; }
.hero p.sub { color: var(--text-muted); margin: 0 0 1.3rem; }

/* ---------- sections ---------- */

.section { margin: 2.1rem 0; }
.section h2 { display: flex; align-items: center; gap: .5rem; }
.section h2 .num { color: var(--accent); font-weight: 800; }

.free-strip {
  display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center;
  background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: var(--radius); padding: .85rem 1rem; margin: 1.6rem 0;
  color: var(--primary); font-weight: 700;
}

.note {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius); padding: .9rem 1rem; margin: 1.4rem 0; font-size: .95rem;
}

/* ---------- count page ---------- */

.breadcrumbs { font-size: .86rem; color: var(--text-muted); margin: 1.1rem 0 .6rem; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); text-decoration: underline; }

.count-header { margin: 0 0 1.2rem; }
.count-header h1 { font-size: 2.6rem; margin: 0 0 .15rem; letter-spacing: -.02em; }
.count-header .count-sub { color: var(--text-muted); margin: 0 0 .7rem; font-weight: 600; }
.count-header .chip { margin-bottom: .4rem; }

.block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.05rem 1.1rem; margin: 0 0 1rem;
  border-left: 5px solid var(--border);
}
.block h2 { font-size: 1.02rem; margin: 0 0 .45rem; }
.block ul { margin: 0; padding-left: 1.15rem; }
.block li { margin-bottom: .35rem; }
.block p:last-child, .block ul:last-child { margin-bottom: 0; }

.block.situation { border-left-color: var(--primary); }
.block.situation h2 { color: var(--primary); }
.block.targets { border-left-color: var(--target); background: var(--target-bg); }
.block.targets h2 { color: var(--target); }
.block.avoids { border-left-color: var(--avoid); background: var(--avoid-bg); }
.block.avoids h2 { color: var(--avoid); }
.block.mistakes { border-left-color: var(--mistake); background: var(--mistake-bg); }
.block.mistakes h2 { color: var(--mistake); }

.count-nav { display: flex; gap: .6rem; justify-content: space-between; margin: 1.8rem 0 .4rem; }
.count-nav .btn { flex: 1; }
.count-nav .btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------- glossary ---------- */

table.glossary { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.glossary th, table.glossary td { text-align: left; vertical-align: top; padding: .6rem .7rem; border-bottom: 1px solid var(--border); }
table.glossary th { font-size: .78rem; letter-spacing: .1em; color: var(--text-muted); text-transform: uppercase; }
table.glossary .en { color: var(--text-muted); font-weight: 600; }
table.glossary .term { font-weight: 800; white-space: nowrap; }

/* ---------- roadmap ---------- */

.roadmap { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.roadmap li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; }
.roadmap .rm-name { font-weight: 800; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.roadmap .rm-name .soon { font-size: .7rem; font-weight: 800; letter-spacing: .08em; background: var(--surface-2); color: var(--text-muted); border-radius: 999px; padding: .1rem .5rem; }
.roadmap p { margin: .3rem 0 0; color: var(--text-muted); font-size: .93rem; }

/* ---------- chapter list ---------- */

.chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.chapters a { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .95rem 1.05rem; text-decoration: none; color: var(--text); }
.chapters a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.chapters .ch-no { font-size: .75rem; font-weight: 800; letter-spacing: .1em; color: var(--accent); }
.chapters h3 { margin: .1rem 0 .2rem; }
.chapters p { margin: 0; color: var(--text-muted); font-size: .92rem; }
.chapters .status { float: right; font-size: .72rem; font-weight: 800; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: .15rem .55rem; }
.chapters .status.done { color: var(--primary); background: var(--primary-soft); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2rem 0 2.4rem; color: var(--text-muted); font-size: .92rem; }
.site-footer .brand-name { color: var(--text); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .15rem; margin: .7rem 0; }
.site-footer nav a { color: var(--text); text-decoration: none; padding: .3rem .55rem; border-radius: var(--radius-sm); font-weight: 600; }
.site-footer nav a:hover { background: var(--surface-2); text-decoration: none; }
.footer-mission { margin: .6rem 0 0; }

/* ---------- print ---------- */

@media print {
  .site-header, .site-footer, .count-nav, .theme-toggle, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .container { max-width: 100%; }
  .block { break-inside: avoid; background: #fff; border: 1px solid #999; }
  .block.targets, .block.avoids, .block.mistakes { background: #fff; }
  a { color: #000; text-decoration: none; }
  .chip { border: 1px solid #000; }
}

/* ---------- lab skeleton pages ---------- */

.ph-note {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius); padding: .8rem 1rem; margin: 1.2rem 0;
  font-size: .92rem;
}
.ph-note .tag { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .1em; background: var(--accent); color: #10151a; border-radius: 999px; padding: .12rem .55rem; margin-right: .45rem; }

.ph-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; margin: 1rem 0; }

.ph-card {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 1.05rem 1.1rem; min-height: 150px;
  display: flex; flex-direction: column; gap: .55rem;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.ph-card .ph-label { font-size: .72rem; font-weight: 800; letter-spacing: .12em; color: var(--text-muted); text-transform: uppercase; }
.ph-card .ph-title { font-weight: 800; font-size: 1rem; margin: 0; }
.ph-card p { color: var(--text-muted); font-size: .9rem; margin: 0; }
.ph-line { height: .68rem; border-radius: 999px; background: var(--surface-2); }
.ph-line.w35 { width: 35%; } .ph-line.w55 { width: 55%; } .ph-line.w75 { width: 75%; } .ph-line.w90 { width: 90%; }
.ph-card .ph-cta { margin-top: auto; }

.ph-box {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 2rem 1.1rem; text-align: center; color: var(--text-muted);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.ph-box .ph-icon { font-size: 1.6rem; display: block; margin-bottom: .4rem; }

/* roadmap links (labs now open) */
.roadmap .rm-name a { color: var(--text); text-decoration: none; }
.roadmap .rm-name a:hover { color: var(--primary); text-decoration: underline; }
.roadmap .rm-name .soon.open { background: var(--primary-soft); color: var(--primary); }

/* ============================================================
   Desktop layout — fills the horizontal space on computers
   ============================================================ */

@media (min-width: 960px) {
  :root { --maxw: 72rem; }

  /* typography */
  h1 { font-size: 2.4rem; }
  .hero h1 { font-size: 2.6rem; }
  .lead { max-width: 70ch; }
  .section > p { max-width: 70ch; }

  /* header */
  .site-header .brand-mark { width: 40px; height: 40px; }
  .site-header .brand-name { font-size: 1.18rem; }

  /* hero: text left, logo card right */
  .hero {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; gap: 2.5rem; padding: 3rem 0 2rem;
  }
  .hero .kicker, .hero h1, .hero .tagline, .hero .sub { grid-column: 1; }
  .hero .kicker { grid-row: 1; }
  .hero h1 { grid-row: 2; }
  .hero .tagline { grid-row: 3; }
  .hero .sub { grid-row: 4; margin-bottom: 0; }
  .hero .logo-hero {
    grid-column: 2; grid-row: 1 / 5; align-self: center;
    flex-direction: column; gap: 1.1rem;
    padding: 2.2rem 2.8rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
  }
  .hero .logo-hero .logo-mark { width: 128px; height: 128px; }
  .hero .logo-hero-name { font-size: 2.1rem; }
  .hero .logo-hero-ko { font-size: 1.05rem; }
  .hero p { max-width: 58ch; }

  /* section grids */
  .chapters { grid-template-columns: 1fr 1fr; }
  .roadmap { grid-template-columns: 1fr 1fr; }

  /* scoreboard selector */
  .scoreboard { grid-template-columns: 3.8rem repeat(4, 1fr); gap: .6rem; }
  .count-btn { min-height: 78px; font-size: 1.3rem; border-radius: 10px; }
  .count-btn small { font-size: .74rem; }

  /* count page: 2-column body, wide header with dots on the right */
  .count-page {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1.1rem; align-items: start;
  }
  .count-page .breadcrumbs,
  .count-page .count-header,
  .count-page .block.situation,
  .count-page .block.mistakes,
  .count-page .count-nav { grid-column: 1 / -1; }
  .count-page .block { margin-bottom: 0; }

  .count-header {
    display: grid; grid-template-columns: 1fr auto;
    align-items: center; column-gap: 2.5rem;
  }
  .count-header .chip { grid-column: 1; grid-row: 1; justify-self: start; margin-bottom: .5rem; }
  .count-header h1 { grid-column: 1; grid-row: 2; font-size: 3.2rem; }
  .count-header .count-sub { grid-column: 1; grid-row: 3; margin: 0; max-width: 52ch; }
  .count-header .count-dots {
    grid-column: 2; grid-row: 1 / 4; margin: 0;
    flex-direction: column; gap: 1rem; align-self: center;
  }
  .count-page .dot { width: 20px; height: 20px; }

  /* footer: brand/mission left, nav right */
  .site-footer .container {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem; align-items: start;
  }
  .site-footer nav { grid-column: 2; grid-row: 1 / 4; justify-self: end; margin: 0; }
}

@media (min-width: 1440px) {
  :root { --maxw: 84rem; }
  .hero .logo-hero .logo-mark { width: 150px; height: 150px; }
}