/* Resume Fit Analyzer - interface styles
   Light is the default; [data-theme="dark"] switches the token set. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --ink: #0f1720;
  --ink-soft: #38414f;
  --muted: #5b6472;
  --line: #e3e8ef;
  --line-strong: #cfd6e0;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f1;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .06);
  --radius: 14px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  --bg: #0b0f16;
  --surface: #141a23;
  --surface-2: #1a212c;
  --ink: #e7eef6;
  --ink-soft: #c3ccd8;
  --muted: #8f9aa8;
  --line: #232c39;
  --line-strong: #303b4b;
  --accent: #2dd4bf;
  --accent-ink: #052b26;
  --accent-soft: #10312e;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

/* the hidden attribute must win over component display rules */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.dot { color: var(--line-strong); padding: 0 .35rem; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: .7rem; }

.mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .02em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: Fraunces, Georgia, serif; font-size: 1.05rem; font-weight: 600; }
.brand-sub { font-size: .74rem; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: .6rem; }

.status {
  font-size: .76rem;
  padding: .3rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.status[data-state="ready"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.status[data-state="degraded"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.icon-btn {
  font: inherit;
  font-size: .76rem;
  padding: .32rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- layout ---------- */

.shell {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.6rem 1.5rem 2.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1.4rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

h1 { font-family: Fraunces, Georgia, serif; font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .92rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.lede { color: var(--muted); margin-top: .5rem; font-size: .92rem; }
.fineprint { color: var(--muted); font-size: .78rem; margin-top: .9rem; }

/* ---------- form ---------- */

form { margin-top: 1.2rem; display: grid; gap: 1rem; }

.field { display: grid; gap: .4rem; }
.label { font-size: .8rem; font-weight: 500; color: var(--ink-soft); }

input[type="text"], textarea {
  font: inherit;
  width: 100%;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .62rem .7rem;
  resize: vertical;
}
textarea { min-height: 180px; }
input[type="text"]:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

.dropzone {
  display: grid;
  justify-items: center;
  gap: .3rem;
  text-align: center;
  padding: 1.3rem 1rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }

.drop-icon {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: .18rem .45rem;
}
.drop-title { font-size: .88rem; font-weight: 500; }
.drop-hint { font-size: .76rem; color: var(--muted); max-width: 34ch; }

.actions { display: flex; gap: .6rem; align-items: center; }

button.primary, button.ghost {
  font: inherit;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: .62rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter .15s, opacity .15s;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.primary:disabled { opacity: .55; cursor: progress; }
button.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- empty state ---------- */

.empty h2 { margin-bottom: .9rem; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.how li { display: grid; gap: .1rem; padding-left: 1.1rem; position: relative; }
.how li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .5rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.how b { font-size: .88rem; font-weight: 600; }
.how span { font-size: .84rem; color: var(--muted); }

/* ---------- progress ---------- */

.progress h2 { margin-bottom: .9rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }

.step {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .88rem;
  color: var(--muted);
}
.step::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex: none;
  box-sizing: border-box;
}
.step[data-state="running"] { color: var(--ink); }
.step[data-state="running"]::before {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}
.step[data-state="done"] { color: var(--ink-soft); }
.step[data-state="done"]::before { background: var(--ok); border-color: var(--ok); }
.step[data-state="failed"] { color: var(--bad); }
.step[data-state="failed"]::before { background: var(--bad); border-color: var(--bad); }

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

.note { font-size: .8rem; color: var(--muted); margin-top: .8rem; }

/* ---------- error ---------- */

.error-box {
  margin-top: 1rem;
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  background: color-mix(in srgb, var(--bad) 8%, var(--surface));
  color: var(--bad);
  border-radius: var(--radius-sm);
  padding: .8rem .9rem;
  font-size: .86rem;
  white-space: pre-wrap;
}

/* ---------- result ---------- */

.result { margin-top: 1.2rem; display: grid; gap: 1.3rem; }

.score { display: flex; align-items: center; gap: 1.2rem; }

.score-ring {
  --pct: 0;
  --ring: var(--ok);
  position: relative;
  width: 104px;
  height: 104px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--line) 0);
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
}
.score-ring > * { position: relative; }
.score-ring span { font-size: 1.9rem; font-weight: 600; line-height: 1; }
.score-ring small { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.score-ring[data-band="warn"] { --ring: var(--warn); }
.score-ring[data-band="bad"] { --ring: var(--bad); }
.score-ring[data-band="ok"] { --ring: var(--ok); }

.score-copy { flex: 1; min-width: 0; display: grid; gap: .35rem; }
#fitLabel { font-size: 1.15rem; }

.bar { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .5s ease; }

.notes { display: grid; gap: .35rem; }
.notes .note-line {
  font-size: .8rem;
  border-radius: 8px;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
}
.notes .note-line[data-status="error"] {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}

.block { border-top: 1px solid var(--line); padding-top: 1rem; display: grid; gap: .6rem; }

.prose { font-size: .9rem; color: var(--ink-soft); display: grid; gap: .5rem; }
.prose h4 { margin: .2rem 0 0; font-size: .88rem; font-weight: 600; color: var(--ink); }
.prose ul, .prose ol { margin: 0; padding-left: 1.15rem; display: grid; gap: .25rem; }
.prose code {
  font-size: .82rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .05rem .3rem;
}

.parsed summary {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.parsed summary:hover { color: var(--accent); }
.parsed-grid { display: grid; gap: .55rem; margin-top: .8rem; font-size: .85rem; }
.parsed-grid dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.parsed-grid dd { margin: .1rem 0 0; color: var(--ink-soft); white-space: pre-wrap; }
.parsed-grid ul { margin: .1rem 0 0; padding-left: 1.1rem; display: grid; gap: .2rem; color: var(--ink-soft); }

/* ---------- footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.5rem 1.4rem;
  color: var(--muted);
  font-size: .78rem;
  border-top: 1px solid var(--line);
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 1.1rem 1rem 2rem; }
  .topbar { padding: .7rem 1rem; }
  .brand-sub { display: none; }
}

@media (max-width: 560px) {
  .panel { padding: 1.1rem; }
  .score { flex-direction: column; align-items: flex-start; gap: .9rem; }
  .actions { flex-wrap: wrap; }
  button.primary { flex: 1; }
  .score-ring { width: 92px; height: 92px; }
}
