/* ==============================================================
   ResPilot — design system
   Source: ResumeReady_Mockups.html (the original ResPilot comps)

   Navy/blue brand with an orange-red accent and a gold highlight.
   DM Sans for everything, with one exception: pages that opt in with
   <body class="use-display-serif"> (today, only /index.html) keep
   Playfair Display for their hero headline.

   Class names mirror what the HTML already uses (.btn, .card,
   .nav, .page-title, etc.) so this stylesheet drops in without
   HTML rewrites. Legacy aliases (--black, --lime, etc.) map onto
   the ResPilot palette so any old markup keeps rendering sanely.
   ============================================================== */

:root {
  /* ---- ResPilot palette ---- */
  --navy:        #0F2040;
  --blue:        #1A5CB0;
  --sky:         #3B82F6;
  --accent:      #E8401C;   /* orange-red — primary CTA */
  --accent-hover:#CF3614;
  --gold:        #F5A623;   /* highlight / eyebrow accent */
  --light:       #F4F7FC;
  --white:       #FFFFFF;
  --gray:        #8896AB;
  --gray-dark:   #5B6B82;
  --border:      #DDE4EF;
  --green:       #22C55E;
  --red:         #EF4444;

  /* body / muted text */
  --body-text:   #4A5568;
  --muted:       #8896AB;
  --dark-text:   #1F2A44;

  /* ---- Legacy aliases so old class names keep working ---- */
  --black:           var(--navy);
  --lime:            var(--accent);
  --lime-hover:      var(--accent-hover);
  --surface:         var(--light);
  --border-light:    var(--border);
  --border-dark:     #C3CEE0;
  --dark-surface:    var(--navy);
  --darker-surface:  #0A1730;
  --overlay-lime:        rgba(232, 64, 28, 0.06);
  --overlay-lime-active: rgba(232, 64, 28, 0.10);

  /* ---- Typography ----
     --font-display is DM Sans by default; index.html opts back into
     Playfair via `body.use-display-serif` below. --font-headline-weight
     keeps headlines at 600 in DM Sans (where 700/900 would look heavy)
     and is overridden to 900 inside the serif scope. */
  --font-display:         'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:            'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-headline-weight: 600;

  /* ---- Spacing ---- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;

  /* ---- Radius (ResPilot uses soft, rounded corners) ---- */
  --radius:    8px;
  --radius-lg: 16px;

  /* ---- Shadows — soft, navy-tinted ---- */
  --shadow:    0 2px 8px rgba(15, 32, 64, 0.06);
  --shadow-lg: 0 8px 40px rgba(15, 32, 64, 0.12), 0 2px 8px rgba(15, 32, 64, 0.06);
}

/* ==============================================================
   Import Google Fonts. We also ship a <link> tag in each HTML
   file for faster first paint, but the @import is a safety net.
   ============================================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

/* Pages that want Playfair for their display headlines (currently just
   /index.html) declare `class="use-display-serif"` on <body>. The font
   itself is loaded by a <link> in that page, since most pages don't
   need it. */
body.use-display-serif {
  --font-display:         'Playfair Display', Georgia, serif;
  --font-headline-weight: 900;
}

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

html, body {
  font-family: var(--font-body);
  background: var(--light);
  color: var(--body-text);
  min-height: 100vh;
  line-height: 1.7;
  font-size: 14px;
  font-weight: 400;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover { color: var(--navy); }

/* ==============================================================
   Typography
   ============================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-headline-weight);
  color: var(--navy);
  line-height: 1.2;
}

.page-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: var(--font-headline-weight);
  line-height: 1.15;
  color: var(--navy);
  margin-bottom: 8px;
}
.page-sub {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  color: var(--body-text);
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 620px;
}

/* Card titles use DM Sans, not the display serif */
.card h2 {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--navy);
  margin-bottom: 4px;
  text-transform: none;
}

.hint {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--gray);
  line-height: 1.6;
}

/* Micro section tags — the uppercase accent labels used above
   card titles, stage labels, etc. */
.micro-label,
.page-sub .micro-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray);
}

/* ==============================================================
   Navigation bar
   ============================================================== */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: var(--font-headline-weight);
  letter-spacing: 0;
  color: var(--navy);
  text-decoration: none;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav-logo:hover { color: var(--navy); }

/* ResPilot logo image in the nav.
   The source PNG is a near-square icon-above-wordmark lockup on a
   white field. We give it a fixed display box and use object-fit
   so it sits cleanly in the bar; the white margin in the asset
   blends into the white nav background. */
.nav-logo img,
.nav-logo .logo-img {
  height: 48px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  display: block;
}

/* When the brand is rendered as text instead of the image,
   the "Pilot" tail picks up the accent color. */
.nav-logo .tail { color: var(--accent); }

.nav-links {
  margin-left: auto;
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-links a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gray);
  text-decoration: none;
}
.nav-links a:hover { color: var(--navy); }
.nav-links a.active { color: var(--navy); font-weight: 600; }

/* ==============================================================
   Layout
   ============================================================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 32px 64px;
}

/* ==============================================================
   Cards
   ============================================================== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-active {
  border: 1.5px solid var(--blue);
}
/* legacy .card-lime — now the navy/accent highlight card */
.card-lime {
  background: var(--navy);
  border: 1px solid var(--navy);
  color: var(--white);
}
.card-dark {
  background: var(--navy);
  border: 1px solid var(--navy);
  color: var(--white);
  padding: 24px 20px;
}
.card-accent-rule {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
}

/* ==============================================================
   Forms
   ============================================================== */
label {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 8px;
  color: var(--navy);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--dark-text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--blue);
  border-width: 1.5px;
  /* Shift padding 0.5px to compensate for the thicker border, so
     the field doesn't appear to "grow" on focus */
  padding: 11.5px 13.5px;
  box-shadow: 0 0 0 3px rgba(26, 92, 176, 0.10);
}

textarea { min-height: 160px; line-height: 1.6; }
textarea.rich { min-height: 200px; }
textarea.jd { min-height: 320px; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%230F2040' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* File upload drop zone */
.file-drop {
  display: block;
  border: 2px dashed var(--border);
  background: var(--light);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover,
.file-drop.dragover {
  border-color: var(--blue);
  background: var(--white);
}
.file-drop .big {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--navy);
}
.file-drop .sm {
  font-size: 12px;
  color: var(--gray);
  margin-top: 6px;
  letter-spacing: 0;
}
.file-drop.has-file {
  border-style: solid;
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.08);
}
.file-drop.has-file .big { color: var(--navy); }
.file-drop input[type="file"] { display: none; }

/* "— or paste the text —" divider */
.field-split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--gray);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.field-split::before, .field-split::after {
  content: "";
  height: 1px;
  background: var(--border);
}

/* Password field show/hide toggle */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 56px; }
.password-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--gray);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius);
}
.password-toggle:hover { color: var(--blue); }
.password-toggle:focus {
  outline: none; color: var(--blue);
  box-shadow: 0 0 0 2px rgba(26, 92, 176, 0.25);
}

.match-hint {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--gray);
  text-transform: none;
  font-weight: 400;
}
.match-hint.ok  { color: var(--green); }
.match-hint.bad { color: var(--red); }

/* ==============================================================
   Buttons
   ============================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 11px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1.3;
}

/* Primary = orange-red accent, white text */
.btn-primary {
  background: var(--accent);
  color: var(--white);
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--white); }
.btn-primary:disabled {
  background: var(--border); color: var(--gray);
  cursor: not-allowed; border-color: var(--border);
}

/* Legacy .btn-lime — now an alias of the accent primary button */
.btn-lime {
  background: var(--accent);
  color: var(--white);
  border: 1px solid var(--accent);
}
.btn-lime:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--white); }

/* Secondary = outline on light */
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--border);
  font-weight: 600;
}
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); background: var(--white); }

/* Outline on dark background */
.btn-outline-dark {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-weight: 500;
}
.btn-outline-dark:hover { border-color: var(--white); }

.btn-lg { padding: 14px 32px; font-size: 15px; }

/* ==============================================================
   Builder layout (two column)
   ============================================================== */
.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .builder-grid { grid-template-columns: 1fr; } }

.submit-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

/* ==============================================================
   Loader / spinner
   ============================================================== */
.loader {
  display: none;
  text-align: center;
  padding: 48px 20px;
}
.loader.active { display: block; }
.loader .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader .msg {
  color: var(--body-text);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* ==============================================================
   Alerts
   ============================================================== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  letter-spacing: 0;
  margin-bottom: 16px;
  background: var(--light);
  color: var(--dark-text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
}
.alert-error {
  background: rgba(239, 68, 68, 0.05);
  color: #B42318;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-left: 3px solid var(--red);
}

/* ==============================================================
   Result page
   ============================================================== */
.result-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .result-grid { grid-template-columns: 1fr; } }

.synopsis h3 {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 20px 0 8px;
  color: var(--gray);
}
.synopsis h3:first-child { margin-top: 0; }

.keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--body-text);
}
.chip.added  { background: rgba(34, 197, 94, 0.12); border-color: var(--green); color: #15803D; font-weight: 600; }
.chip.missing { background: rgba(239, 68, 68, 0.06); color: var(--red); border-color: rgba(239, 68, 68, 0.4); }

.ats-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
.ats-score .n {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: var(--font-headline-weight);
  color: var(--navy);
  line-height: 1;
}
.ats-score .d {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray);
}

.download-row { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* ==============================================================
   Resume preview
   ============================================================== */
/* The resume document itself draws no chrome — the surrounding card
   (.hm-preview-card on /home.html, .card on /result.html) provides
   the border, padding, and shadow. Otherwise the preview ends up with
   nested borders because renderHtml.js also wraps its output in
   <div class="resume-doc">. */
.resume-doc {
  background: transparent;
  color: var(--navy);
  font-family: Calibri, 'Segoe UI', Tahoma, sans-serif;
  font-size: 11pt;
  line-height: 1.4;
}
.resume-doc .resume-name {
  text-align: center;
  font-size: 18pt;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0;
}
.resume-doc .resume-contact { text-align: center; font-size: 10pt; color: #333; }
.resume-doc .resume-headline { text-align: center; font-size: 12pt; font-weight: 700; margin-top: 10px; }
.resume-doc .resume-subheadline { text-align: center; font-size: 10pt; font-style: italic; color: #444; }
.resume-doc .resume-section {
  text-transform: uppercase;
  font-size: 11pt;
  font-weight: 700;
  margin-top: 18px;
  padding-bottom: 3px;
  border-bottom: 1px solid #888;
  letter-spacing: 0.05em;
}
.resume-doc p { margin: 6px 0; }
.resume-doc ul { margin: 4px 0 6px 18px; }
.resume-doc li { margin-bottom: 3px; }
.resume-doc .role { margin-bottom: 12px; }
.resume-doc .role-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  gap: 12px;
}
.resume-doc .role-title { font-style: italic; }
.resume-doc .role-summary { margin: 4px 0; }
.resume-doc .sep { color: #888; }

/* ==============================================================
   Home / resume list
   ============================================================== */
.resume-list { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

.resume-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.resume-row:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}
.resume-row .title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0;
}
.resume-row .meta {
  font-size: 12px;
  color: var(--gray);
  margin-top: 3px;
  letter-spacing: 0;
}
.resume-row .score {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: var(--font-headline-weight);
  color: var(--blue);
  line-height: 1;
}

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--body-text);
}
.empty .big {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: var(--font-headline-weight);
  color: var(--navy);
  margin-bottom: 8px;
}

/* ==============================================================
   Stat / metric display (reusable)
   ============================================================== */
.stat .n {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: var(--font-headline-weight);
  color: var(--navy);
  line-height: 1;
}
.stat .l {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--gray);
  margin-top: 4px;
  text-transform: uppercase;
}

/* ==============================================================
   Section label / badge components
   ============================================================== */
/* legacy .tag-black — navy chip with white text */
.tag-black {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  text-transform: uppercase;
  border-radius: 20px;
}
/* legacy .tag-lime — accent chip with white text */
.tag-lime {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  text-transform: uppercase;
  border-radius: 20px;
}

/* ==============================================================
   Progress bar (score bars)
   ============================================================== */
.progress {
  height: 6px;
  width: 100%;
  background: var(--border);
  border-radius: 3px;
  margin-top: 4px;
}
.progress > .fill {
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
}
.progress.dark > .fill { background: var(--gold); }
