/* =========================================================================
   Case Converter — production stylesheet
   Author: Case Converter
   No external dependencies. Light/dark theming via [data-theme].
   ========================================================================= */

/* ---------- Theme tokens ---------- */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2533;
  --ink-soft: #5b6577;
  --line: #e3e8f0;
  --brand: #3b6cf6;
  --brand-dark: #2c54c9;
  --brand-soft: #eaf0ff;
  --good: #1f9d6b;
  --good-soft: #e4f6ee;
  --shadow: 0 10px 30px rgba(31, 37, 51, 0.08);
  --radius: 14px;
  --maxw: 1080px;
}
[data-theme="dark"] {
  --bg: #11151e;
  --panel: #1a2030;
  --ink: #e8ecf5;
  --ink-soft: #9aa6bd;
  --line: #2a3346;
  --brand: #5b86ff;
  --brand-dark: #3b6cf6;
  --brand-soft: #1f2942;
  --good: #34c08a;
  --good-soft: #16302a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}
img, svg { max-width: 100%; display: block; }
kbd {
  font-family: "Consolas", monospace;
  font-size: .85em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
}
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -50px;
  background: var(--brand); color: #fff;
  padding: 10px 16px; border-radius: 8px;
  z-index: 100; font-weight: 600;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.logo-mark {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; letter-spacing: -.5px;
  flex: none;
}
.logo .title { display: block; font-size: 19px; margin: 0; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; white-space: nowrap; }
.logo .tagline { display: block; font-size: 12.5px; margin: 0; color: var(--ink-soft); line-height: 1.25; }
.header-actions { display: flex; align-items: center; gap: 12px; flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--good);
  background: var(--good-soft);
  padding: 6px 11px; border-radius: 999px; font-weight: 700;
  white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--bg); color: var(--ink);
  border-radius: 10px; width: 42px; height: 42px;
  cursor: pointer; font-size: 18px;
  display: grid; place-items: center;
  transition: background .2s, border-color .2s;
}
.theme-toggle:hover { background: var(--brand-soft); border-color: var(--brand); }

/* ---------- Responsive header ---------- */
/* The badge's full label "100% Offline & Private" is long; collapse it on
   narrower screens so the logo title never wraps. */
.badge .badge-full { display: inline; }
.badge .badge-short { display: none; }

@media (max-width: 620px) {
  .site-header { padding: 12px 16px; }
  .logo-mark { width: 38px; height: 38px; font-size: 17px; }
  .logo .title { font-size: 17px; }
  .logo .tagline { display: none; }          /* save space; tagline repeats in the intro */
  .header-actions { gap: 8px; }
  .badge { padding: 6px 10px; font-size: 12px; }
  .badge .badge-full { display: none; }
  .badge .badge-short { display: inline; }    /* show just "Offline" */
}

@media (max-width: 360px) {
  .badge { display: none; }                   /* extreme narrow: keep only logo + toggle */
}

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 30px 20px 50px; }
.intro { text-align: center; margin-bottom: 28px; }
.intro h1, .intro h2 { font-size: clamp(24px, 4vw, 30px); margin: 0 0 10px; font-weight: 800; letter-spacing: -.6px; }
.intro p { margin: 0 auto; max-width: 620px; color: var(--ink-soft); font-size: clamp(14px, 2vw, 16px); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

@media (max-width: 620px) {
  main { padding: 22px 14px 40px; }
  .intro { margin-bottom: 22px; }
  .grid { gap: 14px; }
  .panel { padding: 14px; }
  textarea { min-height: 200px; font-size: 16px; } /* 16px avoids iOS zoom-on-focus */
  /* Single column of case buttons on phones, so labels never truncate */
  .convert-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.panel-head .label { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.step {
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 800;
  display: grid; place-items: center; flex: none;
}

textarea {
  width: 100%; min-height: 280px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; font-size: 15px;
  font-family: "Consolas", "SF Mono", Menlo, monospace;
  color: var(--ink); background: var(--bg);
  line-height: 1.55; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.dragover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--brand-soft); }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stat {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 11px;
  font-size: 12.5px; color: var(--ink-soft);
}
.stat b { color: var(--ink); font-weight: 700; }

/* ---------- Buttons / toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 9px; padding: 9px 13px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, transform .05s;
  font-family: inherit;
}
.btn:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; }
.btn svg { width: 15px; height: 15px; }

/* ---------- Conversion options ---------- */
.convert-card { grid-column: 1 / -1; margin-top: 2px; }
.convert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px; margin-top: 4px;
}
.case-btn {
  text-align: left; border: 1px solid var(--line);
  background: var(--bg); border-radius: 11px;
  padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  display: flex; flex-direction: column; gap: 3px;
  font-family: inherit;
}
.case-btn:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.case-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.case-btn .name { font-weight: 700; font-size: 14px; color: var(--ink); }
.case-btn .ex { font-size: 12px; color: var(--ink-soft); font-family: "Consolas", monospace; }

/* ---------- Content / SEO sections ---------- */
.content { max-width: 820px; margin: 50px auto 0; padding: 0 20px; }
.content section { margin-bottom: 40px; }
.content h2 { font-size: clamp(20px, 3vw, 25px); font-weight: 800; letter-spacing: -.4px; margin: 0 0 14px; }
.content h3 { font-size: 17px; font-weight: 700; margin: 22px 0 6px; }
.content p { color: var(--ink-soft); margin: 0 0 12px; }
.content ul { color: var(--ink-soft); padding-left: 22px; margin: 0 0 12px; }
.content li { margin-bottom: 6px; }
.content a { color: var(--brand); text-decoration: none; }
.content a:hover { text-decoration: underline; }

.cases-table {
  width: 100%; border-collapse: collapse; margin: 8px 0 16px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; font-size: 14px;
}
.cases-table th, .cases-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cases-table th { background: var(--bg); font-weight: 700; color: var(--ink); }
.cases-table td:last-child { font-family: "Consolas", monospace; color: var(--brand); }
.cases-table tr:last-child td { border-bottom: none; }

/* FAQ accordion */
.faq details {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 4px 16px; margin-bottom: 10px;
}
.faq summary {
  cursor: pointer; font-weight: 700; padding: 12px 0;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; color: var(--brand); font-weight: 400; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { padding-bottom: 14px; margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center; padding: 30px 20px 44px;
  color: var(--ink-soft); font-size: 13.5px;
  border-top: 1px solid var(--line); margin-top: 30px; background: var(--panel);
}
.site-footer a { color: var(--brand); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer nav { margin-bottom: 10px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.site-footer .credit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.site-footer .credit a { font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .toolbar, .convert-card, .theme-toggle, .badge, .toast, .site-footer nav, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border-color: #ccc; }
}
