:root {
    --primary: #ff5a36;
    --primary-dark: #dc4221;
    --accent: #ffd166;
    --bg-dark: #111111;
    --bg-medium: #181818;
    --bg-light: #242424;
    --bg-panel: #1f1f1f;
    --text-main: #f2f1ec;
    --text-muted: #b8b4aa;
    --border: #313131;
    --white: #ffffff;
    --success-bg: #163322;
    --success-text: #baf1cb;
    --error-bg: #3d1d1d;
    --error-text: #ffb4b4;
    --transition: all 0.25s ease;
    --radius: 18px;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background:
        radial-gradient(circle at top right, rgba(255, 90, 54, 0.18), transparent 22%),
        linear-gradient(180deg, #171717 0%, #111111 100%);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

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

.container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background: rgba(17, 17, 17, 0.84);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 18px 0;
}

.logo {
    font-size: 1.55rem;
    font-weight: 900;
    text-decoration: none;
    letter-spacing: -0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo span {
    color: var(--primary);
}

nav {
    min-width: 0;
    overflow: hidden;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px; /* prevents clipping on scroll */
}

nav ul::-webkit-scrollbar {
    display: none;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}

nav a:hover,
nav a.active {
    color: var(--white);
}

.nav-tip-link {
    color: var(--accent);
}

.hero {
    padding: 72px 0 34px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 28px;
    align-items: stretch;
}

.hero-text h1 {
    font-size: clamp(2.7rem, 5vw, 4.4rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    margin-bottom: 22px;
}

.hero-text p,
.hero-panel p,
.form-intro,
.story-dek,
.story-body p,
.sidebar-card p {
    color: var(--text-muted);
}

.trending-badge,
.category-tag {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-actions,
.admin-actions {
    display: flex;
    gap: 14px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.editor-toolbar button,
.tip-status-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
    cursor: pointer;
}

.primary-button,
button[type='submit'] {
    padding: 14px 18px;
    background: var(--primary);
    color: var(--white);
    border: none;
}

.primary-button:hover,
button[type='submit']:hover {
    background: var(--primary-dark);
}

.secondary-button,
.editor-toolbar button {
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
}

.secondary-button:hover,
.editor-toolbar button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hero-panel,
.featured-card,
.post-card,
.admin-container,
.sidebar-card,
.story-page,
.notice,
.editor-panel {
    background: rgba(24, 24, 24, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hero-panel h2,
.story-page h1,
.admin-topbar h1 {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.section-header {
    margin: 26px 0 20px;
}

.section-header h2,
.sidebar-card h3 {
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
}

.featured-story {
    margin-bottom: 20px;
}

.featured-card {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
    gap: 24px;
    overflow: hidden;
}

.featured-copy {
    padding: 28px;
}

.featured-copy h2 {
    margin: 18px 0 16px;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.03;
}

.featured-copy h2 a,
.story-link {
    text-decoration: none;
}

.story-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.story-meta a {
    color: var(--accent);
    text-decoration: none;
}

.featured-image-wrap {
    min-height: 100%;
}

.featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 26px;
    margin-bottom: 80px;
}

.post-card {
    overflow: hidden;
}

.post-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.post-content {
    padding: 22px;
}

.post-card h2 {
    margin: 14px 0 12px;
    font-size: 1.34rem;
    line-height: 1.25;
}

.date {
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.story-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 320px;
    gap: 30px;
    padding-top: 48px;
    padding-bottom: 80px;
}

.story-page {
    padding: 34px;
}

.story-page h1 {
    margin: 18px 0 14px;
}

.story-dek {
    font-size: 1.1rem;
}

.story-hero-image {
    margin: 26px 0;
    border-radius: 16px;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
}

.story-body {
    font-size: 1.02rem;
}

.story-body > * + * {
    margin-top: 16px;
}

.story-body a {
    color: var(--accent);
}

.story-body ul,
.story-body ol {
    padding-left: 24px;
}

.story-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.story-body th,
.story-body td {
    border: 1px solid var(--border, #ddd);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

.story-body thead th {
    background: var(--surface-alt, #f5f5f5);
    font-weight: 600;
}

.story-sidebar,
.admin-sidebar {
    display: grid;
    gap: 20px;
    align-content: start;
}

.sidebar-card {
    padding: 22px;
}

.related-list,
.dashboard-list {
    list-style: none;
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.related-list a,
.dashboard-list a {
    text-decoration: none;
}

.dashboard-list span {
    display: block;
    color: var(--text-muted);
    font-size: 0.86rem;
}

footer {
    padding: 56px 0 40px;
    border-top: 1px solid var(--border);
    background: rgba(19, 19, 19, 0.95);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 28px;
}

.footer-info p,
.footer-bottom,
.footer-links a {
    color: var(--text-muted);
}

.footer-links ul {
    list-style: none;
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.footer-links a {
    text-decoration: none;
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.standalone-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
}

.form-container {
    width: min(760px, 100%);
}

.admin-container,
.editor-panel {
    padding: 34px;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
}

.notice {
    padding: 16px 18px;
    margin-bottom: 18px;
}

.notice.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.notice.error {
    background: var(--error-bg);
    color: var(--error-text);
}

form {
    display: grid;
    gap: 16px;
}

label {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-muted);
}

input,
select,
textarea,
.rich-editor {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #101010;
    color: var(--text-main);
    font: inherit;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.rich-editor:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 90, 54, 0.15);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-main);
}

.checkbox-row input {
    width: auto;
    margin-top: 2px;
}

.admin-dashboard {
    padding: 40px 0 70px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 24px;
}

.admin-subtitle {
    color: var(--text-muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 340px;
    gap: 24px;
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.rich-editor {
    min-height: 320px;
}

.rich-editor:empty::before {
    content: 'Write the story here. Use the toolbar for basic formatting.';
    color: #7d7d7d;
}

.tips-list {
    display: grid;
    gap: 18px;
}

.tip-card h2 {
    margin-top: 12px;
    font-size: 1.4rem;
}

.tip-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.tip-meta {
    color: var(--text-muted);
    margin-top: 14px;
}

.tip-status-form {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
}

.tip-status-form select {
    max-width: 220px;
}

/* ── Admin form layout ─────────────────────────────────────────────────────── */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-col {
    display: grid;
    gap: 8px;
    align-content: start;
}

.field-hint {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.7;
}

.checkbox-group {
    display: grid;
    gap: 10px;
}

.seo-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.seo-panel summary {
    padding: 12px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.seo-panel summary::-webkit-details-marker { display: none; }
.seo-panel summary::before { content: '+ '; }
.seo-panel[open] summary::before { content: '- '; }

.seo-fields {
    padding: 0 16px 16px;
    display: grid;
    gap: 12px;
}

/* ── Article badges ─────────────────────────────────────────────────────────── */

.story-labels {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 4px;
}

.format-tag {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.format-opinion  { color: #c4a0ff; border-color: rgba(196, 160, 255, 0.25); }
.format-analysis { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.25); }
.format-theory   { color: #86efac; border-color: rgba(134, 239, 172, 0.25); }
.format-breaking { color: var(--primary); border-color: rgba(255, 90, 54, 0.3); }
.format-feature  { color: var(--accent);  border-color: rgba(255, 209, 102, 0.25); }

.breaking-badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary);
    color: var(--white);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

/* ── Story hero figure ──────────────────────────────────────────────────────── */

.story-hero-figure {
    margin: 26px 0;
}

.story-hero-figure .story-hero-image {
    margin: 0;
}

.story-hero-figure figcaption {
    margin-top: 8px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.image-credit {
    margin-left: 6px;
    opacity: 0.65;
    font-size: 0.8rem;
}

/* ── Notice variants ────────────────────────────────────────────────────────── */

.notice-info {
    background: #0f2030;
    color: #a0c8e8;
    border: 1px solid rgba(160, 200, 232, 0.2);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

/* Tablet: collapse two-column layouts, keep header as a single row */
@media (max-width: 980px) {
    .form-row,
    .hero-grid,
    .featured-card,
    .story-layout,
    .admin-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .featured-card {
        border-radius: var(--radius);
    }

    .featured-image-wrap {
        min-height: 260px;
    }
}

/* Mobile: tighten spacing, shrink text, stack admin chrome */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .header-content {
        gap: 12px;
        padding: 13px 0;
    }

    nav ul {
        gap: 14px;
    }

    .hero {
        padding: 40px 0 24px;
    }

    .hero-text h1 {
        font-size: clamp(2rem, 8vw, 2.8rem);
    }

    .featured-copy {
        padding: 20px;
    }

    .featured-copy h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin: 12px 0 10px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .story-page {
        padding: 22px;
    }

    .story-page h1 {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    .story-dek {
        font-size: 1rem;
    }

    .admin-container,
    .editor-panel {
        padding: 22px;
    }

    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-actions {
        margin-top: 0;
    }

    .section-header {
        margin: 20px 0 14px;
    }

    footer {
        padding: 40px 0 28px;
    }
}

/* Small mobile: simplify further */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .logo {
        font-size: 1.3rem;
    }

    nav a {
        font-size: 0.88rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 10px;
    }

    .primary-button,
    button[type='submit'] {
        width: 100%;
        justify-content: center;
    }

    .secondary-button {
        width: 100%;
        justify-content: center;
    }

    .hero-actions .secondary-button {
        width: auto;
    }

    .post-card img {
        height: 180px;
    }

    .story-layout {
        padding-top: 24px;
        padding-bottom: 48px;
    }

    .tip-status-form {
        flex-wrap: wrap;
    }

    .tip-status-form select {
        width: 100%;
        max-width: 100%;
    }

    .tip-header {
        flex-direction: column;
        gap: 8px;
    }
}
