/* resume.westover.services — shared stylesheet
   Typography and color language inherits from resume.westover.dev.
   WCAG AA contrast enforced throughout. */

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

:root {
  /* Color palette — matches westover.dev resume aesthetic */
  --bg:         #ffffff;
  --bg-subtle:  #f8f8f8;
  --bg-card:    #f4f4f4;
  --border:     #e0e0e0;
  --border-focus: #0066cc;

  --ink:        #1a1a1a;
  --ink-2:      #444444;
  --ink-3:      #767676; /* AA contrast on white: 4.54:1 */
  --ink-inv:    #ffffff;

  --accent:     #0066cc;
  --accent-hover: #0052a3;
  --accent-light: #e8f0fb;

  --success:    #1a7f37;
  --error:      #cf222e;
  --warning:    #9a6700;

  --radius:     6px;
  --radius-lg:  10px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.08);
  --shadow:     0 2px 8px rgba(0,0,0,0.12);

  /* Type scale */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', Menlo, monospace;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

/* ─── Layout ─── */

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.wrap--wide {
  max-width: 1080px;
}

/* ─── Site header ─── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header__logo {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-header__logo:hover {
  color: var(--accent);
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header__nav a {
  font-size: 0.875rem;
  color: var(--ink-2);
  text-decoration: none;
}

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

/* ─── Site footer ─── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--ink-3);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

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

.btn--primary {
  background: var(--accent);
  color: var(--ink-inv);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn--outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn--outline:hover:not(:disabled) {
  background: var(--accent-light);
}

.btn--sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
}

.btn--lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ─── Form elements ─── */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.field .hint {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.field input,
.field textarea,
.field select {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-3);
}

.field textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}

.char-counter {
  font-size: 0.8125rem;
  color: var(--ink-3);
  text-align: right;
}

.char-counter.over {
  color: var(--error);
}

/* ─── Cards ─── */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ─── Alert / banner ─── */

.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  border: 1px solid transparent;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.alert--error {
  background: #fff0f0;
  border-color: #ffcdd2;
  color: var(--error);
}

.alert--success {
  background: #f0fff4;
  border-color: #bbf7d0;
  color: var(--success);
}

.alert--info {
  background: var(--accent-light);
  border-color: #bfdbfe;
  color: #1e40af;
}

/* ─── Archetype tab bar ─── */

.tab-bar {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-bar__tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab-bar__tab:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.tab-bar__tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-bar__tab:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ─── Resume content rendering ─── */

.resume-view {
  font-size: 0.9375rem;
  line-height: 1.65;
}

.resume-view h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.resume-view .contact-line {
  color: var(--ink-2);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.resume-view .contact-line a {
  color: var(--ink-2);
  text-decoration: none;
}

.resume-view .contact-line a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.resume-section {
  margin-bottom: 1.75rem;
}

.resume-section h2 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.375rem;
  margin-bottom: 1rem;
}

.resume-role {
  margin-bottom: 1.25rem;
}

.resume-role__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.resume-role__employer {
  font-weight: 700;
  font-size: 1rem;
}

.resume-role__dates {
  font-size: 0.8125rem;
  color: var(--ink-3);
  white-space: nowrap;
}

.resume-role__title {
  font-size: 0.9375rem;
  color: var(--ink-2);
  margin-bottom: 0.5rem;
}

.resume-role__bullets {
  list-style: disc;
  padding-left: 1.375rem;
  color: var(--ink);
}

.resume-role__bullets li {
  margin-bottom: 0.25rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.skill-group h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skill-group p {
  font-size: 0.875rem;
  color: var(--ink);
  line-height: 1.5;
}

/* ─── Status / polling states ─── */

.status-panel {
  text-align: center;
  padding: 3rem 1.5rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.status-panel p {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.status-panel .status-detail {
  color: var(--ink-3);
  font-size: 0.8125rem;
  margin-top: 0.375rem;
}

/* ─── Download actions ─── */

.download-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Privacy badge ─── */

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--ink-3);
  padding: 0.25rem 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.privacy-badge svg {
  flex-shrink: 0;
}

/* ─── Landing hero ─── */

.hero {
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.0625rem;
  color: var(--ink-2);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── How it works section ─── */

.how-it-works {
  padding: 3rem 0;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.how-it-works h2 {
  font-size: 1.375rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.step {
  text-align: center;
}

.step__num {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-inv);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.875rem;
}

.step h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.step p {
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.55;
}

/* ─── Privacy section ─── */

.privacy-section {
  padding: 3rem 0;
}

.privacy-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.privacy-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.privacy-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.privacy-points li svg {
  flex-shrink: 0;
  margin-top: 0.125rem;
  color: var(--success);
}

/* ─── Profile page layout ─── */

.profile-layout {
  padding: 2rem 0 4rem;
}

.profile-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.profile-header__info h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.profile-header__meta {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.profile-header__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ─── Tailor form layout ─── */

.tailor-layout {
  padding: 2rem 0 4rem;
}

.tailor-layout h1 {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
}

.tailor-layout .subhead {
  color: var(--ink-2);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.tailor-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Result panel ─── */

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.result-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ─── Loading notice ─── */

.loading-notice {
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-top: 1.5rem;
  text-align: center;
}

/* ─── Responsive ─── */

@media (max-width: 640px) {
  .profile-header {
    flex-direction: column;
  }

  .profile-header__actions {
    flex-shrink: unset;
    width: 100%;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .download-row {
    flex-direction: column;
  }

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

  .tab-bar {
    gap: 0;
  }

  .tab-bar__tab {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
  }
}

/* ─── Screen-reader only ─── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-color-scheme: dark) {
  /* Light mode only for now — resume context is professional */
}

@media print {
  .site-header,
  .site-footer,
  .tab-bar,
  .profile-header__actions,
  .download-row,
  .tailor-form,
  .btn {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: #000;
  }

  .resume-view h1 {
    font-size: 18pt;
  }
}

/* ─── Tailor toolbar (one-click resume download) ─── */

.tailor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}

/* ─── Header Sign-in control (shared auth.js, FAM-11742) ─── */

.auth-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The popover/form/note default to display:flex, which beats the browser's
   default [hidden]{display:none} — honor the hidden attribute explicitly. */
.auth-nav__popover[hidden],
.auth-nav__form[hidden],
.auth-nav__note[hidden] {
  display: none;
}

.auth-nav__identity {
  font-size: 0.875rem;
  color: var(--ink-2);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-nav__signout {
  flex-shrink: 0;
}

/* Popover anchored under the Sign-in trigger */
.auth-nav__popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 200;
  min-width: 16rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-nav__form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-nav__input {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
}

.auth-nav__input:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.auth-nav__note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.auth-nav__divider {
  height: 1px;
  background: var(--border);
  margin: 0.125rem 0;
}

.auth-nav__oauth {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-nav__oauth-btn {
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

/* Self-contained toast for ?auth=ok / ?auth=failed callbacks */
.auth-nav__toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-0.5rem);
  z-index: 1000;
  max-width: min(92vw, 28rem);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}

.auth-nav__toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 560px) {
  .auth-nav__popover {
    position: fixed;
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    min-width: 0;
  }
}
