/* =========================================================================
   Certline — TLS Certificate Checker
   Brand: brutalist diagnostic tool (see assets/brand.md)
   ========================================================================= */

/* --- Reset & base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand palette */
  --color-bg:         #FAFAFA;
  --color-surface:    #FFFFFF;
  --color-text:       #1A1A1A;
  --color-text-muted: #595959;
  --color-accent:     #E65100;
  --color-danger:     #C62828;
  --color-safe:       #2E7D32;
  --color-border:     #D4D4D4;
  --color-struct:     #444444;

  /* Tokens from brand spec */
  --radius:      0px;
  --space-unit:  4px;

  /* Typography — loaded via Google Fonts in index.html head */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Links: accent colour, immediate hover (100ms, no transition function) */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  color: #BF3D00;  /* darker shade of accent, immediate swap */
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Accessibility ----------------------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- Header ------------------------------------------------------------ */
header {
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo { color: var(--color-accent); }

.tagline {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* --- Form -------------------------------------------------------------- */
#check-form {
  margin: 1.5rem 0;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

#host-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1.1rem;
  font-family: var(--font-mono);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  outline: none;
}

#host-input:focus {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

#host-input::placeholder { color: var(--color-text-muted); }

#check-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  background: var(--color-accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}

#check-btn:hover { background: #BF3D00; }  /* immediate colour swap */

#check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

/* --- Status bar -------------------------------------------------------- */
.status-bar {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* --- Results ----------------------------------------------------------- */
#results {
  margin-top: 1.5rem;
}

.result-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.result-section h2 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.details-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

.details-list dt {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.details-list dd {
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-list li {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.empty-state {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* --- Chain verdict badge ---------------------------------------------- */
.verdict-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  border: 1px solid;
}

.verdict-badge.complete {
  border-color: var(--color-safe);
  color: var(--color-safe);
}
.verdict-badge.incomplete {
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.verdict-badge.warning {
  border-color: var(--color-text-muted);
  color: var(--color-text-muted);
}

/* --- Chain cert cards ------------------------------------------------- */
.cert-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.cert-card:first-child { margin-top: 0; }

.cert-card-header {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

.cert-card dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.75rem;
}

.cert-card dt { color: var(--color-text-muted); }
.cert-card dd { word-break: break-all; font-family: var(--font-mono); font-size: 0.8rem; }

/* --- Raw fields ------------------------------------------------------- */
.raw-field {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.raw-field:last-child { border-bottom: none; }
.raw-field .key { color: var(--color-text-muted); }
.raw-field .value { text-align: right; max-width: 60%; word-break: break-all; }

/* --- Error box -------------------------------------------------------- */
.error-box {
  margin-top: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.9rem;
}

/* --- Footer ----------------------------------------------------------- */
footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

footer p { max-width: 600px; }

footer .footer-links {
  margin-top: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

footer .footer-links a {
  font-size: 0.78rem;
}

.footnote { margin-top: 0.75rem; font-size: 0.78rem; }

/* --- Responsive ------------------------------------------------------- */
@media (max-width: 540px) {
  .input-group { flex-direction: column; }
  #check-btn { width: 100%; }
  .details-list { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .details-list dt { margin-top: 0.3rem; }
}
