/* ThemeTrail.com — v3.0 PREMIUM
   Aesthetic: Editorial Tech Magazine
   Fonts: Charter (serif body) + system sans (headings)
   Palette: Deep navy + electric blue + warm amber */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,700;0,9..144,900;1,9..144,400&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #0f172a;
  --ink-light: #334155;
  --ink-muted: #64748b;
  --ink-faint: #94a3b8;
  --surface: #ffffff;
  --surface-dim: #f8fafc;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #dbeafe;
  --blue-glow: rgba(37,99,235,0.08);
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --green: #059669;
  --green-soft: #d1fae5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --radius: 8px;
  --radius-lg: 12px;
  --max-w: 720px;
  --wide-w: 1100px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* === READING PROGRESS BAR === */
.tt-progress {
  position: fixed; top: 0; left: 0; width: 0%;
  height: 3px; background: linear-gradient(90deg, var(--blue), #7c3aed);
  z-index: 9999; transition: width 0.1s linear;
}

/* === BODY === */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.78;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === HEADER === */
.tt-header {
  background: var(--ink);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
}
.tt-header nav {
  max-width: var(--wide-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tt-header nav::-webkit-scrollbar { display: none; }
.tt-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 900;
  font-size: 1.25em;
  color: #fff !important;
  text-decoration: none !important;
  margin-right: 36px;
  white-space: nowrap;
  letter-spacing: -0.5px;
  font-optical-sizing: auto;
}
.tt-header nav a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.82em;
  font-weight: 500;
  padding: 18px 14px;
  white-space: nowrap;
  transition: color var(--transition);
  letter-spacing: 0.2px;
}
.tt-header nav a:hover { color: #fff; }

/* === LINKS === */
a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-hover); }
article a { text-decoration: underline; text-decoration-color: var(--blue-soft); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
article a:hover { text-decoration-color: var(--blue); }

/* === TYPOGRAPHY === */
h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--ink);
  line-height: 1.25;
  font-optical-sizing: auto;
}
h1 {
  font-size: 2.4em;
  font-weight: 900;
  letter-spacing: -1.2px;
  margin-bottom: 16px;
}
h2 {
  font-size: 1.55em;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 2.2em 0 0.7em;
  padding-top: 0.5em;
  border-top: 1px solid var(--border);
}
h3 {
  font-size: 1.2em;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 1.8em 0 0.5em;
}
p { margin: 1em 0; }
ul, ol { margin: 1em 0 1em 1.5em; }
li { margin: 0.4em 0; }
strong { font-weight: 700; color: var(--ink); }
em { font-style: italic; }
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0;
}

/* === MAIN CONTENT === */
.tt-content {
  max-width: var(--max-w);
  margin: 56px auto 80px;
  padding: 0 24px;
}
.tt-content-wide {
  max-width: var(--wide-w);
  margin: 56px auto 80px;
  padding: 0 24px;
}

/* === BYLINE === */
.tt-byline {
  font-size: 0.88em;
  color: var(--ink-muted);
  margin: -8px 0 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tt-byline a { color: var(--blue); font-weight: 600; text-decoration: none; }

/* === ARTICLE ELEMENTS === */
blockquote {
  border-left: 3px solid var(--blue);
  margin: 1.8em 0;
  padding: 16px 24px;
  background: var(--blue-glow);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--ink-light);
}

pre, code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85em;
}
code {
  background: var(--surface-alt);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--ink);
  border: 1px solid var(--border);
}
pre {
  background: var(--ink);
  color: #e2e8f0;
  padding: 24px;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 2em 0;
  line-height: 1.6;
  box-shadow: var(--shadow-md);
}
pre code { background: none; color: inherit; padding: 0; border: none; font-size: 0.92em; }

/* === TABLES === */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 2em 0;
  font-size: 0.9em;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
th {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--blue-glow); }

/* === IMAGES === */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5em 0;
}

/* === CARDS === */
.tt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 2em 0;
}
.tt-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  background: var(--surface);
  transition: all var(--transition);
  position: relative;
}
.tt-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--blue);
  transform: translateY(-3px);
}
.tt-card h3 { margin-top: 0; font-size: 1.08em; line-height: 1.35; }
.tt-card h3 a { color: var(--ink); text-decoration: none; }
.tt-card h3 a:hover { color: var(--blue); }
.tt-card p { font-size: 0.9em; color: var(--ink-muted); margin-bottom: 0; line-height: 1.6; }
.tt-tag {
  display: inline-block;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

/* === CALLOUT === */
.tt-callout {
  background: var(--blue-glow);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 2em 0;
  border-left: 4px solid var(--blue);
}
.tt-callout.warning {
  background: rgba(217,119,6,0.06);
  border-color: var(--amber-soft);
  border-left-color: var(--amber);
}
.tt-callout.success {
  background: rgba(5,150,105,0.06);
  border-color: var(--green-soft);
  border-left-color: var(--green);
}
.tt-callout strong { font-family: 'DM Sans', sans-serif; }

/* === SCORE === */
.tt-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88em;
}
.tt-score .num {
  background: var(--blue);
  color: white;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.95em;
}
.tt-score.good .num { background: var(--green); }
.tt-score.mid .num { background: var(--amber); }
.tt-score.bad .num { background: var(--red); }

/* === TABLE OF CONTENTS === */
.tt-toc {
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 2em 0;
}
.tt-toc strong {
  display: block;
  margin-bottom: 10px;
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-muted);
}
.tt-toc ol { margin: 0; padding-left: 1.2em; }
.tt-toc li { font-size: 0.92em; margin: 5px 0; }
.tt-toc a { text-decoration: none; }

/* === HERO === */
.tt-hero {
  text-align: center;
  padding: 80px 24px 56px;
  max-width: var(--wide-w);
  margin: 0 auto;
  position: relative;
}
.tt-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), #7c3aed);
  border-radius: 2px;
}
.tt-hero h1 {
  font-size: 2.8em;
  max-width: 750px;
  margin: 0 auto 20px;
  line-height: 1.15;
}
.tt-hero .tt-sub {
  font-size: 1.12em;
  color: var(--ink-muted);
  max-width: 580px;
  margin: 0 auto 40px;
  line-height: 1.65;
}
.tt-hero-stats {
  display: flex;
  justify-content: center;
  gap: 56px;
  margin-top: 40px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}
.tt-hero-stat { text-align: center; }
.tt-hero-stat .num {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2.2em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}
.tt-hero-stat .label {
  font-size: 0.78em;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 6px;
  font-weight: 500;
}

/* === SECTION === */
.tt-section {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 56px 24px;
}
.tt-section h2 {
  text-align: center;
  margin-bottom: 12px;
  border: none;
  padding-top: 0;
}
.tt-section .tt-sub {
  text-align: center;
  color: var(--ink-muted);
  max-width: 580px;
  margin: 0 auto 36px;
  font-size: 0.95em;
}
.tt-section-alt {
  background: var(--surface-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* === AUTHOR CARD === */
.tt-author-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 2.5em 0;
  transition: border-color var(--transition);
}
.tt-author-card:hover { border-color: var(--blue); }
.tt-author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #7c3aed);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 900;
  font-size: 1.3em;
  flex-shrink: 0;
}
.tt-author-info h3 { margin-top: 0; margin-bottom: 4px; font-size: 1.05em; }
.tt-author-info p { font-size: 0.88em; color: var(--ink-muted); margin: 0; line-height: 1.55; }

/* === FOOTER === */
.tt-footer {
  background: var(--ink);
  color: var(--ink-faint);
  padding: 40px 24px;
  text-align: center;
  font-size: 0.85em;
  margin-top: 80px;
}
.tt-footer a { color: var(--ink-faint); transition: color var(--transition); }
.tt-footer a:hover { color: #fff; }
.tt-footer nav { margin-top: 14px; }
.tt-footer nav a { margin: 0 10px; }

/* === BADGE === */
.badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: .78em; font-weight: 700; }
.badge.pass { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.fail { background: var(--red-soft); color: var(--red); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  body { font-size: 16px; }
  h1 { font-size: 1.85em; letter-spacing: -0.8px; }
  h2 { font-size: 1.3em; }
  .tt-hero h1 { font-size: 2em; }
  .tt-hero { padding: 56px 20px 40px; }
  .tt-hero-stats { gap: 28px; }
  .tt-hero-stat .num { font-size: 1.7em; }
  .tt-cards { grid-template-columns: 1fr; gap: 16px; }
  .tt-content, .tt-content-wide { padding: 0 18px; margin: 36px auto 48px; }
  .tt-header nav a { padding: 18px 10px; font-size: 0.78em; }
  .tt-logo { margin-right: 20px; font-size: 1.1em; }
  .tt-author-card { flex-direction: column; align-items: center; text-align: center; }
  table { font-size: 0.82em; }
  th, td { padding: 8px 10px; }
  .tt-callout { padding: 18px 20px; }
  .tt-section { padding: 40px 18px; }
}

@media (max-width: 480px) {
  .tt-hero-stats { flex-direction: column; gap: 20px; }
  h1 { font-size: 1.6em; }
  .tt-hero h1 { font-size: 1.7em; }
}

/* === SELECTION === */
::selection {
  background: var(--blue-soft);
  color: var(--ink);
}

/* === SCROLL TO TOP (added via JS) === */
.tt-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2em;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  z-index: 99;
}
.tt-scroll-top:hover {
  background: var(--blue);
  transform: translateY(-2px);
}
.tt-scroll-top.visible { display: flex; }

/* === TOOL PAGE OVERRIDES === */
.tool-wrap { max-width: 960px; margin: 0 auto; }
.tool-controls { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.tool-controls select, .tool-controls input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88em;
  font-family: inherit;
  background: var(--surface);
  transition: border-color var(--transition);
}
.tool-controls select:focus, .tool-controls input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.speed-table { width: 100%; border-collapse: collapse; font-size: .85em; margin: 16px 0; }
.speed-table th {
  background: var(--ink); color: #fff;
  padding: 11px 14px; text-align: left;
  cursor: pointer; user-select: none;
  font-size: .78em; text-transform: uppercase; letter-spacing: .5px;
}
.speed-table th:hover { background: #1e293b; }
.speed-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.speed-table tr:hover td { background: var(--blue-glow); }
.speed-table tr.fast { background: var(--green-soft); }
.speed-table tr.slow { background: var(--amber-soft); }
.bar { display: inline-block; height: 14px; border-radius: 3px; min-width: 4px; vertical-align: middle; }
.bar.green { background: var(--green); } .bar.yellow { background: var(--amber); } .bar.red { background: var(--red); }
.chart-wrap { margin: 28px 0; padding: 24px; background: var(--surface-dim); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.chart-bar-row { display: flex; align-items: center; margin: 7px 0; gap: 10px; }
.chart-label { width: 140px; font-size: .8em; text-align: right; flex-shrink: 0; font-weight: 500; color: var(--ink-light); }
.chart-bar-bg { flex: 1; background: var(--border); border-radius: 6px; height: 24px; overflow: hidden; }
.chart-bar-fill {
  height: 100%; border-radius: 6px;
  display: flex; align-items: center; padding-left: 10px;
  font-size: .75em; font-weight: 700; color: #fff;
  transition: width .8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chart-bar-fill.g { background: linear-gradient(90deg, var(--green), #34d399); }
.chart-bar-fill.y { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.chart-bar-fill.r { background: linear-gradient(90deg, var(--red), #f87171); }
