/* ====================================================================
   RESUMECRAFT — SHARED COMPONENTS
   Header, footer, buttons, form fields, badges. Loaded on every page
   after tokens.css. Page-specific styles live in their own file.
   ==================================================================== */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }

a { color: inherit; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------------------------------------------------------- */
/* Header                                                            */
/* ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-softer);
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: 10px 16px;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
}

.brand {
  align-items: center;
  color: #2a2f42;
  display: inline-flex;
  font-weight: 850;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.brand span span { color: var(--accent-dark); }

.brand small {
  color: var(--muted-soft);
  display: block;
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 27px;
}

.brand-icon {
  height: 34px;
  width: 34px;
  flex-shrink: 0;
  display: block;
}
.brand-icon-sm {
  height: 26px;
  width: 26px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  line-height: 1.1;
}
.brand-name {
  color: #6484e8;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}
.brand-tagline {
  color: #8790a8;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.brand-text-footer {
  font-size: 0.95rem;
  font-weight: 850;
  color: #2a2f42;
}

.site-nav {
  align-items: center;
  display: flex;
  gap: 28px;
  justify-content: center;
}

.site-nav a {
  color: #31374b;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.site-nav a:hover { color: var(--accent-dark); }

.header-actions {
  align-items: center;
  display: flex;
  justify-content: end;
  gap: 14px;
}

.header-save-note {
  color: var(--muted-soft);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- */
/* Buttons / links                                                   */
/* ---------------------------------------------------------------- */

.btn {
  align-items: center;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), filter var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(100, 132, 232, 0.28);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 14px 28px rgba(100, 132, 232, 0.36); }

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.btn-secondary:hover { filter: brightness(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-soft);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent-dark); }

.btn-gold {
  background: linear-gradient(135deg, #f0c78f, #e0a85f);
  color: #4a3110;
  box-shadow: 0 10px 22px rgba(224, 168, 95, 0.32);
}

.btn-gold:hover { filter: brightness(1.03); }

.btn-block { width: 100%; }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.82rem; }

/* ---------------------------------------------------------------- */
/* Form fields                                                       */
/* ---------------------------------------------------------------- */

label {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  font-weight: 750;
  gap: 6px;
  line-height: 1.35;
}

.field-hint {
  color: var(--muted-soft);
  font-size: 0.72rem;
  font-weight: 600;
}

input, textarea, select {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  color: var(--ink);
  font-size: 16px; /* prevents iOS zoom on focus */
  min-width: 0;
  outline: none;
  padding: 11px 12px;
  width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

textarea { line-height: 1.45; resize: vertical; }

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(100, 132, 232, 0.14);
}

input.field-error, textarea.field-error {
  border-color: var(--danger);
}

input.field-error:focus, textarea.field-error:focus {
  box-shadow: 0 0 0 3px rgba(184, 69, 61, 0.14);
}

.error-text {
  color: var(--danger);
  font-size: 0.74rem;
  font-weight: 700;
  min-height: 1em;
}

.split {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.12fr 0.88fr;
}

/* ---------------------------------------------------------------- */
/* Badges / eyebrows                                                  */
/* ---------------------------------------------------------------- */

.eyebrow {
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.badge {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 800;
  gap: 6px;
  padding: 5px 12px;
}

.badge-success { background: #e8f6ec; color: var(--success-deep); }
.badge-gold { background: #fbf0de; color: #8a5e22; }

/* ---------------------------------------------------------------- */
/* Footer                                                            */
/* ---------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border-softer);
  margin-top: 60px;
  padding: 40px 28px 32px;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: var(--container);
  margin: 0 auto;
}

.footer-brand {
  align-items: center;
  color: #2a2f42;
  display: inline-flex;
  font-weight: 850;
  gap: 8px;
  text-decoration: none;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover { color: var(--accent-dark); }

.footer-copy {
  color: var(--muted-soft);
  font-size: 0.78rem;
  font-weight: 600;
  width: 100%;
  margin-top: 8px;
}

/* ---------------------------------------------------------------- */
/* Page transition fade-in (entrance only, respects reduced motion)  */
/* ---------------------------------------------------------------- */

.page-enter {
  animation: pageEnter var(--t-slow) var(--ease);
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------------- */
/* Responsive                                                        */
/* ---------------------------------------------------------------- */

@media (max-width: 980px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-nav { display: none; }
}

@media (max-width: 620px) {
  .site-header { padding: 10px 12px; gap: 8px; }
  .header-save-note { display: none; }
  .footer-grid { flex-direction: column; align-items: flex-start; }
  .brand span:not(.brand-mark) { font-size: 0.95rem; }
  .brand small { font-size: 0.5rem; }
  .header-actions .btn { font-size: 0.8rem; padding: 0 12px; height: 34px; white-space: nowrap; flex-shrink: 0; }
}

/* ==================================================================== */
/* Start modal — "How should we start?" (Build Resume entry point)      */
/* Shared across every page that links to builder.html.                 */
/* ==================================================================== */

.start-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(37, 42, 58, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}

.start-modal-overlay[hidden] { display: none; }
.start-modal-overlay.is-visible { opacity: 1; }

.start-modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 30px 26px 26px;
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}

.start-modal-overlay.is-visible .start-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.start-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--panel);
  color: var(--muted);
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.start-modal-close:hover { background: var(--panel-strong); color: var(--ink); }

.start-modal-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 850;
  color: var(--ink);
  text-align: center;
}

.start-modal-sub {
  margin: 0 0 22px;
  font-size: 0.92rem;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.start-modal-options {
  display: grid;
  gap: 12px;
}

.start-modal-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.start-modal-option:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.start-modal-option:active { transform: translateY(0); }

.start-modal-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-modal-icon svg { width: 21px; height: 21px; }

.start-modal-text { flex: 1; min-width: 0; }

.start-modal-option-title {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
}

.start-modal-option-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.start-modal-chevron {
  flex-shrink: 0;
  color: var(--muted-soft);
  font-size: 1.1rem;
}

/* Loading / error state, swapped in for .start-modal-options */

.start-modal-status {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 18px 4px 6px;
  text-align: center;
}

.start-modal-status[hidden] { display: none; }

.start-modal-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: startModalSpin 0.8s linear infinite;
}

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

.start-modal-status-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.start-modal-status-error .start-modal-status-text {
  color: var(--danger);
}

.start-modal-status-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 480px) {
  .start-modal-card { padding: 26px 18px 20px; }
  .start-modal-option { padding: 12px 12px; gap: 10px; }
}
