/* ── Design Tokens ─────────────────────────────────────── */
:root {
    --bg:               #F7F3EE;
    --surface:          #FFFFFF;
    --surface-alt:      #EDE7DF;
    --text:             #1A1A1A;
    --text-body:        #4A4540;
    --text-muted:       #6B6762;
    --border:           #DFD3C3;
    --accent:           #E0AFFF;
    --accent-hover:     #B57FE8;
    --accent-text:      #3D1A5C;
    --accent-subtle:    rgba(224,175,255,0.12);
    --accent-secondary: #BFD1D9;
    --error:            #D94F4F;
    --success:          #3A9B6E;
    --radius-sm:        6px;
    --radius-md:        10px;
    --radius-lg:        16px;
    --radius-pill:      9999px;
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.06);
    --shadow-md:        0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:        0 8px 30px rgba(0,0,0,0.10);
    --font-stack:       'Montserrat', system-ui, sans-serif;
}

/* ── Dark Mode Tokens ───────────────────────────────────── */
[data-theme="dark"] {
    --bg:               #0F0C18;
    --surface:          #1C1826;
    --surface-alt:      #231E30;
    --text:             #F0EBF8;
    --text-body:        #C8C0D8;
    --text-muted:       #8A8298;
    --border:           rgba(255, 255, 255, 0.10);
    --accent:           #D4A8F0;
    --accent-hover:     #B57FE8;
    --accent-text:      #EDE8F4;
    --accent-subtle:    rgba(212, 168, 240, 0.15);
    --accent-secondary: #4A6A78;
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.25);
    --shadow-md:        0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg:        0 8px 30px rgba(0,0,0,0.45);
}

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

html {
    height: 100%;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    font-family: var(--font-stack);
    color: var(--text-body);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3, h4 { color: var(--text); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(224,175,255,0.4);
}

.btn-secondary {
    background: var(--surface-alt);
    color: var(--text-body);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-body);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-alt);
}

.btn-danger {
    background: transparent;
    color: var(--error);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(217,79,79,0.08);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* ── Form Inputs ───────────────────────────────────────── */
input[type="text"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(224,175,255,0.2);
}

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

/* ── Focus Visible ────────────────────────────────────── */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px;
}

/* ── Page Content ─────────────────────────────────────── */
.page-content {
    flex: 1;
}

/* ── App Nav (interior pages) ────────────────────────── */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.app-nav-logo {
    text-decoration: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.app-nav-logo-img {
    height: 24px;
    width: auto;
    display: block;
}
/* Light-bg nav: show light logo by default, swap in dark mode */
.app-nav-logo-img--light { display: block; }
.app-nav-logo-img--dark  { display: none; }
[data-theme="dark"] .app-nav-logo-img--light { display: none; }
[data-theme="dark"] .app-nav-logo-img--dark  { display: block; }

.app-nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-nav-back {
    font-size: 0.88rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.app-nav-back:hover { color: var(--text); }

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-copy {
    font-size: 0.82rem;
    color: var(--text-muted);
}

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

.footer-links a {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* ── Utility ───────────────────────────────────────────── */
.visually-hidden,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.visually-hidden:focus,
.sr-only:focus {
    position: fixed;
    top: 12px;
    left: 12px;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
    z-index: 9999;
    padding: 10px 20px;
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 0.95rem;
    font-weight: 600;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 12px;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--surface);
    color: var(--accent-text);
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: top 0.1s;
}
.skip-link:focus {
    top: 12px;
}

.input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Job Posting Input Toggle ────────────────────────── */
.input-mode-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.input-mode-toggle .toggle-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.input-mode-toggle .toggle-btn.active {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}

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

.url-fetch-row .url-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
}

.url-fetch-row .url-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(224, 175, 255, 0.25);
}

.url-fetch-row button {
    padding: 10px 18px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.url-fetch-row button:hover {
    background: var(--accent-hover);
}

.url-fetch-row button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fetch-status {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    min-height: 1.2em;
}

.fetch-status.error {
    color: var(--error);
}

.fetch-status.success {
    color: var(--success);
}

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