/* Constant Agony Enterprises, LLC: site stylesheet. Mobile-first; breakpoints 640px / 1024px. */

@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand colors */
  --color-primary: #DC143C;
  --color-primary-hover: #990000;
  --color-black: #0A0A0A;

  /* Neutrals and grays */
  --color-dark-gray: #121824;
  --color-mid-gray: #4B5563;      /* borders / disabled only: fails AA as text on black */
  --color-light-gray: #E5E7EB;
  --color-white: #FFFFFF;
  --color-border: #1F2937;
  --color-status-success: #10B981;

  /* Additions */
  --color-text-muted: #9CA3AF;    /* secondary text, AA on black and on dark-gray */
  --color-link: #FF6B86;          /* small-text crimson tint, AA on black and on dark-gray */

  --font-heading: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 8px;
  --header-h: 64px;
  --max-w: 1160px;
  --gutter: 1rem;
}

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

html { scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-black);
  color: var(--color-light-gray);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-white);
  margin: 0 0 0.75rem;
}
h1 { font-size: clamp(2.25rem, 8vw, 4rem); }
h2 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }
a { color: var(--color-link); text-underline-offset: 3px; }
a:hover { color: var(--color-white); }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 100;
  background: var(--color-primary); color: var(--color-white);
  padding: 0.75rem 1rem; border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: var(--gutter); }

.container { width: 100%; max-width: var(--max-w); margin-inline: auto; padding-inline: var(--gutter); }

/* Sections */
.section { padding-block: 3rem; }
.section-alt { background: var(--color-dark-gray); border-block: 1px solid var(--color-border); }
.eyebrow {
  font-family: var(--font-heading); font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--color-link); font-size: 1rem; margin-bottom: 0.5rem;
}
.lead { font-size: 1.15rem; color: var(--color-light-gray); max-width: 62ch; }
.muted { color: var(--color-text-muted); }

/* Grid */
.grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 1.4rem; border-radius: 4px; border: 1px solid transparent;
  font-family: var(--font-heading); font-weight: 600; font-size: 1.1rem;
  letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; text-align: center;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--color-primary); color: var(--color-white); }
.btn-primary:hover { background: var(--color-primary-hover); color: var(--color-white); }
.btn-secondary { background: transparent; color: var(--color-white); border-color: var(--color-mid-gray); }
.btn-secondary:hover { border-color: var(--color-primary); color: var(--color-white); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* Cards */
.card {
  background: var(--color-dark-gray); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.5rem;
}
.card h3 { margin-bottom: 0.5rem; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card-accent { border-top: 3px solid var(--color-primary); }
.card ul, .prose ul, .prose ol { padding-left: 1.25rem; }

/* Chips and tags */
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.75rem;
  border: 1px solid var(--color-border); border-radius: 999px;
  font-size: 0.85rem; color: var(--color-light-gray); background: var(--color-black);
}
.chip-ok::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-status-success);
}
.chip-dev { border-color: var(--color-primary); }
.tag {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 0.8rem; border-radius: 999px;
  border: 1px solid var(--color-border); color: var(--color-light-gray); text-decoration: none; font-size: 0.9rem;
}
.tag:hover, .tag[aria-current="true"] { border-color: var(--color-primary); color: var(--color-white); }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0 0 1rem; list-style: none; }

/* Terminal / code block */
.terminal {
  background: var(--color-black); border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary); border-radius: 4px;
  padding: 1rem; font-family: var(--font-mono); font-size: 0.9rem;
  overflow-x: auto; color: var(--color-light-gray); word-break: break-all;
}
.terminal .prompt { color: var(--color-link); user-select: none; }

/* Breakpoints are in em (40em = 640px, 64em = 1024px, 80em = 1280px at the default size) so they follow the browser's font-size setting: with a larger default font the compact header and single-column layouts stay in use instead of overflowing. */
/* Notices */
.notice-draft {
  background: var(--color-dark-gray); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary); border-radius: 4px;
  padding: 1rem 1.25rem; margin-bottom: 2rem;
}
.notice-draft a, .card a { overflow-wrap: anywhere; } /* long addresses must wrap, not widen the grid (reflow at 320 px) */

/* Stats (threat metric) */
.stat-band { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.stat { padding: 1.25rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-black); }
.stat-value { font-family: var(--font-heading); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--color-white); }
.stat-label { color: var(--color-text-muted); margin-top: 0.4rem; }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
th { font-family: var(--font-heading); font-size: 1.1rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-white); background: var(--color-dark-gray); }
tr:last-child td { border-bottom: 0; }
.table-wrap.compact table { min-width: 0; }
.table-wrap.compact td { overflow-wrap: anywhere; }

/* Forms (search now; full forms arrive in sub-project 2) */
label { display: block; margin-bottom: 0.35rem; font-weight: 600; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; min-height: 48px; padding: 0.6rem 0.9rem; font: inherit;
  color: var(--color-white); background: var(--color-black);
  border: 1px solid var(--color-mid-gray); border-radius: 4px;
}
input:not([type="checkbox"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.35), 0 0 12px rgba(220, 20, 60, 0.5);
}
/* Checkboxes have no border to recolour, and the faint glow alone is about 1.4:1 against the page: they keep the solid outline from :focus-visible. */
input[type="checkbox"]:focus-visible { outline: 3px solid var(--color-link); outline-offset: 2px; }
.search-form { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }

/* Prose (legal pages, blog posts) */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2.25rem; font-size: 1.9rem; }
.prose h3 { margin-top: 1.5rem; }
.prose li { margin-bottom: 0.4rem; }

/* Hero */
.hero {
  padding-block: 3rem;
  background: radial-gradient(ellipse at 20% 0%, rgba(220, 20, 60, 0.2), transparent 60%), var(--color-black);
  border-bottom: 1px solid var(--color-border);
}
.hero-grid { display: grid; gap: 2rem; align-items: center; grid-template-columns: minmax(0, 1fr); }
.hero-emblem { justify-self: center; }
.hero-emblem img { width: min(80vw, 440px); height: auto; border-radius: 12px; background: #fff; box-shadow: 0 0 24px rgba(220, 20, 60, 0.35); }

/* CTA banner */
.cta-banner {
  display: grid; gap: 1rem; padding: 2rem 1.5rem; border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(220, 20, 60, 0.18), var(--color-dark-gray));
}
.cta-banner h2 { margin: 0; }
.cta-banner p { margin: 0; }

/* Header + nav */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(10, 10, 10, 0.96); border-bottom: 1px solid var(--color-border);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--color-white); min-height: 48px; }
.brand-emblem { width: auto; height: 44px; border-radius: 6px; background: #fff; }
.brand-word { display: none; font-family: var(--font-heading); font-weight: 700; line-height: 1; text-transform: uppercase; }
.brand-word .w1 { display: block; font-size: 1.5rem; letter-spacing: 0.04em; white-space: nowrap; }
.brand-word .w1 b { color: var(--color-primary); font-weight: 700; }
.brand-word .w2 { display: block; font-size: 0.8rem; letter-spacing: 0.14em; color: var(--color-text-muted); font-weight: 600; margin-top: 2px; }

.nav-toggle {
  width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--color-border); border-radius: 4px; color: var(--color-white); cursor: pointer;
}
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; width: 22px; height: 2px; background: currentColor; content: ""; position: relative;
}
.nav-toggle .bars::before { position: absolute; top: -7px; }
.nav-toggle .bars::after { position: absolute; top: 7px; }

.nav {
  position: fixed; top: var(--header-h); right: 0; bottom: 0; width: min(86vw, 340px);
  background: var(--color-dark-gray); border-left: 1px solid var(--color-border);
  padding: 1rem; overflow-y: auto; transform: translateX(100%); visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}
body.nav-open .nav { transform: none; visibility: visible; transition: transform 0.2s ease; }
body.nav-open::after { content: ""; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0, 0, 0, 0.6); z-index: 40; }
.nav { z-index: 60; }
.nav ul { list-style: none; margin: 0 0 1rem; padding: 0; }
.nav a:not(.btn) {
  display: flex; align-items: center; min-height: 48px; padding: 0 0.5rem;
  font-family: var(--font-heading); font-weight: 600; font-size: 1.2rem; letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none; color: var(--color-light-gray);
  border-bottom: 1px solid var(--color-border);
}
.nav a:not(.btn):hover { color: var(--color-white); }
.nav a[aria-current="page"] { color: var(--color-white); box-shadow: inset 3px 0 0 var(--color-primary); }
.nav-actions { display: grid; gap: 0.75rem; }

/* Footer */
.site-footer { background: var(--color-dark-gray); border-top: 1px solid var(--color-border); padding-top: 3rem; margin-top: 0; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
.footer-grid h2 { font-size: 1.2rem; color: var(--color-text-muted); letter-spacing: 0.1em; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li a { display: inline-flex; align-items: center; min-height: 36px; }
.footer-legal { border-top: 1px solid var(--color-border); margin-top: 2rem; padding-block: 1.25rem; color: var(--color-text-muted); font-size: 0.9rem; }

/* Tablet */
@media (min-width: 40em) {
  :root { --gutter: 1.5rem; }
  .section { padding-block: 4rem; }
  .brand-word { display: block; }
  .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-form { flex-direction: row; align-items: flex-end; }
  .search-form .field { flex: 1; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-banner { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 2.5rem; }
}

/* Desktop */
@media (min-width: 64em) {
  .section { padding-block: 5rem; }
  .hero { padding-block: 5rem; }
  .hero-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }

  .nav-toggle { display: none; }
  body.nav-open::after { display: none; }
  .nav {
    position: static; width: auto; padding: 0; overflow: visible; transform: none; visibility: visible;
    background: transparent; border: 0; display: flex; align-items: center; gap: 0.25rem; transition: none;
  }
  .nav ul { display: flex; margin: 0; gap: 0.1rem; }
  .nav a:not(.btn) { min-height: 48px; padding: 0 0.5rem; font-size: 1.05rem; border-bottom: 0; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--color-primary); }
  .nav-home { display: none; }
  .nav-actions { display: flex; margin-left: 0.5rem; gap: 0.5rem; }
  .nav-actions .btn { min-height: 44px; padding: 0 1rem; font-size: 1rem; }
}

@media (min-width: 64em) {
  .nav-actions .btn { white-space: nowrap; }
}

@media (min-width: 64em) {
  /* Compact stacked wordmark: with eight nav links there is no room for the one-line form at any desktop width. */
  .brand-word .w1 { white-space: normal; }
  .brand-word .w2 { display: none; }
}

@media (min-width: 80em) {
  .site-header .container { max-width: 1320px; } /* room for eight links plus two actions */
}

@media (min-width: 64em) and (max-width: 79.9375em) {
  .nav-actions .btn-secondary { display: none; } /* still linked from the footer */
  .nav-contact { display: none; }                /* also linked from the footer and the page CTAs */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Forms */
.form-wrap { max-width: 760px; }
.form .field { margin-bottom: 1.25rem; }
.form .req { color: var(--color-text-muted); font-weight: 400; }
.form .help, .help { color: var(--color-text-muted); font-size: 0.9rem; margin: 0.35rem 0 0; }
.form .field-error { color: var(--color-link); font-weight: 600; margin: 0.35rem 0 0; }
.form [aria-invalid="true"] { border-color: var(--color-primary); }
.form textarea { min-height: 9rem; resize: vertical; }
.form fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0; min-width: 0; }
.form legend { font-weight: 600; padding-inline: 0.4rem; }
.form .check { display: flex; align-items: center; gap: 0.6rem; min-height: 48px; font-weight: 400; margin: 0; cursor: pointer; }
.form .check input { width: 24px; height: 24px; flex: none; accent-color: var(--color-primary); }
.form-group { font-size: 1.5rem; margin-top: 2rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice {
  background: var(--color-dark-gray); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary); border-radius: 4px; padding: 1rem 1.25rem; margin: 0 0 1.5rem;
}
.notice p:last-child { margin-bottom: 0; }
.notice-ok { border-left-color: var(--color-status-success); }
.error-summary { border: 1px solid var(--color-primary); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--color-dark-gray); }
.error-summary h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.error-summary ul { margin: 0; padding-left: 1.25rem; }

/* Account setup: authenticator QR, key and one-time recovery codes */
.qr { background: #fff; display: inline-block; padding: 0.5rem; border-radius: 4px; margin: 0 0 1rem; }
.qr svg { display: block; width: 220px; max-width: 100%; height: auto; }
.totp-secret { word-spacing: 0.3em; overflow-wrap: anywhere; }
.recovery-codes { columns: 2 12rem; padding-left: 1.5rem; margin: 0 0 1.5rem; }
.recovery-codes li { margin-bottom: 0.4rem; }

/* Client portal */
.portal-card { margin-bottom: 1.5rem; }
.portal-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.25rem 1rem; margin: 0; }
.portal-meta dt { font-weight: 600; }
.portal-meta dd { margin: 0; }
.portal-panels { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-bottom: 2rem; }
.portal-codes { list-style: none; padding: 0; columns: 2; }
.portal-table td, .portal-table th { vertical-align: middle; }
.badge { display: inline-block; padding: 0 0.5rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.8125rem; }

/* Admin portal */
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.admin-actions form { margin: 0; }
.admin-actions .btn { min-height: 48px; }
.portal-table { margin: 0; }
.portal-table-reports td:first-child { min-width: 14rem; overflow-wrap: anywhere; }
.card .portal-reports { list-style: none; margin: 0; padding: 0; }
.portal-reports li { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 0.75rem 0; border-top: 1px solid var(--color-border); overflow-wrap: anywhere; }
.portal-reports li:first-child { border-top: 0; padding-top: 0; }
.portal-reports small { color: var(--color-text-muted); }
.portal-reports form { margin: 0.25rem 0 0; }
.portal-reports .btn { min-height: 48px; }
/* Tickets: long subjects wrap, long attachment names wrap inside their button, spacing between attachments and filter fields. */
.portal-table-tickets td:first-child { min-width: 14rem; overflow-wrap: anywhere; }
.portal-card form[action="/ticket-download"] { margin: 0.5rem 0 0; max-width: 100%; }
.portal-card form[action="/ticket-download"] .btn { max-width: 100%; padding-top: 0.6rem; padding-bottom: 0.6rem; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.table-wrap + h2, .table-wrap + form, .portal-card + form, .table-wrap + .search-form { margin-top: 2rem; }
.table-wrap { margin-bottom: 1.5rem; }
.portal-card .table-wrap { margin-bottom: 1rem; }

address { font-style: normal; }
