/* rul.kr — Shared design foundation
   Quiet utility, ink on warm paper, single vermillion seal.
   Import this file first in every template.
*/

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* ── Paper & ink ─────────────────────────────────────────── */
  --paper:        #FAFAF7;
  --paper-2:      #F2F1EB;
  --paper-3:      #E7E5DD;
  --paper-tint:   #F6F4EE;

  --ink:          #0E0E10;
  --ink-2:        #2A2A2E;
  --ink-3:        #6B6B70;
  --ink-4:        #A6A6A9;
  --ink-line:     #1A1A1D;

  /* ── Accent — 인주 vermillion (used like a stamp) ────────── */
  --seal:         #E63A1F;
  --seal-2:       #C42E16;
  --seal-tint:    #FBE9E4;

  /* ── Semantic ────────────────────────────────────────────── */
  --ok:           #1F6F43;
  --ok-tint:      #E4EFE7;
  --warn:         #8A5A00;
  --warn-tint:    #F5ECD7;
  --danger:       #B5341E;

  /* ── Borders & shadow ────────────────────────────────────── */
  --border:       #DCDAD2;
  --border-strong:#0E0E10;
  --border-soft:  #E7E5DD;

  --shadow-1:     0 1px 0 #DCDAD2;
  --shadow-2:     0 1px 2px rgba(14,14,16,.06), 0 0 0 1px #DCDAD2;
  --shadow-3:     0 8px 24px -8px rgba(14,14,16,.18), 0 0 0 1px #DCDAD2;
  --shadow-focus: 0 0 0 3px rgba(230,58,31,.18);

  /* ── Radii ───────────────────────────────────────────────── */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-4: 18px;
  --r-pill: 999px;

  /* ── Spacing (4pt grid) ──────────────────────────────────── */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* ── Typography ──────────────────────────────────────────── */
  --font-sans:  'Pretendard Variable', Pretendard, -apple-system,
                BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo',
                'Noto Sans KR', sans-serif;
  --font-display: 'Pretendard Variable', Pretendard, -apple-system,
                  BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo',
                  'Noto Sans KR', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ── Motion ──────────────────────────────────────────────── */
  --ease:     cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --t-fast:   120ms;
  --t-base:   180ms;
  --t-slow:   280ms;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.45;
}

/* ── Wordmark ─────────────────────────────────────────────────── */
.rk-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.rk-mark .dot { color: var(--seal); }

/* ── Navigation ─────────────────────────────────────────────── */
.rk-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 var(--s-6);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.rk-nav-inner {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rk-nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  font-size: 14px;
  color: var(--ink-3);
}
.rk-nav-links a { transition: color var(--t-fast) var(--ease); }
.rk-nav-links a:hover { color: var(--ink); }
.rk-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  transition: all var(--t-fast) var(--ease);
}
.rk-nav-back:hover { color: var(--ink); background: var(--paper-tint); }

/* ── Eyebrow ──────────────────────────────────────────────────── */
.rk-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--s-4);
}
.rk-eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--ink-3);
  flex-shrink: 0;
}

/* ── Typography scale ─────────────────────────────────────────── */
.t-display {
  font-family: var(--font-display);
  font-weight: 800; font-size: 56px;
  line-height: 1.04; letter-spacing: -0.03em;
}
.t-h1 { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1.12; letter-spacing: -0.03em; }
.t-h2 { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.20; letter-spacing: -0.02em; }
.t-h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.30; letter-spacing: -0.01em; }
.t-micro {
  font-size: 12px; line-height: 1.40; letter-spacing: 0.01em;
  text-transform: uppercase; font-weight: 600; color: var(--ink-3);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.rk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  border: 0;
  border-radius: var(--r-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.rk-btn-primary {
  background: var(--ink);
  color: var(--paper);
  padding: 11px 22px;
  height: 44px;
}
.rk-btn-primary:hover { background: var(--ink-line); }
.rk-btn-primary:active { transform: scale(0.98); }
.rk-btn-ghost {
  background: var(--paper);
  color: var(--ink-2);
  border: 1px solid var(--border);
  padding: 8px 14px;
}
.rk-btn-ghost:hover { background: var(--paper-tint); color: var(--ink); }
.rk-btn-sm { font-size: 12px; padding: 7px 12px; height: auto; border-radius: var(--r-1); }

/* ── Input ────────────────────────────────────────────────────── */
.rk-input-row {
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r-2);
  height: 52px;
  padding: 0 6px 0 16px;
  transition: box-shadow var(--t-base) var(--ease);
}
.rk-input-row:focus-within { box-shadow: var(--shadow-focus); }
.rk-input-row.error { border-color: var(--danger); }
.rk-input-row input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-family: var(--font-mono); font-size: 14px; color: var(--ink); padding: 0;
}
.rk-input-row input::placeholder { color: var(--ink-4); }

.rk-input-plain {
  width: 100%;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.rk-input-plain:focus { border-color: var(--ink); box-shadow: var(--shadow-focus); }
.rk-input-plain::placeholder { color: var(--ink-4); }

/* ── Cards ────────────────────────────────────────────────────── */
.rk-card {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  padding: var(--s-6);
}
.rk-card-sm { padding: var(--s-5); border-radius: var(--r-3); }

/* ── Pillar / feature grid ────────────────────────────────────── */
.rk-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
}
.rk-pillar { border-top: 1px solid var(--ink); padding-top: var(--s-4); }
.rk-pillar-n {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.rk-pillar-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 8px; }
.rk-pillar-body { font-size: 14px; line-height: 1.6; color: var(--ink-2); }

/* ── Feature grid (3-col) ─────────────────────────────────────── */
.rk-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.rk-feature {
  padding: var(--s-5) var(--s-5);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}
.rk-feature-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-1);
  color: var(--ink-3); margin-bottom: var(--s-4);
}
.rk-feature.is-seal .rk-feature-icon { color: var(--seal); }
.rk-feature-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.rk-feature-body { font-size: 14px; line-height: 1.55; color: var(--ink-2); }

/* ── Result card ──────────────────────────────────────────────── */
.rk-result {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: rk-rise var(--t-slow) var(--ease);
}
@keyframes rk-rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.rk-result.is-secret { border-color: var(--seal); }
.rk-result-secret-bar {
  background: var(--seal-tint);
  color: var(--seal-2);
  padding: 10px var(--s-5);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #F4CFC5;
}
.rk-result-url {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}
.rk-result-scheme { color: var(--ink-3); font-weight: 500; }
.rk-result.is-secret .rk-result-slug { color: var(--seal); }

/* ── Toast ────────────────────────────────────────────────────── */
.rk-toast {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  z-index: 9999;
  background: var(--ok);
  color: var(--paper);
  padding: 11px 18px;
  border-radius: var(--r-2);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-3);
  transform: translateX(calc(100% + var(--s-5)));
  transition: transform var(--t-base) var(--ease);
  display: flex;
  align-items: center;
  gap: 8px;
}
.rk-toast.show { transform: translateX(0); }

/* ── Section wrapper ──────────────────────────────────────────── */
.rk-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-6) 0;
}
.rk-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-4);
  max-width: 640px;
}
.rk-section-title .period { color: var(--seal); }
.rk-section-lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: var(--s-7);
  max-width: 560px;
}

/* ── Page prose (document pages) ─────────────────────────────── */
.rk-prose {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-6) var(--s-9);
}
.rk-prose-section {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  padding: var(--s-5) var(--s-6);
  margin-bottom: var(--s-4);
}
.rk-prose-section h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: var(--s-4);
}
.rk-prose-section p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  margin-bottom: var(--s-3);
}
.rk-prose-section p:last-child { margin-bottom: 0; }
.rk-prose-section ul { list-style: none; padding: 0; }
.rk-prose-section ul li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
  align-items: flex-start;
}
.rk-prose-section ul li:last-child { border-bottom: none; }
.rk-prose-section ul li::before {
  content: '—';
  color: var(--ink-4);
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 1px;
}
.rk-prose-section ul li.ok::before { content: '✓'; color: var(--ok); }
.rk-prose-section ul li.no::before { content: '✗'; color: var(--danger); }

.rk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--r-1);
  border: 1px solid var(--border);
  color: var(--ink-3);
  background: var(--paper-2);
}
.rk-badge.ok { color: var(--ok); background: var(--ok-tint); border-color: rgba(31,111,67,.2); }
.rk-badge.seal { color: var(--seal-2); background: var(--seal-tint); border-color: rgba(230,58,31,.2); }

/* ── Stats / data display ─────────────────────────────────────── */
.rk-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-4);
  margin: var(--s-5) 0;
}
.rk-stat-box {
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  background: var(--paper);
  padding: var(--s-4);
  text-align: center;
}
.rk-stat-num {
  font-weight: 800;
  font-size: 36px;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--ink);
}
.rk-stat-label { font-size: 12px; color: var(--ink-3); line-height: 1.4; font-weight: 500; }

/* ── Table ────────────────────────────────────────────────────── */
.rk-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  margin: var(--s-4) 0;
}
.rk-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.rk-table th {
  background: var(--paper-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.rk-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-2);
  font-size: 14px;
}
.rk-table tr:last-child td { border-bottom: none; }
.rk-table td.ok { color: var(--ok); font-weight: 700; }
.rk-table td.na { color: var(--ink-4); font-style: italic; }

/* ── Footer ───────────────────────────────────────────────────── */
.rk-footer {
  border-top: 1px solid var(--border);
  padding: var(--s-5) var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-3);
  max-width: 100%;
}
.rk-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.rk-footer-links { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.rk-footer-links a { color: var(--ink-3); transition: color var(--t-fast) var(--ease); }
.rk-footer-links a:hover { color: var(--ink); }

/* ── QR modal ─────────────────────────────────────────────────── */
.rk-modal-scrim {
  position: fixed; inset: 0;
  background: rgba(14,14,16,.45);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  animation: rk-fade var(--t-base) var(--ease);
}
@keyframes rk-fade { from { opacity: 0; } to { opacity: 1; } }
.rk-qr-pop {
  position: relative;
  background: var(--paper);
  border-radius: var(--r-4);
  padding: var(--s-5) var(--s-6);
  width: 320px;
  box-shadow: var(--shadow-3);
  animation: rk-pop var(--t-slow) var(--ease);
}
@keyframes rk-pop {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Inline code / API ────────────────────────────────────────── */
.rk-code-block {
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--s-4);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  overflow-x: auto;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 860px) {
  .rk-pillars { grid-template-columns: repeat(2, 1fr); }
  .rk-features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .rk-pillars { grid-template-columns: 1fr; }
  .rk-features { grid-template-columns: 1fr; }
  .rk-nav { padding: 0 var(--s-4); }
  .rk-prose { padding: var(--s-5) var(--s-4) var(--s-7); }
  .rk-section { padding: var(--s-7) var(--s-4) 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
