/* ==========================================================================
   Resume Roast AI — design tokens
   ========================================================================== */
:root {
  --bg-deep: #0a0714;
  --bg-mid: #140c29;
  --bg-mid-2: #1c1038;

  --violet: #8b5cf6;
  --violet-bright: #b794ff;
  --cyan: #2dd4e8;
  --cyan-bright: #7ff0fb;

  --ember: #ff6b5b;
  --mint: #4ade80;
  --amber: #ffb454;

  --text-hi: #f3efff;
  --text-lo: #a99fc4;
  --text-faint: #6e6489;

  --glass-bg: rgba(255, 255, 255, 0.045);
  --glass-bg-strong: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-bright: rgba(183, 148, 255, 0.45);

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text-hi);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Ambient background
   ========================================================================== */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, var(--bg-mid-2) 0%, var(--bg-deep) 55%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  will-change: transform;
}

.orb-violet {
  width: 640px;
  height: 640px;
  top: -220px;
  left: -160px;
  background: radial-gradient(circle, var(--violet) 0%, transparent 70%);
  animation: drift-a 22s ease-in-out infinite;
}

.orb-cyan {
  width: 560px;
  height: 560px;
  bottom: -260px;
  right: -180px;
  background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
  animation: drift-b 26s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.08); }
}

@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -30px) scale(1.05); }
}

.grain {
  position: absolute;
  inset: -10%;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Layout shell
   ========================================================================== */
.page {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 60px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin: 0 0 8px 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-lo);
  letter-spacing: 0.01em;
}

.wordmark-mark {
  font-size: 16px;
  filter: drop-shadow(0 0 10px rgba(255, 107, 91, 0.5));
}

.stage {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding-top: 4vh;
}

.page-footer {
  margin-top: 40px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

/* ==========================================================================
   Views (state machine)
   ========================================================================== */
.view {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
}

.view[data-active="true"] {
  display: flex;
  animation: view-in 0.5s var(--ease-out);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  text-align: center;
  max-width: 520px;
  margin-bottom: 36px;
}

.headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 8vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--text-hi);
}

.headline-accent {
  background: linear-gradient(100deg, var(--violet-bright) 10%, var(--cyan-bright) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(139, 92, 246, 0.35));
}

.subhead {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-lo);
  margin: 0;
}

/* ==========================================================================
   Composer (textarea + button)
   ========================================================================== */
.composer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.textarea-shell {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03));
  transition: background 0.4s var(--ease-out);
}

.textarea-shell::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, var(--violet-bright), var(--cyan-bright));
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.55));
}

.textarea-shell:focus-within::after {
  opacity: 1;
}

.textarea-shell:focus-within {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
}

.resume-input {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: none;
  outline: none;
  border-radius: calc(var(--radius-lg) - 1px);
  background: rgba(20, 14, 38, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  padding: 20px 22px 8px;
  display: block;
}

.resume-input::placeholder {
  color: var(--text-faint);
}

.textarea-footline {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 0 22px 14px;
  background: rgba(20, 14, 38, 0.55);
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

#char-count.warn {
  color: var(--amber);
}

.btn-roast {
  position: relative;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  padding: 16px 34px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  color: #0a0714;
  background: linear-gradient(100deg, var(--cyan-bright), var(--violet-bright));
  box-shadow: 0 0 0 rgba(139, 92, 246, 0);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), filter 0.25s var(--ease-out);
}

.btn-roast:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.45), 0 0 30px rgba(45, 212, 232, 0.3);
}

.btn-roast:active {
  transform: translateY(0) scale(0.99);
}

.btn-roast:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-roast-flame {
  transition: transform 0.3s var(--ease-out);
}

.btn-roast:hover .btn-roast-flame {
  transform: rotate(-8deg) scale(1.15);
}

.form-error {
  align-self: center;
  color: var(--ember);
  font-size: 14px;
  margin: 0;
}

/* ==========================================================================
   Loading state
   ========================================================================== */
.view-loading {
  padding-top: 6vh;
  gap: 28px;
}

.scan-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 220px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

.scan-doc {
  position: absolute;
  inset: 0;
  padding: 30px 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scan-doc-line {
  display: block;
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
}

.scan-doc-line.l1 { width: 60%; }
.scan-doc-line.l2 { width: 90%; }
.scan-doc-line.l3 { width: 78%; }
.scan-doc-line.l4 { width: 85%; }
.scan-doc-line.l5.short { width: 40%; }

.scan-lines {
  position: absolute;
  inset: 0;
}

.scan-lines span {
  position: absolute;
  left: 0;
  right: 0;
  height: 46px;
  background: linear-gradient(180deg, transparent, rgba(139, 92, 246, 0.22) 45%, rgba(45, 212, 232, 0.28) 55%, transparent);
  filter: blur(2px);
  animation: scan-sweep 2.4s ease-in-out infinite;
}

@keyframes scan-sweep {
  0% { top: -46px; }
  100% { top: 100%; }
}

.loading-status {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--cyan-bright);
  letter-spacing: 0.01em;
  text-align: center;
  animation: pulse-text 1.6s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ==========================================================================
   Error state
   ========================================================================== */
.view-error {
  padding-top: 10vh;
}

.error-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 36px 28px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid rgba(255, 107, 91, 0.28);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.error-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 10px;
}

.error-message {
  color: var(--text-lo);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 22px;
}

/* ==========================================================================
   Result state
   ========================================================================== */
.result-card {
  width: 100%;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 36px 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.result-top {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.gauge-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.gauge {
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 12;
}

.gauge-fill {
  fill: none;
  stroke: url(#none);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 439.8;
  stroke-dashoffset: 439.8;
  stroke: var(--ember);
  transition: stroke-dashoffset 1.4s var(--ease-out), stroke 1.4s var(--ease-out);
  filter: drop-shadow(0 0 10px currentColor);
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-number {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 38px;
  line-height: 1;
}

.gauge-max {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 2px;
}

.gauge-caption {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gauge-label {
  font-size: 14px;
  color: var(--text-lo);
}

.gauge-verdict {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
}

.roast-block {
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  padding: 22px 0;
  margin-bottom: 24px;
}

.roast-text {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-hi);
  margin: 0;
}

.roast-text .rt-line {
  display: block;
  opacity: 0;
  transform: translateY(8px);
  animation: line-up 0.5s var(--ease-out) forwards;
}

@keyframes line-up {
  to { opacity: 1; transform: translateY(0); }
}

.fixes-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-lo);
  margin: 0 0 14px;
}

.fixes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fix-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  opacity: 0;
  transform: translateY(10px);
  animation: fix-in 0.5s var(--ease-out) forwards;
}

.fix-icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.5;
}

.fix-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-hi);
}

@keyframes fix-in {
  to { opacity: 1; transform: translateY(0); }
}

.result-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
}

.result-footer-brand {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.result-actions {
  margin-top: 22px;
}

.btn-secondary {
  border: 1px solid var(--glass-border-bright);
  background: rgba(139, 92, 246, 0.08);
  color: var(--text-hi);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.btn-secondary:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(139, 92, 246, 0.16);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.3);
}

/* ==========================================================================
   Score verdict color states (functional, not decorative)
   ========================================================================== */
.score-low .gauge-fill { stroke: var(--ember); }
.score-low .gauge-number { color: var(--ember); }
.score-low .gauge-verdict { color: var(--ember); }

.score-mid .gauge-fill { stroke: var(--amber); }
.score-mid .gauge-number { color: var(--amber); }
.score-mid .gauge-verdict { color: var(--amber); }

.score-high .gauge-fill { stroke: var(--mint); }
.score-high .gauge-number { color: var(--mint); }
.score-high .gauge-verdict { color: var(--mint); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 560px) {
  .page {
    padding: 20px 14px 48px;
  }

  .headline {
    font-size: clamp(34px, 11vw, 46px);
  }

  .subhead {
    font-size: 15.5px;
  }

  .resume-input {
    min-height: 200px;
    font-size: 15px;
  }

  .result-card {
    padding: 26px 20px 22px;
  }

  .result-top {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }

  .gauge-caption {
    align-items: center;
  }

  .btn-roast {
    width: 100%;
    justify-content: center;
  }
}
