/* === Base === */

:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #111827;
  --accent-contrast: #ffffff;
  --soft: #f3f4f6;
  --danger: #b91c1c;
  --modal-accent: #0d9488;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

main {
  max-width: 100%;
  overflow-x: hidden;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.hero {
  flex: 0 0 60%;
  min-width: 0;
  padding: 64px clamp(24px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.hero-with-bg {
  position: relative;
}

.hero-with-bg .hero-img {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 32px 28px 36px;
  background: rgba(15, 13, 26, 0.55);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.hero-with-bg .hero-muted,
.hero-with-bg .hero p {
  color: rgba(255, 255, 255, 0.9);
}

.hero-with-bg .hero-muted {
  font-size: 13px;
}

.hero-with-bg h1 {
  color: #fff;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 48px);
  margin: 0;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.card {
  flex: 1;
  min-width: 0;
  max-width: 40%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.08);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input[type="email"],
input[type="url"],
textarea,
input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.textarea-expand {
  min-height: 90px;
  transition: min-height 0.2s ease;
}
.textarea-expand:focus {
  min-height: 280px;
}

button,
.button {
  appearance: none;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  cursor: pointer;
}

.button-secondary {
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-small {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none;
}

.job-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
  display: block;
}

.textarea-loading {
  position: relative;
  pointer-events: none;
}

.textarea-loading textarea {
  opacity: 0.5;
}

.textarea-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid var(--muted);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: textarea-spin 0.6s linear infinite;
}

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

.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.label-standalone {
  margin-bottom: 0;
}

.resume-section .resume-upload-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--soft);
  transition: border-color 0.2s, background 0.2s, filter 0.25s, opacity 0.25s;
}

.resume-upload-zone:hover {
  border-color: var(--muted);
  background: #eef0f2;
}

.resume-upload-zone.resume-uploaded {
  filter: blur(1.5px);
  opacity: 0.7;
  pointer-events: none;
}

.resume-file-input-hidden {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.resume-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.resume-upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.2);
}

.resume-upload-btn:active {
  transform: translateY(0);
}

.resume-upload-icon {
  font-size: 16px;
  line-height: 1;
}

.resume-or-paste {
  font-size: 14px;
  color: var(--muted);
}

.link-paste {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-paste:hover {
  text-decoration: none;
}

.resume-paste-zone {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resume-paste-zone .link-paste {
  font-size: 13px;
  color: var(--muted);
}

.ads {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
}

.ads-modal {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border-style: solid;
  border-color: var(--border);
  font-size: 12px;
}

.ads-modal .ads-label {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--soft);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-right: 8px;
}

.ads-modal p {
  display: inline;
  margin: 0;
}

.status {
  padding: 12px;
  border-radius: 10px;
  background: var(--soft);
  border: 1px solid var(--border);
  font-size: 14px;
}

.status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.status.status-success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.status.status-success .muted {
  color: #047857;
}

.resume-greeting {
  margin: 0 0 4px;
  font-weight: 600;
  color: #065f46;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.modal {
  width: min(560px, 100%);
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: 0 20px 60px rgba(17, 24, 39, 0.2);
}

.modal-animate {
  animation: modal-enter 200ms ease-out;
}

.modal-drag-handle {
  display: none;
}

.modal-loading-indicator {
  width: 48px;
  height: 6px;
  margin: 0 auto 16px;
  position: relative;
  background: var(--modal-accent);
  border-radius: 2px;
  opacity: 0.7;
  animation: loading-pulse 1.5s ease-in-out infinite;
}

.modal-loading-indicator::before,
.modal-loading-indicator::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--modal-accent);
  border-radius: 2px;
  animation: loading-pulse 1.5s ease-in-out infinite;
}

.modal-loading-indicator::before {
  top: -12px;
  opacity: 0.5;
  animation-delay: 0.2s;
}

.modal-loading-indicator::after {
  bottom: -12px;
  opacity: 0.35;
  animation-delay: 0.4s;
}

.modal-heading {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.modal-subtext {
  margin: 0 0 16px;
  text-align: center;
}

.modal-quip {
  font-size: 1.1rem;
  line-height: 1.5;
  padding: 16px 16px 16px 20px;
  border-left: 3px solid var(--modal-accent);
  background: var(--soft);
  border-radius: 0 8px 8px 0;
  margin-bottom: 16px;
  color: var(--text);
  min-height: 2.5rem;
  transition: opacity 150ms ease;
}

.modal-quip-fade-out {
  opacity: 0;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.claim-link-block {
  margin-top: 0;
}

.claim-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.claim-url-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
  font-family: monospace;
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 24px clamp(24px, 6vw, 96px);
  font-size: 13px;
  color: var(--muted);
}
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .page {
    flex-direction: column;
  }
  .hero {
    flex: 0 0 auto;
    padding: 48px 24px 24px;
  }
  .card {
    max-width: none;
    width: min(520px, 100%);
  }
  .hero-with-bg {
    min-height: 320px;
  }

  /* Generating modal: bottom sheet on mobile */
  .modal-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }
  .modal-overlay .modal {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .modal-overlay .modal.modal-animate {
    animation: slide-up 250ms ease-out;
  }
  .modal-overlay .modal-drag-handle {
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto 12px;
    background: var(--border);
    border-radius: 2px;
  }
  .modal-overlay .modal-heading {
    font-size: 16px;
  }
  .modal-overlay .modal-subtext {
    font-size: 12px;
  }
  .modal-overlay .modal-quip {
    font-size: 0.95rem;
    padding: 12px 12px 12px 16px;
  }
  .modal-overlay .ads.ads-modal {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* === About === */

.about-card { max-width: 640px; }
.about-content h2 { font-size: 16px; margin: 24px 0 8px; }
.about-content h2:first-child { margin-top: 0; }
.about-content ul { margin: 8px 0; padding-left: 20px; }
.about-content li { margin-bottom: 6px; }
.about-content p { margin: 0 0 12px; }
.about-steps {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}
.about-steps li {
  counter-increment: step;
  padding-left: 36px;
  position: relative;
  margin-bottom: 12px;
}
.about-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Privacy === */

.privacy-card { max-width: 640px; }
.privacy-content h2 { font-size: 16px; margin: 24px 0 8px; }
.privacy-content h2:first-child { margin-top: 0; }
.privacy-content ul { margin: 8px 0; padding-left: 20px; }
.privacy-content li { margin-bottom: 6px; }
.privacy-content p { margin: 0 0 12px; }

/* === Optimize === */

.how-it-works {
  max-width: 100%;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.how-it-works h2 {
  font-size: clamp(18px, 2.5vw, 24px);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
  color: #fff;
}
.how-it-works-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.how-step {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 16px;
}
.how-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.how-step h3 {
  font-size: 14px;
  margin: 0 0 4px;
  color: #fff;
}
.how-step p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.45;
}

/* === Toasts === */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  animation: toast-in 0.25s ease-out;
}

.toast-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.toast-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

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

/* === Download button === */

.button-download {
  background: #065f46;
  color: #fff;
  font-size: 16px;
  padding: 14px 24px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
