/* Shared styles for every tools page. Same identity as the landing page
   (hobby-programmer-5000.github.io): violet night, neon purple, heart pink,
   crown yellow, checkered sleeve. 4px spacing scale; text colors meet WCAG AA. */

:root {
  --bg: #0f0a1a; --bg-dots: #2a1f40; --surface: #181026; --surface-2: #211736; --border: #33264d;
  --text: #ede7f8; --muted: #b0a3cb; --accent: #c08cff; --accent-ink: #1a0f2e;
  --pink: #ff6fae; --yellow: #ffd166; --ok: #6ee7a8; --shadow: #7c3aed; --focus: #ffd166;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --pixel: Galmuri11, "Pretendard Variable", monospace;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 40px; --s8: 48px; --s9: 64px;
  --radius: 10px; --wrap: 880px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #faf7ff; --bg-dots: #e6dcf7; --surface: #ffffff; --surface-2: #f3edfd; --border: #ddd1f2;
  --text: #1b1530; --muted: #574b72; --accent: #6d28d9; --accent-ink: #ffffff;
  --pink: #c2185b; --yellow: #8a5a00; --ok: #0f7a45; --shadow: #1b1530; --focus: #6d28d9;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #faf7ff; --bg-dots: #e6dcf7; --surface: #ffffff; --surface-2: #f3edfd; --border: #ddd1f2;
    --text: #1b1530; --muted: #574b72; --accent: #6d28d9; --accent-ink: #ffffff;
    --pink: #c2185b; --yellow: #8a5a00; --ok: #0f7a45; --shadow: #1b1530; --focus: #6d28d9;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px); background-size: 16px 16px;
  -webkit-font-smoothing: antialiased;
  /* Keep the footer at the bottom on short pages. */
  min-height: 100vh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 640px) { .wrap { padding: 0 var(--s5); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
.skip { position: absolute; left: var(--s4); top: -100px; z-index: 20; background: var(--accent); color: var(--accent-ink); padding: var(--s2) var(--s3); border-radius: 6px; }
.skip:focus { top: var(--s2); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: var(--s3); min-height: 60px; }
.mark { font-family: var(--pixel); font-size: 18px; color: var(--text); text-decoration: none; white-space: nowrap; }
.mark span { color: var(--accent); }
.crumb { font-family: var(--pixel); font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.crumb:hover { color: var(--text); }
.controls { display: flex; gap: var(--s2); margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 var(--s3);
  font: 600 13px/1 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

/* Page heading */
.page-head { padding-top: var(--s7); padding-bottom: var(--s5); }
.page-head h1 { margin: 0; font-size: clamp(28px, 5vw, 40px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; }
.page-head p { margin: var(--s3) 0 0; color: var(--muted); max-width: 60ch; }
.kicker { font-family: var(--pixel); font-size: 13px; color: var(--pink); margin: 0 0 var(--s2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  font: 650 15px/1 var(--font); text-decoration: none; color: var(--text);
  background: var(--surface); border: 2px solid var(--text); border-radius: 10px;
  box-shadow: 4px 4px 0 var(--shadow); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-ink); }
.btn.quiet { border-width: 1px; border-color: var(--border); box-shadow: none; }
.btn.quiet:hover { border-color: var(--accent); transform: none; box-shadow: none; }

/* Cards (catalog) */
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s5) var(--s4) var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--accent); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--shadow); }
.card h2 { margin: 0; font-size: 19px; line-height: 1.3; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h2 a:focus-visible { outline: none; }
.card:has(h2 a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: var(--s2); }
.tags span { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

.checker { height: 12px; background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 12px 12px; opacity: .85; }

/* Footer */
.footer { margin-top: var(--s9); border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { padding-top: var(--s5); padding-bottom: var(--s6); }
.footer p { margin: 0 0 var(--s2); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: var(--s5); z-index: 30; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s3);
  max-width: calc(100vw - 32px); padding: var(--s2) var(--s2) var(--s2) var(--s4);
  font-size: 14px; font-weight: 600;
  background: #ffd166; color: #1a0f2e; border: 2px solid #1a0f2e; border-radius: 8px; box-shadow: 4px 4px 0 #1a0f2e;
}
.toast:not(:has(button)) { padding-right: var(--s4); }
.toast button {
  min-height: 36px; padding: 0 var(--s3); font: 700 13px/1 var(--font);
  color: #1a0f2e; background: transparent; border: 2px solid #1a0f2e; border-radius: 6px; cursor: pointer;
}
.toast[hidden] { display: none; }
