/* --------------------------------------------------
   Global Theme Variables
-------------------------------------------------- */

:root {
  --bg: #f7f9fb;
  --card-bg: #ffffff;
  --text: #222;
  --muted: #666;
  --border: #e3e6ea;
  --primary: #2a7be4;
  --primary-light: #e8f1fc;
  --green: #2e9d4d;
  --orange: #e69a2a;
  --red: #d64545;
  --radius: 12px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Base layout & typography */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(180deg, #f7f9fb 0%, #eef2f6 100%);
  color: var(--text);
  line-height: 1.6;
}

/* --------------------------------------------------
   Layout Shell
-------------------------------------------------- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.container:has(.tools-grid),
.container:has(.carousel-wrapper) {
  max-width: 1080px;
}

.grid {
  display: grid;
  gap: 24px;
}

.fields {
  display: grid;
  gap: 18px;
}

.field.wide {
  grid-column: span 1;
}

@media (min-width: 720px) {
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.wide {
    grid-column: 1 / -1;
  }
}

.small {
  font-size: 0.92rem;
  color: var(--muted);
}

/* --------------------------------------------------
   Header
-------------------------------------------------- */

.header {
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
}

/* --------------------------------------------------
   Hero Section
-------------------------------------------------- */

.hero {
  padding: 28px 0 18px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(227,230,234,0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 2.5vw, 3.25rem);
  line-height: 1.05;
  font-weight: 800;
  color: var(--text);
}

.hero p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.03rem;
  max-width: 760px;
}

.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* --------------------------------------------------
   Buttons & Segmented Soft Pills
-------------------------------------------------- */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #1d6ed8;
}

.btn-secondary {
  background-color: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
}

.segmented {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.segmented button {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.segmented button.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.segmented button:hover {
  background: var(--primary-light);
}

/* --------------------------------------------------
   Card & Form Fields
-------------------------------------------------- */

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.field {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}

input, select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 16px;
  box-sizing: border-box;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(42, 123, 228, 0.1);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

.note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.footer-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: -12px;
  margin-bottom: 20px;
}

/* --------------------------------------------------
   Results & Result Cards
-------------------------------------------------- */

.results {
  display: grid;
  gap: 18px;
}

.result-card {
  background: var(--card-bg);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (min-width: 720px) {
  .results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.result-card h3, .result-card .k {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.result-card .v {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.result-card p, .result-card .v {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.result-card .muted {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.result-card .table {
  width: 100%;
  border-collapse: collapse;
}

.result-card .table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

.result-card .table tr:last-child td {
  border-bottom: none;
}

.result-card .table td:last-child {
  text-align: right;
  font-weight: 600;
}

.severity.green { border-left: 6px solid var(--green); }
.severity.orange { border-left: 6px solid var(--orange); }
.severity.red { border-left: 6px solid var(--red); }

.summary {
  margin-top: 10px;
  font-size: 15px;
  color: var(--muted);
}

/* --------------------------------------------------
   Tool Utilities (Progress, Copy, Share)
-------------------------------------------------- */

.bar {
  background: var(--border);
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 12px 0;
}

.bar .fill {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tools button {
  flex: 1 1 180px;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.tools button:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.tools button:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

/* --------------------------------------------------
   Homepage-Specific Layouts (Grid, FAQ, Glossary)
-------------------------------------------------- */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.tool-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.tool-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.tool-card h2 a {
  text-decoration: none;
  color: var(--text);
}

.tool-card h2 a:hover {
  color: var(--primary);
}

.tool-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.tool-link {
  font-size: 0.9rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.tool-link:hover {
  text-decoration: underline;
}

.content-section {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 24px 0;
  border: 1px solid var(--border);
}

.content-section h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.3rem;
  color: var(--text);
}

.content-section h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 1.05rem;
  color: var(--text);
}

.content-section p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.content-section a {
  color: var(--primary);
  text-decoration: none;
}

.content-section a:hover {
  text-decoration: underline;
}

.content-list {
  margin: 8px 0 12px 18px;
  padding: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.content-list li {
  margin-bottom: 4px;
}

/* FAQ layout */
.faq-section .faq-item {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.faq-section .faq-item:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.faq-item h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.faq-item p {
  margin: 0;
}

/* Glossary Layout */
.glossary-section .glossary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.glossary-item {
  background-color: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid var(--border);
}

.glossary-item h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 1rem;
}

.glossary-item p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Homepage Carousel */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-container {
  overflow: hidden;
  flex: 1;
}

.carousel-track {
  display: flex;
  gap: 16px;
  transition: transform 0.3s ease;
}

.carousel-card {
  min-width: 260px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow);
  transition: transform 0.2s, background-color 0.2s;
}

.carousel-card:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

.carousel-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.carousel-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.carousel-arrow {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  box-shadow: var(--shadow);
  transition: background-color 0.15s;
}

.carousel-arrow:hover {
  background: var(--primary-light);
}

/* --------------------------------------------------
   Footer
-------------------------------------------------- */

.footer {
  text-align: center;
  padding: 24px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  border-top: 1px solid rgba(227,230,234,0.85);
  margin-top: 36px;
}

.footer p {
  margin: 0;
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.footer-nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s ease;
}

.footer-nav a:hover {
  color: var(--text);
}

/* --------------------------------------------------
   AdSense Block Layout
-------------------------------------------------- */

.ad-block {
  text-align: center;
  margin: 24px 0;
  min-height: 90px;
}

/* --------------------------------------------------
   Responsive Design Breakpoints
-------------------------------------------------- */

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  .site-nav {
    gap: 8px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .content-section {
    padding: 16px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .carousel-wrapper {
    gap: 4px;
  }

  .carousel-card {
    min-width: 220px;
  }
}

/* --------------------------------------------------
   Backward Compatibility Fallbacks
-------------------------------------------------- */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
}

.wrap:has(.tools-grid), 
.wrap:has(.carousel-wrapper) {
  max-width: 960px;
}

.site-header {
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.card-page {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.seg {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.seg button {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.seg button.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.seg button:hover {
  background: var(--primary-light);
}

.stat {
  background: var(--card-bg);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat .k {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.stat .v {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
//
.stat .muted {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
