/* =============================================
   Color Contrast Checker — style.css
   Digital BigHit · Ajay K.
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f9fafb;
  --white: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --font-head: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── NAV ── */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo span {
  background: #111827;
  color: white;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.nav-back {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── PAGE ── */
.page { padding: 48px 16px 64px; }

/* ── HEADER ── */
.header { text-align: center; margin-bottom: 40px; }

.header h1 {
  font-family: var(--font-head);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--text);
}

.header p {
  font-family: var(--font-body);
  color: var(--muted);
  margin-top: 10px;
  font-size: 16px;
}

/* ── CARD ── */
.card {
  background: var(--white);
  border-radius: 20px;
  border: 1px solid var(--border);
  max-width: 1100px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
}

.left-col { width: 50%; padding: 28px; border-right: 1px solid var(--border); }
.right-col { width: 50%; padding: 28px; }

/* ── SECTION LABEL ── */
.section-label {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ── COLOR INPUTS ── */
.color-inputs { display: flex; gap: 12px; margin-bottom: 24px; }
.color-field { flex: 1; }

.color-field label {
  display: block;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.color-row { display: flex; align-items: center; gap: 8px; }

.swatch-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
}

.swatch-wrap input[type=color] {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  opacity: 0;
  cursor: pointer;
}

.swatch-preview { width: 100%; height: 100%; pointer-events: none; }

.hex-input {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: border 0.2s;
    width: 100%;
}

.hex-input:focus { border-color: #6b7280; }

/* ── TABS ── */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.tab {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: var(--white);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-head);
  transition: all 0.15s;
  color: #374151;
}

.tab.active { background: #111827; color: white; border-color: #111827; }
.tab:hover:not(.active) { background: #f3f4f6; }

/* ── PREVIEW BOX ── */
.preview-box {
  border-radius: 12px;
  padding: 24px;
  min-height: 160px;
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s;
}

.preview-box h2 {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

.preview-box p.body { font-size: 16px; line-height: 1.7; margin-bottom: 8px; }
.preview-box p.small { font-size: 13px; opacity: 0.9; }
.preview-box p.large { font-size: 18px; line-height: 1.6; }

.graphic-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.graphic-icon {
  width: 40px; height: 40px; border-radius: 10px;
  border-width: 3px; border-style: solid;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.graphic-bar { flex: 1; height: 12px; border-radius: 6px; }
.graphic-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.graphic-btn {
  padding: 6px 14px; border-radius: 8px;
  border-width: 2px; border-style: solid;
  font-size: 13px; font-weight: 600;
  font-family: var(--font-head);
  background: transparent; cursor: default;
}

.preview-box p.caption { font-size: 12px; opacity: 0.85; }

/* ── RATIO ── */
.ratio-num {
  font-family: var(--font-head);
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
}

.ratio-sub {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 14px;
}

/* ── BAR ── */
.bar-track {
  background: #e5e7eb;
  border-radius: 999px;
  height: 8px;
  position: relative;
  margin-bottom: 4px;
}

.bar-fill { height: 8px; border-radius: 999px; transition: width 0.35s; }

.bar-marker {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: #9ca3af;
  transform: translateX(-50%);
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 20px;
}

.muted { color: #d1d5db; }

/* ── WCAG ROWS ── */
.wcag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  background: #f9fafb;
  margin-bottom: 6px;
}

.wcag-label {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.wcag-sub {
  font-family: var(--font-body);
  font-size: 12px;
  color: #9ca3af;
  margin-left: 6px;
}

.badge {
  font-family: var(--font-head);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pass { background: #dcfce7; color: #166534; }
.fail { background: #fee2e2; color: #991b1b; }

/* ── HOW IT WORKS ── */
.how-section {
  max-width: 1100px;
  margin: 24px auto 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.how-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.how-col-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.how-step { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }

.how-num {
  min-width: 24px; height: 24px; border-radius: 50%;
  background: #111827; color: white;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-head);
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}

.how-step p {
  font-family: var(--font-body);
  font-size: 13px;
  color: #4b5563;
  line-height: 1.55;
}

.level-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.level-chip {
  min-width: 54px; padding: 4px 8px; border-radius: 6px;
  font-family: var(--font-head);
  font-size: 12px; font-weight: 700; text-align: center;
}

.level-desc {
  font-family: var(--font-body);
  font-size: 12px;
  color: #4b5563;
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  margin: 36px auto 0;
  max-width: 900px;
  font-family: var(--font-body);
  font-size: 14px;
  color: #9ca3af;
  line-height: 1.8;
  padding: 0 16px;
}

.footer strong { color: #374151; }
.footer a { color: #3b82f6; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .header h1 { font-size: 32px; }
  .card { flex-direction: column; }
  .left-col, .right-col { width: 100%; border-right: none; }
  .left-col { border-bottom: 1px solid var(--border); }
  .color-inputs { flex-direction: column; }
  .how-grid { grid-template-columns: 1fr; }
  nav { padding: 0 16px; }
}
