/* Blind Typing & Email Safety Assistant
   High-contrast, large-control, keyboard-first styling.
   Designed to also be usable by low-vision (not only no-vision) users. */

:root {
  --bg: #000000;
  --fg: #ffffff;
  --accent: #ffd400;        /* high-contrast yellow */
  --accent-fg: #000000;
  --field-bg: #111418;
  --border: #ffffff;
  --focus: #00e5ff;         /* bright cyan focus ring */
  --risk-low: #00c853;
  --risk-medium: #ffd400;
  --risk-high: #ff8a00;
  --risk-critical: #ff1744;
  --font-size: 20px;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win, even over display:flex/grid rules
   below (e.g. .overlay). Without this, hidden panels stay visible. */
[hidden] { display: none !important; }

html { font-size: var(--font-size); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, Arial, sans-serif;
  line-height: 1.5;
  padding: 0 0 4rem;
}

/* ---- Screen-reader-only utility ---- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.75rem 1rem;
  font-weight: bold;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ---- Layout ---- */
header, nav, main, footer {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

h1 { font-size: 1.9rem; margin: 0.25rem 0; }
h2 { font-size: 1.5rem; border-bottom: 2px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.2rem; }

.tagline { font-size: 1.05rem; }
.hint { font-size: 0.95rem; opacity: 0.9; }

kbd {
  background: var(--field-bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 0.05em 0.45em;
  font-family: ui-monospace, monospace;
  font-weight: bold;
}

/* ---- Command bar ---- */
.commandbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}

/* ---- Buttons & large controls ---- */
button,
select,
input[type="file"]::file-selector-button {
  font-size: 1.05rem;
  font-family: inherit;
  min-height: 3rem;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border: 3px solid var(--accent);
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
}
button:hover,
input[type="file"]::file-selector-button:hover { filter: brightness(1.1); }

select {
  background: var(--field-bg);
  color: var(--fg);
  border: 3px solid var(--border);
}

/* ---- Form fields ---- */
.field { margin: 1rem 0; }

label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

textarea,
input[type="text"],
input[type="file"] {
  width: 100%;
  font-size: 1.1rem;
  font-family: inherit;
  color: var(--fg);
  background: var(--field-bg);
  border: 3px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
}

textarea { resize: vertical; min-height: 8rem; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

/* ---- Visible focus everywhere ---- */
:focus { outline: none; }
:focus-visible,
a:focus, button:focus, select:focus, input:focus, textarea:focus,
[tabindex]:focus, #help-list li:focus {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

/* ---- Help overlay / dialog ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
#help-dialog {
  background: var(--bg);
  border: 4px solid var(--accent);
  border-radius: 14px;
  max-width: 42rem;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
}
#help-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
#help-list li {
  padding: 0.85rem 1rem;
  border: 3px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
}
#help-list li[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: bold;
}

/* ---- Analysis result ---- */
.result {
  margin-top: 1.5rem;
  border: 3px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.risk-line { font-size: 1.2rem; font-weight: bold; }
.risk-badge {
  display: inline-block;
  padding: 0.15em 0.7em;
  border-radius: 8px;
  border: 3px solid var(--fg);
  color: #000;
}
.risk-badge.low { background: var(--risk-low); }
.risk-badge.medium { background: var(--risk-medium); }
.risk-badge.high { background: var(--risk-high); }
.risk-badge.critical { background: var(--risk-critical); color: #fff; }

#result-reasons li { margin-bottom: 0.35rem; }

/* ---- Reduced motion respect ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Small screens ---- */
@media (max-width: 600px) {
  :root { --font-size: 18px; }
  .commandbar button { flex: 1 1 45%; }
}
