/* ============================================================
   Story Canary — Stylesheet
   Light theme matching brand colors
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&family=DM+Mono:wght@400;500&display=swap');

:root {
    --bg:           #F8F7F3;
    --bg-card:      #FFFFFF;
    --bg-elevated:  #F2F0EB;
    --border:       #E4E1D8;
    --border-light: #EAE8E1;
    --text:         #2D2D2D;
    --text-muted:   #6B6B6B;
    --text-dim:     #A0A09A;
    --accent:       #FFB800;
    --accent-dark:  #E8920C;
    --accent-dim:   #FFF0C0;
    --charcoal:     #2D2D2D;
    --green:        #2D8A4E;
    --green-light:  #EAF7EF;
    --red:          #C0392B;
    --red-light:    #FDECEA;
    --yellow-light: #FFFBEB;
    --shadow:       0 1px 4px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
    --radius:       8px;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;
    --font-mono:    'DM Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

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

/* ---- Layout ---- */
.container        { max-width: 960px; margin: 0 auto; padding: 0 2rem; }
.container--narrow { max-width: 560px; margin: 0 auto; padding: 0 2rem; }

/* ---- Header ---- */
.site-header {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.site-header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
}

.logo img {
    height: 36px;
    width: auto;
}

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

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: color 0.2s;
}

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

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: var(--charcoal);
    font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn-danger {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-full { width: 100%; text-align: center; }

/* ---- Hero ---- */
.hero {
    padding: 6rem 0 5rem;
    text-align: center;
    background: linear-gradient(180deg, #FFFBEB 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-dark);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--charcoal);
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.hero h1 em {
    color: var(--accent-dark);
    font-style: italic;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 2.5rem;
    line-height: 1.75;
    font-weight: 300;
}

/* ---- Features ---- */
.features { padding: 5rem 0; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

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

.feature-icon { font-size: 1.5rem; margin-bottom: 0.875rem; }

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--charcoal);
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ---- Section label ---- */
.section-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-dark);
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 500;
}

/* ---- Alerts ---- */
.alert {
    border-radius: var(--radius);
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}
.alert-error   { background: var(--red-light);    border-color: #f5c6c2; color: var(--red); }
.alert-success { background: var(--green-light);  border-color: #b8e6c8; color: var(--green); }
.alert-info    { background: var(--yellow-light); border-color: #fde68a; color: #92610A; }

/* ---- Auth forms ---- */
.auth-page { padding: 5rem 0; }

.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}

.auth-box h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--charcoal);
}

.auth-box .auth-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,184,0,0.15);
}

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

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ---- Dashboard ---- */
.dashboard { padding: 3rem 0; }

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

.dashboard-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--charcoal);
}

/* ---- Stats ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

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

.stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1;
}

.stat-value.red    { color: var(--red); }
.stat-value.green  { color: var(--green); }
.stat-value.gold   { color: var(--accent-dark); }

/* ---- Article table ---- */
.articles-section h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--charcoal);
}

.article-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.article-table th {
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.article-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.article-table tr:last-child td { border-bottom: none; }
.article-table tr:hover td { background: var(--bg); }

.article-title-cell a {
    color: var(--charcoal);
    text-decoration: none;
    font-weight: 400;
}
.article-title-cell a:hover { color: var(--accent-dark); }

/* ---- Tag pills ---- */
.tag-pill {
    display: inline-block;
    background: var(--yellow-light);
    border: 1px solid #fde68a;
    border-radius: 100px;
    font-size: 0.72rem;
    padding: 0.2rem 0.65rem;
    color: #92610A;
    margin: 0.1rem;
    text-decoration: none;
    transition: background 0.2s;
}
.tag-pill:hover { background: #fde68a; }

/* ---- Status badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.65rem;
    border-radius: 100px;
    white-space: nowrap;
}

.status-active        { background: var(--green-light); color: var(--green); }
.status-not-found     { background: var(--red-light);   color: var(--red); }
.status-unchecked     { background: var(--bg-elevated); color: var(--text-muted); }
.status-outside-window { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); }
.status-rate-limited  { background: #EEF2FF; color: #5B6EF5; }

/* ---- Setup page ---- */
.setup-page { padding: 3rem 0; }

.setup-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.setup-box h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--charcoal);
}

.setup-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.65;
}

.progress-bar-wrap {
    background: var(--bg-elevated);
    border-radius: 100px;
    height: 6px;
    margin: 1rem 0;
    overflow: hidden;
    display: none;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 100px;
    width: 0%;
    transition: width 0.4s;
}

/* ---- Tag chooser ---- */
.tag-chooser-section {
    background: var(--bg-card);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.tag-chooser-section h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    color: var(--charcoal);
}

.tag-chooser-section .sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.tag-chooser-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.tag-chooser-row:last-child { border-bottom: none; }

.tag-chooser-title { font-size: 0.9rem; color: var(--charcoal); }
.tag-chooser-title a { color: var(--charcoal); text-decoration: none; }
.tag-chooser-title a:hover { color: var(--accent-dark); }

.tag-select {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    min-width: 180px;
}
.tag-select:focus { border-color: var(--accent); outline: none; }

.assign-btn {
    background: var(--accent);
    color: var(--charcoal);
    border: none;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.assign-btn:hover { background: var(--accent-dark); color: #fff; }
.assign-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.assign-feedback { font-size: 0.78rem; margin-top: 0.2rem; display: none; }

/* ---- Window note ---- */
.window-note {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

/* ---- Divider ---- */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.75rem 0;
}

/* ---- Utilities ---- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.text-small  { font-size: 0.85rem; }

/* ---- Spinner ---- */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--accent-dark);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Remove button ---- */
.remove-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 0.9rem; padding: 0.25rem 0.5rem;
    border-radius: var(--radius); transition: color 0.2s, background 0.2s;
}
.remove-btn:hover { color: var(--red); background: var(--red-light); }
.confirm-row { display: none; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.confirm-row.visible { display: block; }

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    background: var(--bg-card);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .hero { padding: 3.5rem 0 3rem; }
    .auth-box { padding: 1.75rem 1.25rem; }
    .dashboard-header { flex-direction: column; gap: 1rem; }
    .article-table { font-size: 0.8rem; }
    .article-table th, .article-table td { padding: 0.625rem 0.625rem; }
    .tag-chooser-row { grid-template-columns: 1fr; }
    .nav-links { gap: 1rem; }
}
