/* ==========================================================================
   BASE STYLES - Consolidated
   Contains: variables, typography, layout, motion, tokens
   ========================================================================== */

/* ==========================================================================
   VARIABLES
   ========================================================================== */

:root {
    /* Dual Font System - Outfit for headers, Inter for body (screen-optimized) */
    --font-family-outfit: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-family-inter: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-sans: var(--font-family-inter); /* Default to body font */
    
    /* Font Weights - Optimized for dual system */
    --weight-regular: 425;  /* Inter 425 - designed specifically for screens */
    --weight-medium: 500;   /* Both fonts */
    --weight-semibold: 600; /* Both fonts */
    --weight-bold: 700;     /* Outfit headers */
    --weight-black: 800;    /* Outfit logo */

    /* Refined Navigation Colors - Less candy-like, more sophisticated */
    --decode-accent: #7C3AED;    /* Deep purple - investigation */
    --figures-accent: #6B7280;   /* Neutral gray - let emoji shine */
    --arguments-accent: #DC2626; /* Deep red - debate/passion */
    
    /* Navigation Icon Colors with muted saturation */
    --nav-decode-color: var(--decode-accent);
    --nav-figures-color: var(--figures-accent);
    --nav-arguments-color: var(--arguments-accent);

    /* Layout */
    --header-height: 88px;
    --header-spacer-height: 88px;

    /* Page & Card Backgrounds - Subtle warmth vs pure white */
    --page-bg: #FAFAF9;
    --card-bg: #FFFFFF;
    --evidence-summary-bg: #F6F7F8;

    /* Warmed Text Colors - Not pure black */
    --text-headline: #1F2937;
    --text-card-title: #1F2937;
    --text-body: #374151;
    --text-hook-label: #6B7280;
    --text-meta-info: #9CA3AF;

    /* Sophisticated Chip Color Palette - Less Saturated for Better Integration */
    --status-false: #d63447;
    --status-mostly-false: #f87f8f;
    --status-mixed: #9f82e5;
    --status-mostly-true: #6b9fe0;
    --status-true: #45c795;
    
    /* Special states */
    --status-unverified: #94a3b8;
    --status-opinion: #c084fc;
    --status-outdated: #fbbf24;

    /* Legacy Chip Colors - Updated with friendly status colors */
    --chip-true-base: var(--status-true);
    --chip-mostly-true-base: var(--status-mostly-true);
    --chip-mixed-base: var(--status-mixed);
    --chip-mostly-false-base: var(--status-mostly-false);
    --chip-false-base: var(--status-false);
    --chip-unverifiable-base: #6B7280;

    /* Chip Text Colors - Optimized for new palette */
    --chip-false-text: #FFFFFF;
    --chip-mostly-false-text: #1e293b;
    --chip-mixed-text: #1e293b;
    --chip-mostly-true-text: #1e293b;
    --chip-true-text: #1e293b;
    --chip-unverifiable-text: #FFFFFF;
    
    /* The Fig Touch */
    --fig-accent-color: #8B7355;

    /* Mapped legacy variables */
    --primary-color: var(--chip-true-base);
    --secondary-color: var(--fig-accent-color);
    --success-color: var(--chip-true-base);
    --alert-color: var(--chip-false-base); 
    --neutral-color: var(--chip-unverifiable-base);

    --header-text-color: var(--text-card-title);
    --body-text-color: var(--text-body);
    --secondary-text-color: var(--text-meta-info);
    
    --page-background-color: var(--page-bg);
    --content-background-color: var(--card-bg);
    --accent-header-background: var(--evidence-summary-bg);

    --ui-border: #E5E7EB;
    --ui-divider: rgba(0, 0, 0, 0.06);

    /* Breakpoints & Transitions */
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --ui-transition: 0.2s ease-in-out;

    /* Arguments accents for inline-checks */
    --accent-600: #0C4A6E;
    --accent-700: #0A3D5E;
    --green-600: #16A34A;

    /* Inline proof tokens */
    --ink: #0f172a;
    --muted: #475569;
    --bg: #f8f9fa;
    --accent: #2563eb;
    --u-th: .14em;
    --u-off: .18em;

    /* Underline palette for inline checks */
    --uc-verified: #22C55E;
    --uc-disputed: #FF9E66;
    --uc-mixed: #0EA5E9;
    --uc-opinion: #64748B;
    
    /* Motion tokens */
    --transition-fast: 150ms ease-out;
    --transition-medium: 250ms ease-out;
    --transition-slow: 350ms ease-out;
}

@media (max-width: 768px) {
  :root {
    --header-spacer-height: 144px;
  }
}

/* ==========================================================================
   TOKENS (Design tokens and type scale)
   ========================================================================== */

:root{
  /* темы */
  --t-climate:#00BFA5; --t-climate-ac:#FF6B6B;
  --t-energy:#FF6B6B;  --t-energy-ac:#F59E0B;
  --t-health:#4ECDC4;  --t-health-ac:#3B82F6;
  --t-tech:#8B5CF6;    --t-tech-ac:#EC4899;
  --t-policy:#64748B;  --t-policy-ac:#8B7355;

  /* дополнительные темы (пастель) */
  --t-food:#F59E0B;        --t-food-ac:#84CC16;
  --t-environment:#22C55E; --t-environment-ac:#0EA5E9;
  --t-transport:#0EA5E9;   --t-transport-ac:#F97316;
  --t-science:#14B8A6;     --t-science-ac:#A78BFA;
  --t-economics:#8B7355;   --t-economics-ac:#22C55E;
  --t-geography:#60A5FA;   --t-geography-ac:#10B981;

  /* хуки */
  --h-why:#F59E0B; --h-context:#06B6D4; --h-claim:#EF4444;
  --h-found:#3B82F6; --h-evidence:#8B5CF6; --h-receipts:#F97316;
  --h-method:#6366F1; --h-thisyou:#EC4899; --h-read:#8B7355;

  /* статусы */
  --s-true: var(--status-true, #45c795);
  --s-mostly-true: var(--status-mostly-true, #6b9fe0);
  --s-mixed: var(--status-mixed, #9f82e5);
  --s-mostly-false: var(--status-mostly-false, #f87f8f);
  --s-false: var(--status-false, #d63447);
  --s-unverified: var(--status-unverified, #94a3b8);
  --s-opinion: var(--status-opinion, #c084fc);
  --s-outdated: var(--status-outdated, #fbbf24);

  /* Spacing scale */
  --s8:8px; --s16:16px; --s32:32px;
}

/* Type scale */
html{font-size:17px}
@media(max-width:640px){html{font-size:16px}}
body{font-size:1rem;line-height:1.55}
h3{font-size:1.75rem;line-height:1.25;text-wrap:balance;letter-spacing:-.005em}
h4{font-size:1.5rem; line-height:1.25;text-wrap:balance}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

/* Local Fungis font */
@font-face {
    font-family: 'Fungis Grotesque';
    src: url('/fonts/FungisGrotesque/FungisRegular.woff2') format('woff2'),
         url('/fonts/FungisGrotesque/FungisRegular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Fungis Grotesque';
    src: url('/fonts/FungisGrotesque/FungisRegular.woff2') format('woff2'),
         url('/fonts/FungisGrotesque/FungisRegular.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

body {
    font-family: var(--font-family-inter);
    background: var(--page-bg) !important;
    color: var(--text-body);
    line-height: 1.75;
    margin: 0;
    padding: 0;
    font-weight: var(--weight-regular);
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    color: var(--header-text-color);
    font-family: var(--font-sans);
    line-height: 1.3;
    letter-spacing: -0.02em;
    scroll-margin-top: var(--header-spacer-height, var(--header-height));
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}

.headline, h1 { 
    font-family: var(--font-family-outfit);
    font-weight: 700;
    font-size: 2rem;
    color: var(--text-headline);
    margin-top: 1.5em; 
    margin-bottom: 0.75em;
}

.card-title, h2 { 
    font-family: var(--font-family-outfit);
    font-weight: 700;
    font-size: 1.1875rem;
    line-height: 1.35;
    color: var(--text-card-title);
    letter-spacing: -0.02em;
    margin-top: 1em; 
    margin-bottom: 8px;
    text-transform: none;
    display: inline;
}

h1 { font-size: 28px; margin-bottom: 12px; }
h2 { font-size: 24px; margin-bottom: 10px; }
h3 { font-size: 20px; margin-bottom: 8px; }

p, li, td, th, .evidence-summary {
    font-family: var(--font-family-inter);
    font-weight: 425;
    font-size: 0.9375rem;
    color: var(--text-body);
    line-height: 1.8;
    letter-spacing: 0.01em;
    margin-bottom: 16px;
}

p { margin: 0 0 16px 0; line-height: 1.6; }

a {
    color: #3B82F6;
    text-decoration: none;
}
a:hover {
    color: #3B82F6;
    text-decoration: underline; 
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.header-spacer { height: var(--header-spacer-height, 120px); }

.card-description {
    font-family: var(--font-family-inter);
    font-weight: 425;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #64748b;
    margin-top: 8px;
    margin-bottom: 16px;
}

.card-meta, .meta, .meta-info, small {
    font-family: var(--font-family-inter);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.hook-label, .section-header {
    font-family: var(--font-family-outfit);
    font-size: 13px;
    font-weight: var(--weight-semibold);
    color: var(--text-hook-label);
    letter-spacing: 0.05em;
}

.meta {
    font-family: var(--font-family-inter);
    font-size: 13px;
    color: var(--text-meta-info);
    font-weight: var(--weight-medium);
}

.evidence-summary-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94A3B8;
  margin-bottom: 8px;
}

.evidence-text {
  word-spacing: normal;
  letter-spacing: normal;
  line-height: 1.6;
}

.evidence-summary {
    font-family: var(--font-family-inter);
    font-weight: 425;
    font-size: 0.9375rem;
    color: var(--text-body);
    line-height: 1.8;
    letter-spacing: normal;
    word-spacing: normal;
    margin-bottom: 16px;
}

.details-link {
  color: #64748B;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.details-link:hover { color: #3B82F6; }
.details-link::after { content: '→'; font-size: 12px; }

.evidence-quote {
    font-size: 15px;
    line-height: 1.7;
    color: #475569;
    padding-left: 20px;
    position: relative;
    font-style: italic;
    margin: 20px 0;
}
.evidence-quote::before {
  content: '"';
  position: absolute;
  left: 0;
  top: -5px;
  font-size: 32px;
  color: #E2E8F0;
  font-family: Georgia;
}

/* Content Card Style */
.content-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 44px;
  margin-bottom: 44px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: none;
}

.u-block + .u-block { border-top: 1px solid #E0E0E0; padding-top: 32px; }

@media (min-width: 1024px) {
  .content-card { padding: 28px 32px; }
}

@media (max-width: 768px) {
  .content-card { padding: 12px; }
}

.hook-section { padding: 40px 0; }
.hook-content { padding-top: 20px; }

li {
  margin-bottom: 24px;
  line-height: 1.8;
  color: #374151;
}

.accented-block {
    background: var(--evidence-summary-bg);
    border-left: 3px solid var(--neutral-color);
    border-radius: 0 8px 8px 0;
    padding: 24px;
    margin: 24px 0;
    box-shadow: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
    padding-left: 18px;
    margin-left: 2px;
    margin-top: 8px;
    margin-bottom: 16px;
}

.accented-block.main-accent { border-left-color: var(--main-accent-color); }
.accented-block.success { border-left-color: var(--status-true); }
.accented-block.alert { border-left-color: var(--status-false); }
.accented-block.neutral { border-left-color: var(--neutral-color); }
.accented-block.context { border-left-color: var(--main-accent-color); }
.accented-block.evidence { border-left-color: var(--neutral-color); }
.accented-block.core-claim { border-left-color: var(--neutral-color); }
.accented-block.why-it-matters { border-left-color: var(--status-true); }
.accented-block.this-means { border-left-color: var(--header-text-color); }
.accented-block.key-findings { border-left-color: var(--decode-accent); }
.accented-block.contradictions { border-left-color: var(--status-false); }

/* Page width control */
.page-container:not(.feed-container) {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 32px;
}

.feed-container {
    width: 100%;
    max-width: 900px !important;
    margin: 0 auto;
    padding: 24px;
}

@media (min-width: 768px) {
    .page-container:not(.feed-container) { max-width: 595px; }
    .feed-container { max-width: 765px !important; }
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 32px;
    width: 100%;
    margin: 0 auto;
    margin-top: 120px;
}

.feed-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.feed-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    background-color: white;
    cursor: pointer;
    padding: 24px;
    border: none;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 1.2rem;
}

.loading-text {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.page { display: none; }
.page.active { display: block; }

.debug-section {
    margin-top: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.debug-header {
    background-color: #f0f0f0;
    padding: 12px 16px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}
.debug-content {
    padding: 16px;
    background-color: #ffffff;
    max-height: 500px;
    overflow: auto;
}
.debug-content pre { margin: 0; white-space: pre-wrap; }

@media (max-width: 700px) {
    .featured-section, .feed-grid { grid-template-columns: 1fr; }
    .featured-large { grid-column: 1; }
    .page-container, .feed-container { padding: 12px; }
}

.content-section {
  background: var(--content-background-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

body, .main-container, .app-wrapper {
    background-color: var(--page-bg) !important;
}

.page-header .page-title { margin-top: 0; }
.page-header .page-subtitle { margin-top: 0; }

p, li, td, th { line-height: 1.6; }

.section-divider {
    height: 32px;
    background: none;
    margin: 48px 0;
    border: none;
}

.profile-image, .figure-profile img, .claimant img {
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 50%;
}

.expand-button, .details-link {
    color: #3B82F6 !important;
    font-weight: 500;
    text-decoration: none;
}
.expand-button:hover, .details-link:hover {
    text-decoration: underline;
    color: #2563EB !important;
}

/* Color Utilities */
.text-decode { color: var(--decode-accent); }
.text-figures { color: var(--figures-accent); }
.text-arguments { color: var(--arguments-accent); }
.text-true { color: var(--status-true); }
.text-false { color: var(--status-false); }

.bg-decode { background-color: var(--decode-accent); }
.bg-figures { background-color: var(--figures-accent); }
.bg-arguments { background-color: var(--arguments-accent); }
.bg-true { background-color: var(--status-true); }
.bg-false { background-color: var(--status-false); }

.bg-decode-subtle { background-color: rgba(124, 58, 237, 0.08); }
.bg-figures-subtle { background-color: rgba(107, 114, 128, 0.08); }
.bg-arguments-subtle { background-color: rgba(220, 38, 38, 0.08); }
.bg-true-subtle { background-color: rgba(16, 185, 129, 0.1); }
.bg-false-subtle { background-color: rgba(239, 68, 68, 0.1); }

/* ==========================================================================
   MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0.01ms;
    --transition-medium: 0.01ms;
    --transition-slow: 0.01ms;
  }
  
  html { scroll-behavior: auto !important; }
  *:hover, *:focus { transform: none !important; }
  .page-transition { animation: none !important; }
  
  button, a, input, select, textarea, .clickable, .interactive {
    transition-duration: 0.01ms !important;
  }
  
  .loading, .spinner, .skeleton { animation: none !important; }
  .parallax { transform: none !important; will-change: auto !important; }
  :focus { transition: outline 0.01ms !important; }
}

@media (prefers-contrast: high) {
  .feed-card, .featured-large, .featured-medium {
    border: 2px solid var(--border-color);
  }
  .status-pill { border: 1px solid currentColor; }
  :focus { outline: 3px solid var(--focus-color); outline-offset: 2px; }
}

@media (prefers-reduced-transparency: reduce) {
  .modal-backdrop { background-color: #000; }
  .header { background-color: var(--header-bg); }
  .feed-card, .featured-large, .featured-medium { background-color: white; }
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.u-gap8{ margin-top:var(--s8) }
.u-gap16{ margin-top:var(--s16) }
.u-block{ margin-top:var(--s32) }

.clamp-1{ -webkit-line-clamp:1; display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden; }
.clamp-2{ -webkit-line-clamp:2; display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden; }

.back-link { display: none; }

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}



