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

:root {
    --bg:           #F2EDE3;
    --surface:      #F8F4EC;
    --text:         #1A1410;
    /* Secondary and tertiary text, both at least 4.5:1 on --bg. */
    --text-mid:     #574838;
    --text-faint:   #6B5D4C;
    --accent:       #B83A00;
    --accent-hover: #962F00;
    --gold:         #8F5D00;
    --border:       #D8D0C4;
    --stage:        #1A1410;
    --panel-img:    #262018;

    /* Headlines: Archivo narrowed to bill-poster width. Everything else:
       Atkinson Hyperlegible Next, drawn for legibility (distinct I/l/1,
       open counters) -- the body face is what people complained about. */
    --font-display: 'Archivo', 'Arial Narrow', sans-serif;
    --font-body:    'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, sans-serif;

    /* Type scale: 17px base, ratio 1.25. Nothing smaller than --step--1. */
    --step--1: 0.875rem;
    --step-0:  1.0625rem;
    --step-1:  1.3125rem;
    --step-2:  1.625rem;
    --step-3:  2.0625rem;
    --step-4:  2.5625rem;
}

html { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Display type: condensed, heavy, tight -- set like a club's bill. */
.about-heading, .dash-heading, .upload-heading, .admin-stat-num,
.nav-logo, .login-wordmark, .footer-logo {
    font-family: var(--font-display);
    font-stretch: 75%;
    font-weight: 800;
    /* The narrow face's own word space nearly closes up at display sizes. */
    word-spacing: 0.08em;
}

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

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button { cursor: pointer; }

/* ── Nav ── */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
}

.nav-logo {
    font-size: var(--step-1);
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: var(--step--1);
    color: var(--text-faint);
    background: none;
    border: none;
    font-family: var(--font-body);
    text-decoration: none;
    transition: color 0.15s;
}

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

.nav-cta {
    font-size: var(--step--1);
    font-family: var(--font-body);
    border: 1px solid var(--text);
    color: var(--text);
    background: none;
    padding: 0.45rem 1rem;
    text-decoration: none;
    transition: all 0.15s;
    display: inline-block;
}

.nav-cta:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ── About ── */
.about-wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

.about-main {
    padding: 6rem 0 7rem;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.about-heading {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--text);
    text-wrap: balance;
}

.about-heading .line-accent {
    color: var(--accent);
    display: block;
}

.about-desc {
    font-size: var(--step-0);
    color: var(--text-mid);
    max-width: 34rem;
    line-height: 1.6;
}

.about-panels {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.panel {
    border-radius: 9px;
    overflow: hidden;
    background: var(--stage);
    box-shadow: 0 8px 28px rgba(26,20,16,0.22), 0 2px 6px rgba(26,20,16,0.1);
    flex-shrink: 0;
}

.panel-side {
    width: 120px;
    height: 156px;
}

.panel-left  { transform: rotate(-4deg) translateY(14px); opacity: 0.75; }
.panel-right { transform: rotate(4deg)  translateY(14px); opacity: 0.75; }

.panel-center {
    width: 152px;
    height: 196px;
    position: relative;
    z-index: 2;
}

.panel-photo {
    width: 100%;
    background: var(--panel-img);
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-side   .panel-photo { height: calc(156px - 44px); }
.panel-center .panel-photo { height: calc(196px - 52px); }

.fig {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    opacity: 0.26;
}

.fig-head { border-radius: 50%; background: var(--bg); }
.fig-body { background: var(--bg); border-radius: 4px 4px 2px 2px; }
.fig-mic  { background: var(--bg); border-radius: 2px; margin-top: -3px; }

.panel-side   .fig-head { width: 17px; height: 17px; }
.panel-side   .fig-body { width: 22px; height: 24px; }
.panel-side   .fig-mic  { width: 3px;  height: 18px; }
.panel-center .fig-head { width: 21px; height: 21px; }
.panel-center .fig-body { width: 28px; height: 30px; }
.panel-center .fig-mic  { width: 4px;  height: 22px; }

.panel-cap {
    background: var(--accent);
    display: flex;
    align-items: center;
    padding: 0 9px;
}

.panel-side   .panel-cap { height: 44px; }
.panel-center .panel-cap { height: 52px; }

.panel-cap p {
    font-family: var(--font-body);
    font-size: 8px;
    color: white;
    line-height: 1.45;
}

.about-meta {
    padding-top: 3.5rem;
    border-top: 1px solid var(--border);
}

.about-meta p {
    font-size: var(--step--1);
    color: var(--text-faint);
    line-height: 1.9;
}

.about-meta a {
    color: var(--text-mid);
    border-bottom: 1px solid var(--border);
    transition: color 0.15s, border-color 0.15s;
}

.about-meta a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    font-size: var(--step-0);
    color: var(--text-faint);
}

.footer-note {
    font-size: var(--step--1);
    color: var(--text-faint);
}

/* ── Login ── */
.login-page {
    display: grid;
    grid-template-columns: 400px 1fr;
    min-height: 100vh;
}

.login-left {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
}

.login-form-inner {
    max-width: 300px;
}

.login-wordmark {
    font-size: var(--step-3);
    line-height: 1;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.login-tagline {
    font-size: var(--step--1);
    color: var(--text-faint);
    margin-bottom: 2.75rem;
}

.form-group { margin-bottom: 1rem; }

.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 0.875rem;
    font-family: var(--font-body);
    font-size: var(--step-0);
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--text-mid);
    background: var(--surface);
}

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

.btn-enter {
    width: 100%;
    background: none;
    border: 1px solid var(--text);
    color: var(--text);
    padding: 0.75rem;
    font-family: var(--font-body);
    font-size: var(--step--1);
    margin-top: 0.375rem;
    transition: all 0.15s;
}

.btn-enter:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.login-error {
    font-size: var(--step--1);
    color: var(--accent);
    margin-top: 0.625rem;
    min-height: 1rem;
}

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

.login-invite-link {
    font-size: var(--step--1);
    color: var(--text-faint);
    transition: color 0.15s;
    display: inline-block;
}

.login-invite-link:hover { color: var(--text); }

/* Dark right panel with spotlight */
.login-right {
    --mx: 50%;
    --my: 45%;
    position: relative;
    overflow: hidden;
    background: var(--stage);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 3rem;
}

.login-right::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 320px 240px at var(--mx) var(--my),
        rgba(196,128,16,0.18) 0%,
        transparent 65%
    );
    pointer-events: none;
}

.login-right-quote {
    font-family: var(--font-display);
    font-stretch: 85%;
    font-weight: 600;
    font-size: clamp(1.3125rem, 2.2vw, 1.75rem);
    color: rgba(242,237,227,0.9);
    text-align: center;
    max-width: 340px;
    line-height: 1.3;
    text-wrap: balance;
    position: relative;
    z-index: 1;
}

.login-right-quote em {
    font-style: normal;
}

.login-panels {
    display: flex;
    gap: 7px;
    align-items: flex-end;
    position: relative;
    z-index: 1;
}

.lp {
    border-radius: 7px;
    overflow: hidden;
    background: #231E17;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    flex-shrink: 0;
}

.lp-s { width: 80px; height: 104px; }
.lp-l { transform: rotate(-3deg) translateY(8px); opacity: 0.68; }
.lp-r { transform: rotate(3deg)  translateY(8px); opacity: 0.68; }
.lp-c { width: 100px; height: 132px; z-index: 2; }

.lp-photo {
    background: #1C1812;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-s .lp-photo { height: calc(104px - 34px); }
.lp-c .lp-photo { height: calc(132px - 42px); }

.lp-cap {
    background: var(--accent);
    display: flex;
    align-items: center;
    padding: 0 7px;
}

.lp-s .lp-cap { height: 34px; }
.lp-c .lp-cap { height: 42px; }

.lp-cap p {
    font-family: var(--font-body);
    font-size: 7px;
    color: white;
    line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .login-page { grid-template-columns: 1fr; }
    .login-right { display: none; }
    .about-wrap { padding: 0 1.5rem; }
    .site-nav { padding: 1.25rem 1.5rem; }
    .panel-left, .panel-right { display: none; }
    .site-footer { flex-direction: column; gap: 0.5rem; text-align: center; }
}

@media (max-width: 480px) {
    .login-left { padding: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Spinner (shared) ── */
.spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

.hidden { display: none !important; }

/* ── Dashboard ── */
.dash-wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

.dash-main {
    padding: 4rem 0 6rem;
}

.dash-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2.75rem;
}

.dash-heading {
    font-family: var(--font-display);
    font-size: var(--step-4);
    color: var(--text);
    letter-spacing: -0.01em;
}

.btn-upload {
    font-family: var(--font-body);
    font-size: var(--step--1);
    border: 1px solid var(--text);
    color: var(--text);
    background: none;
    padding: 0.45rem 1rem;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.btn-upload:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Job list */
.job-list {
    border-top: 1px solid var(--border);
}

.job-row {
    display: grid;
    grid-template-columns: 150px 110px 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s, padding 0.12s;
}

.job-row:hover {
    background: var(--surface);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    margin: 0 -0.75rem;
}

.job-date {
    font-size: var(--step--1);
    color: var(--text-faint);
}

.job-status {
    font-size: var(--step--1);
}

.status-uploading  { color: var(--text-faint); }
.status-pending    { color: var(--text-faint); }
.status-processing { color: var(--gold); }
.status-done       { color: var(--text-mid); }
.status-failed     { color: var(--accent); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.status-processing::before {
    content: '·';
    margin-right: 0.3rem;
    display: inline-block;
    animation: pulse 1.4s ease infinite;
}

.job-slides {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
}

.job-slide {
    max-width: 100%;
}

.job-slide img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.job-slide-thumb {
    width: 26px;
    height: 34px;
    border-radius: 3px;
    background: var(--panel-img);
    flex-shrink: 0;
    overflow: hidden;
}

.job-slide-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.job-meta-empty {
    font-size: var(--step--1);
    color: var(--text-faint);
}

.job-arrow {
    font-size: var(--step--1);
    color: var(--text-faint);
    transition: color 0.12s;
}

.job-row:hover .job-arrow { color: var(--accent); }

/* Empty state */
.dash-empty {
    padding: 4rem 0;
    color: var(--text-faint);
    font-size: var(--step--1);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.dash-empty a {
    color: var(--text-mid);
    border-bottom: 1px solid var(--border);
    transition: color 0.15s, border-color 0.15s;
}

.dash-empty a:hover { color: var(--accent); border-color: var(--accent); }

/* Authenticated nav */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-user {
    font-size: var(--step--1);
    color: var(--text-faint);
}

.nav-logout {
    font-size: var(--step--1);
    color: var(--text-faint);
    background: none;
    border: none;
    font-family: var(--font-body);
    transition: color 0.15s;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}

.nav-logout:hover { color: var(--accent); }

/* Admin section */
.admin-section {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.admin-label {
    font-size: var(--step--1);
    color: var(--text-faint);
    margin-bottom: 2.25rem;
}

.admin-stats {
    display: flex;
    gap: 3.5rem;
    margin-bottom: 2.5rem;
}

.admin-stat-num {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.admin-stat-label {
    font-size: var(--step--1);
    color: var(--text-faint);
}

.admin-actions {
    display: flex;
    gap: 0.875rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-admin {
    font-family: var(--font-body);
    font-size: var(--step--1);
    border: 1px solid var(--border);
    color: var(--text-mid);
    background: none;
    padding: 0.45rem 0.875rem;
    transition: all 0.15s;
    cursor: pointer;
}

.btn-admin:hover { border-color: var(--text); color: var(--text); }

.admin-job-list { margin-top: 2rem; }

.admin-job-row {
    display: grid;
    grid-template-columns: 120px 120px 110px 1fr auto;
    gap: 1.25rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--step--1);
    color: var(--text-mid);
}

.admin-job-row:first-child { border-top: 1px solid var(--border); }

.admin-job-user { color: var(--text); letter-spacing: 0.04em; }

/* Direct-to-storage video upload */
.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1rem;
}
.upload-progress progress {
    width: 100%;
    height: 0.5rem;
    accent-color: var(--accent);
}
.upload-progress span {
    font-size: var(--step--1);
    color: var(--text-mid);
}
.upload-error {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: var(--step--1);
}

/* ── Upload ── */
.upload-wrap,
.job-wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

.upload-inner {
    max-width: 36rem;
    padding: 4rem 0 6rem;
}

.upload-heading {
    font-size: var(--step-4);
    line-height: 1.05;
    margin-bottom: 2rem;
}

.upload-tabs {
    display: flex;
    gap: 1.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.75rem;
}

.upload-tab {
    font-family: var(--font-body);
    font-size: var(--step-0);
    color: var(--text-mid);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0 0 0.625rem;
    margin-bottom: -1px;
}

.upload-tab:hover { color: var(--text); }

.upload-tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.upload-label {
    display: block;
    font-size: var(--step-0);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 0.875rem;
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.5;
    resize: vertical;
}

.form-textarea:focus { border-color: var(--text-mid); background: var(--surface); }
.form-textarea::placeholder { color: var(--text-faint); }

/* The drop zone is the stage: dark, with the login panel's spotlight.
   The real file input covers it, so click, tap, and drag-and-drop all
   land on the native control. */
.drop-zone {
    position: relative;
    background: var(--stage);
    color: #F2EDE3;
    min-height: 13rem;
    display: grid;
    place-items: center;
    padding: 2rem 1.5rem;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: -20% 15% 30%;
    background: radial-gradient(ellipse at 50% 0%, rgba(232,170,80,0.22), transparent 70%);
    pointer-events: none;
}

.drop-zone:hover::before,
.drop-zone:focus-within::before {
    background: radial-gradient(ellipse at 50% 0%, rgba(232,170,80,0.34), transparent 70%);
}

.drop-zone:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.drop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-input:disabled { cursor: progress; }

.drop-label {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    text-align: center;
    font-size: var(--step-1);
    pointer-events: none;
}

.drop-icon {
    font-size: var(--step-3);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.drop-hint {
    font-size: var(--step--1);
    color: rgba(242,237,227,0.72);
}

.upload-radio-group {
    display: flex;
    gap: 1.5rem;
}

.upload-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--step-0);
    cursor: pointer;
}

.upload-radio input { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }

.upload-form .form-group { margin-bottom: 1.5rem; }

.btn-upload-submit {
    font-family: var(--font-body);
    font-size: var(--step-0);
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    padding: 0.75rem 1.5rem;
    transition: background 0.15s, border-color 0.15s;
}

.btn-upload-submit:hover { background: var(--accent); border-color: var(--accent); }
.btn-upload-submit:disabled { opacity: 0.6; cursor: progress; }

/* ── Job ── */
.job-inner { padding: 3rem 0 6rem; }

.job-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.job-back { color: var(--text-mid); }
.job-back:hover { color: var(--text); }

.job-meta-row .job-status { font-size: var(--step-0); }

/* Finished slides at a size worth judging: two 4:5 posts side by side. */
.job-inner .job-slides {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: 2rem;
}

.job-inner .job-slide img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: var(--panel-img);
}

.slide-download {
    display: inline-block;
    margin-top: 0.625rem;
    color: var(--text-mid);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.slide-download:hover { color: var(--accent); }

.job-failed,
.job-pending {
    max-width: 36rem;
    padding: 2rem 0;
}

.job-error-label {
    font-family: var(--font-display);
    font-stretch: 75%;
    font-weight: 800;
    font-size: var(--step-3);
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.job-error-msg {
    font-size: var(--step-1);
    color: var(--text-mid);
    margin-bottom: 1.75rem;
}

.btn-retry {
    display: inline-block;
    border: 1px solid var(--text);
    padding: 0.625rem 1.25rem;
    transition: all 0.15s;
}

.btn-retry:hover { background: var(--accent); border-color: var(--accent); color: white; }

.job-spinner-wrap { margin-bottom: 1.25rem; }

.spinner-lg {
    width: 2rem;
    height: 2rem;
    border-width: 2px;
    margin: 0;
}

.job-pending-msg {
    font-size: var(--step-1);
    line-height: 1.5;
    color: var(--text-mid);
}

/* Responsive */
@media (max-width: 640px) {
    .job-row { grid-template-columns: 1fr auto auto; gap: 0.75rem; }
    .job-row .job-slides { grid-column: 1 / -1; grid-row: 2; }
    .dash-wrap { padding: 0 1.5rem; }
    .admin-stats { gap: 2rem; }
    .upload-wrap, .job-wrap { padding: 0 1.25rem; }
    .upload-inner { padding: 2.5rem 0 4rem; }
    .upload-heading { font-size: var(--step-3); }
}
