/* CamTrust — mobile-first layout, expands to two columns >= 900px (projector). */

:root {
  --green: #007a3d;
  --red: #ce1126;
  --amber: #b8860b;
  --amber-bg: #fff6dc;
  --green-bg: #e6f5ec;
  --red-bg: #fbe6e8;
  --ink: #1a1a1a;
  --muted: #5f6368;
  --border: #d8dce0;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --radius: 10px;
  --gap: 16px;
  --focus: #1a73e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

img { max-width: 100%; }

button {
  font: inherit;
  cursor: pointer;
}

a { color: var(--green); }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- App shell ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.app-header__logo { height: 28px; display: block; }

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quota-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  background: var(--bg);
}
.quota-badge:hover { background: var(--green-bg); }

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.lang-switch button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--green);
  color: #fff;
}

.how-link {
  font-size: 0.85rem;
  white-space: nowrap;
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--gap);
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px 16px 32px;
}

/* ---------- Language picker overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.overlay__card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.overlay__choices {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 1rem;
  min-height: 44px;
}

.btn--primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn--block { width: 100%; }

.overlay__choices .btn { flex: 1; }

/* ---------- Layout: home two-column on projector ---------- */

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 900px) {
  .layout--split {
    grid-template-columns: minmax(320px, 420px) 1fr;
    align-items: start;
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap);
}

.tagline {
  font-size: 1.1rem;
  margin: 0 0 var(--gap);
}

/* ---------- Upload zone ---------- */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.upload-zone.is-dragover {
  border-color: var(--green);
  background: var(--green-bg);
}

.upload-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 480px) {
  .upload-actions { flex-direction: row; }
}

.upload-actions .btn { flex: 1; }

/* ---------- History strip ---------- */

.history-strip {
  margin-top: var(--gap);
}

.history-strip__list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  list-style: none;
  margin: 8px 0 0;
}

.history-item {
  flex: 0 0 auto;
  width: 76px;
  text-align: center;
  border: 0;
  background: transparent;
  padding: 0;
}

.history-item__thumb {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}

.history-item__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 1.5rem;
}

.history-item[data-verdict="vert"] .history-item__thumb { border-color: var(--green); }
.history-item[data-verdict="orange"] .history-item__thumb { border-color: var(--amber); }
.history-item[data-verdict="rouge"] .history-item__thumb { border-color: var(--red); }

.history-item__label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Analyzing ---------- */

.analyzing__preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #000;
}

.analyzing__step {
  margin-top: 16px;
  font-size: 1rem;
  color: var(--muted);
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 16px auto 0;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result screen ---------- */

.result-grid {
  display: grid;
  gap: var(--gap);
}

@media (min-width: 900px) {
  .result-grid {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }
}

.gauge-wrap {
  text-align: center;
}

.gauge {
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
}

.gauge__score {
  font-size: 2.2rem;
  font-weight: 700;
}

.gauge__label {
  color: var(--muted);
  font-size: 0.85rem;
}

.verdict-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 10px;
}

.verdict-chip[data-verdict="vert"] { background: var(--green-bg); color: var(--green); }
.verdict-chip[data-verdict="orange"] { background: var(--amber-bg); color: var(--amber); }
.verdict-chip[data-verdict="rouge"] { background: var(--red-bg); color: var(--red); }

.confidence-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.explanation-card h2 {
  margin-top: 0;
}

.advice-list {
  padding-left: 20px;
}

.caveat {
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 10px;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: var(--gap);
  overflow: hidden;
}

.accordion__toggle {
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--card-bg);
  padding: 14px 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion__panel {
  padding: 0 16px 16px;
}

.signal-row {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.signal-row:first-child { border-top: 0; }

.signal-row__name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.signal-row__score {
  font-size: 0.8rem;
  color: var(--muted);
}

.signal-row__detail {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.ela-toggle-wrap { margin-top: var(--gap); }

.ela-heatmap {
  margin-top: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.frame-timeline {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 80px;
  margin-top: 10px;
}

.frame-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--green);
  min-height: 4px;
}
.frame-bar[data-level="orange"] { background: var(--amber); }
.frame-bar[data-level="rouge"] { background: var(--red); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: var(--gap);
}

/* ---------- Error banner ---------- */

.banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.banner--error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

/* ---------- Quota modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

@media (min-width: 600px) {
  .modal {
    align-items: center;
    padding: 16px;
  }
}

.modal__card {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 600px) {
  .modal__card { border-radius: var(--radius); }
}

.modal__close {
  float: right;
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
}

.tier-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}

@media (min-width: 600px) {
  .tier-cards { grid-template-columns: repeat(3, 1fr); }
}

.tier-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.tier-card__price {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 8px 0;
}

.tier-card__limit {
  color: var(--muted);
  font-size: 0.85rem;
}

.tier-card .btn {
  margin-top: 12px;
  width: 100%;
}

/* ---------- How it works page ---------- */

.how-page h1, .how-page h2 { line-height: 1.25; }

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}

.benchmark-table th, .benchmark-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.pipeline-img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
}

.limitations {
  background: var(--amber-bg);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--ink);
}
