/* ===================================================================
   Mineight — shared stylesheet
   Plain CSS · system fonts only · no external dependencies
   =================================================================== */

:root {
  /* Accent — SK Navy family, matched to the M8 logo. Used sparingly. */
  --accent:        #0E306D;   /* fills, mark, large UI */
  --accent-strong: #0A2452;   /* hover / pressed */
  --accent-ink:    #0E306D;   /* text links — AA contrast on white */
  --accent-wash:   #F2F4FA;   /* very light navy section wash */
  --accent-line:   #DDE3F1;   /* border on washes */
  --mint:          #23A38A;
  --mint-wash:     #EFFAF6;

  /* Neutrals */
  --ink:        #18181B;
  --ink-soft:   #3F3F46;
  --muted:      #71717A;
  --line:       #E5E5E7;
  --line-soft:  #F0F0F1;
  --bg:         #FFFFFF;
  --bg-alt:     #FAFAFA;

  /* Spacing (4px base) */
  --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;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --maxw: 1080px;

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

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

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-soft);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0;
  font-weight: 800;
}
h1 { font-size: clamp(2rem, 6vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: 0; }
h4 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0; }

p { margin: 0; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

ul { margin: 0; padding: 0; }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { left: var(--s-4); top: var(--s-4); color: #fff; }

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

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--s-5);
  padding-right: var(--s-5);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 64px;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 34px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-wrap: wrap;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.site-nav a:hover { background: var(--bg-alt); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-6);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--ink); }

/* ---------- Sections ---------- */
section { padding: var(--s-16) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: var(--s-3);
}
.lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 40ch; }

/* ---------- Hero ---------- */
.hero { padding: var(--s-20) 0 var(--s-16); }
.hero h1 { max-width: 18ch; }
.hero p { margin-top: var(--s-5); font-size: 1.2rem; max-width: 46ch; }
.hero .cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-8);
}
.hero-grid {
  display: grid;
  gap: var(--s-10);
  align-items: center;
}
.hero-mark,
.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(35, 163, 138, 0.12), rgba(14, 48, 109, 0.04)),
    #fff;
}
.hero-mark img {
  width: min(180px, 48vw);
  height: auto;
  filter: drop-shadow(0 18px 26px rgba(14, 48, 109, 0.16));
}
.app-card img {
  width: 112px;
  height: auto;
  margin-bottom: var(--s-5);
}
.app-card p {
  margin: 0 0 var(--s-4);
  font-weight: 700;
  color: var(--accent-ink);
}
.platforms {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  justify-content: center;
}
.store-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--s-3);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
}
.kr-name {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  margin-bottom: var(--s-5);
}

/* ---------- Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-8);
}
.card:nth-child(2) { border-color: rgba(35, 163, 138, 0.28); }
.card h3 { margin-bottom: var(--s-3); }
.card p { color: var(--ink-soft); }

/* Feature card (homepage → SchedHero) */
.feature {
  display: grid;
  gap: var(--s-6);
  align-items: start;
  background:
    linear-gradient(135deg, var(--accent-wash), var(--mint-wash));
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  padding: var(--s-8);
}
.feature .tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.feature h3 { font-size: 1.5rem; margin: var(--s-2) 0 var(--s-3); }
.feature-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
  justify-content: center;
  min-height: 180px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(14, 48, 109, 0.08);
}
.feature-art img {
  width: 104px;
  height: auto;
}
.feature-art span {
  color: var(--accent-ink);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

/* ---------- App showcase ---------- */
.app-showcase {
  display: grid;
  gap: var(--s-10);
  align-items: center;
}
.app-summary {
  max-width: 42ch;
}
.app-title-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.app-icon {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(14, 48, 109, 0.16);
}
.tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.app-summary p {
  color: var(--ink-soft);
}
.app-summary .platforms {
  justify-content: flex-start;
  margin-top: var(--s-5);
}

/* ---------- Core-loop diagram ---------- */
.loop {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
  margin-top: var(--s-10);
  counter-reset: step;
}
.loop-step {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.loop-step .icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
}
.loop-step .num {
  position: absolute;
  top: var(--s-5);
  right: var(--s-6);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0;
}
.loop-step h4 { color: var(--ink); }
.loop-step p { font-size: 0.98rem; color: var(--muted); }

/* ---------- Plain content (privacy / terms) ---------- */
.doc { max-width: 70ch; }
.doc .notice {
  display: flex;
  gap: var(--s-3);
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: var(--s-5) var(--s-6);
  margin-bottom: var(--s-10);
  color: var(--ink-soft);
}
.doc .notice svg { flex: 0 0 auto; width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.doc h2 {
  margin-top: var(--s-12);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line);
  font-size: 1.4rem;
}
.doc h2:first-of-type { border-top: 0; padding-top: 0; }
.doc .updated { color: var(--muted); font-size: 0.95rem; }
.table-wrap {
  margin-top: var(--s-4);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.doc table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: #fff;
}
.doc th,
.doc td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.doc th {
  color: var(--ink);
  background: var(--accent-wash);
  font-size: 0.92rem;
}
.doc tr:last-child td { border-bottom: 0; }

/* ---------- Definition rows ---------- */
.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
  margin-top: var(--s-8);
}
.fact { border-top: 2px solid var(--ink); padding-top: var(--s-4); }
.fact dt { font-weight: 700; color: var(--ink); margin-bottom: var(--s-2); }
.fact dd { margin: 0; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: var(--s-12) 0;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-8);
}
.site-footer .f-brand { max-width: 28ch; }
.site-footer .f-brand .kr { color: var(--muted); font-size: 0.9rem; margin-top: var(--s-2); }
.site-footer .f-brand p { color: var(--muted); font-size: 0.92rem; margin-top: var(--s-2); }
.site-footer nav { display: flex; flex-direction: column; gap: var(--s-2); }
.site-footer nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; font-weight: 600; }
.site-footer nav a:hover { color: var(--accent-ink); text-decoration: underline; }
.site-footer .legal { color: var(--muted); font-size: 0.85rem; width: 100%; margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); }

/* ===================================================================
   Responsive — mobile-first; enhance at wider widths
   =================================================================== */
@media (min-width: 640px) {
  .hero-grid { grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr); }
  .app-showcase { grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1.15fr); }
  .feature { grid-template-columns: 1.4fr 1fr; align-items: center; }
  .facts { grid-template-columns: repeat(2, 1fr); gap: var(--s-8); }
}

@media (min-width: 860px) {
  body { font-size: 18px; }
  section { padding: var(--s-20) 0; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .loop { grid-template-columns: repeat(4, 1fr); }
  /* Connector arrows between loop steps */
  .loop-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: calc(var(--s-4) * -1 - 1px);
    width: var(--s-4);
    height: 2px;
    background: var(--line);
    transform: translateY(-50%);
    z-index: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
