/* ================================================================
   ClimaCoder — shared styles
   Minimal, editorial, white-space-heavy. Teal accent.
   ================================================================ */

/* === CSS Custom Properties === */
:root {
  --clr-primary:        #0f766e;
  --clr-primary-mid:    #0d9488;
  --clr-accent:         #14b8a6;
  --clr-accent-bg:      #f0fdfa;
  --clr-text:           #1a1a1a;
  --clr-text-secondary: #64748b;
  --clr-text-muted:     #94a3b8;
  --clr-border:         #e2e8f0;
  --clr-border-mid:     #cbd5e1;
  --clr-bg:             #f8fafc;
  --clr-white:          #ffffff;
  --clr-danger:         #ef4444;
  --clr-danger-dark:    #b91c1c;
  --clr-danger-bg:      #fef2f2;
  --clr-dark-text:      #475569;
  --clr-nav-urgent:     #dc2626;

  --clr-safe-bg:        #ecfdf5;
  --clr-safe:           #047857;
  --clr-caution-bg:     #fff7ed;
  --clr-caution:        #c2410c;
  --clr-extreme-bg:     #fdf2f8;
  --clr-extreme:        #9d174d;
  --clr-bg-subtle:      #f1f5f9;
  --clr-dark-panel:     #0f172a;
  --clr-teal-light:     #5eead4;
  --clr-bg-page:        #f9fafb;
  --clr-success-bg:     #f0fdf4;
  --clr-success:        #22c55e;
  --clr-success-text:   #14532d;
  --clr-danger-deep:    #7f1d1d;
  --clr-danger-border:  #fecaca;
  --clr-danger-deeper:  #991b1b;
  --clr-amber:          #d97706;
  --clr-slate-dark:     #334155;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 999px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.75;
    color: var(--clr-text);
    background: var(--clr-white);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* --- Nav --- */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo img {
    height: 160px;
    width: auto;
}

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

.nav-links a {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--clr-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    letter-spacing: 0.01em;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--clr-primary);
}

.nav-links a.nav-urgent {
    color: var(--clr-nav-urgent);
    font-weight: 700;
}

.nav-links a.nav-urgent:hover,
.nav-links a.nav-urgent.active {
    color: var(--clr-danger-dark);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--clr-text);
}

.nav-toggle svg {
    width: 22px;
    height: 22px;
}

/* --- Container --- */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Hero --- */
.hero {
    background: transparent;
    color: var(--clr-primary);
    padding: 4rem 2rem;
    border-radius: 0;
    max-width: 1080px;
    margin: 0 auto 3rem;
    box-shadow: none;
}

.hero-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.hero .tagline {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--clr-text);
    opacity: 1;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.hero .meta {
    font-size: 0.82rem;
    color: var(--clr-text-secondary);
    opacity: 1;
}

.hero .meta a {
    color: var(--clr-primary);
}

.hero .meta a:hover {
    color: var(--clr-accent);
}

/* --- Page Header (non-hero) --- */
.page-header {
    padding: 4rem 0 2rem;
}

.page-header h1 {
    font-size: 2.4rem;
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--clr-text);
}

.page-header .subtitle {
    font-size: 1rem;
    color: var(--clr-text-secondary);
    margin-top: 0.5rem;
    line-height: 1.7;
    max-width: 600px;
}

/* --- Section --- */
.section {
    padding: 3rem 0;
}

.section-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--clr-text-muted);
    margin-bottom: 1.5rem;
}

/* --- Cards --- */
.card {
    background: white;
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 0.6rem;
    line-height: 1.35;
}

.card p {
    font-size: 0.9rem;
    color: var(--clr-text-secondary);
    line-height: 1.7;
}

.card .card-meta {
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    margin-top: 1rem;
    font-weight: 500;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-link:hover {
    text-decoration: none;
}

/* --- Grid layouts --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* --- Featured card (larger) --- */
.featured-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease;
}

.featured-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.06);
}

.featured-card .featured-img {
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, var(--clr-border), var(--clr-border-mid));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-muted);
    font-size: 0.85rem;
}

.featured-card .featured-body {
    padding: 2rem;
}

.featured-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.featured-card p {
    font-size: 0.9rem;
    color: var(--clr-text-secondary);
    line-height: 1.7;
}

.featured-card .card-meta {
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    margin-top: 1rem;
}

/* --- Bio cards --- */
.bio-intro {
    max-width: 650px;
    margin-bottom: 3rem;
}

.bio-intro p {
    font-size: 0.95rem;
    color: var(--clr-dark-text);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.bio-card {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.bio-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 300;
    overflow: hidden;
}

.bio-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bio-text h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 0.4rem;
}

.bio-text p {
    font-size: 0.9rem;
    color: var(--clr-text-secondary);
    line-height: 1.75;
}

/* --- Divider --- */
.divider {
    border: none;
    height: 1px;
    background: var(--clr-border);
    margin: 3rem 0;
}

/* --- Block quote / pull quote --- */
.pull-quote {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--clr-primary);
    line-height: 1.5;
    padding: 2rem 0;
    border-left: 3px solid var(--clr-accent);
    padding-left: 2rem;
    margin: 2rem 0;
}

/* --- CTA section --- */
.cta {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.cta p {
    font-size: 1.05rem;
    color: var(--clr-dark-text);
    margin-bottom: 0.5rem;
}

.cta a {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--clr-primary);
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    border-top: 1px solid var(--clr-border);
    margin-top: 2rem;
}

.site-footer a {
    color: var(--clr-text-secondary);
}

/* --- Badge --- */
.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge.safe { background: var(--clr-safe-bg); color: var(--clr-safe); }
.badge.caution { background: var(--clr-caution-bg); color: var(--clr-caution); }
.badge.high { background: var(--clr-danger-bg); color: var(--clr-danger-dark); }
.badge.extreme { background: var(--clr-extreme-bg); color: var(--clr-extreme); }
.badge.teal { background: var(--clr-accent-bg); color: var(--clr-primary); }

/* --- Summary stats (forecast page) --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.2rem;
}

.summary-stat {
    background: var(--clr-bg);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
}

.summary-stat span {
    font-size: 0.78rem;
    color: var(--clr-text-secondary);
    display: block;
    margin-bottom: 0.3rem;
}

.summary-stat strong {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--clr-text);
}

/* --- Chart --- */
.chart {
    width: 100%;
    height: 320px;
}

/* --- Placeholder / empty state --- */
.placeholder {
    background: var(--clr-bg-subtle);
    border: 2px dashed var(--clr-border-mid);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--clr-text-muted);
    font-size: 0.88rem;
}

/* --- Scroll reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-left.visible, .reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .site-nav { padding: 1rem 1.5rem; }
    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem 2rem 1.5rem;
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
        z-index: 100;
        gap: 0.8rem;
    }
    .nav-toggle { display: block; }
    .site-nav { position: relative; }

    .hero { padding: 3rem 1.5rem; }
    .hero h1 { font-size: 2.2rem; }
    .container { padding: 0 1.5rem; }
    .page-header h1 { font-size: 1.8rem; }

    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }

    .bio-card { flex-direction: column; align-items: center; text-align: center; }
    .bio-photo { width: 100px; height: 100px; }

    .pull-quote { font-size: 1.2rem; }
    .chart { height: 260px; }

    /* Mobile dropdown: show inline instead of absolute */
    .nav-dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        margin-top: 0;
        padding: 0 0 0 1rem;
        min-width: 0;
        display: block;
    }
    .nav-dropdown-menu a {
        padding: 0.3rem 0;
    }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 2.5rem 1.2rem; }
    .card { padding: 1.5rem; }
}

/* --- Nav dropdown --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown > a {
    position: relative;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 200;
    margin-top: 0;
}
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.45rem 1.2rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--clr-text-secondary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover {
    background: var(--clr-accent-bg);
    color: var(--clr-primary);
    text-decoration: none;
}

/* --- Language toggle --- */
.lang-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-left: 0.8rem;
}

.lang-btn {
    background: white;
    border: none;
    padding: 0.25rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--clr-text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}

.lang-btn:first-child {
    border-right: 1px solid var(--clr-border);
}

.lang-btn.active {
    background: var(--clr-primary);
    color: white;
}

.lang-btn:hover:not(.active) {
    background: var(--clr-accent-bg);
    color: var(--clr-primary);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal-left, .reveal-right, .reveal-scale {
        opacity: 1; transform: none; transition: none;
    }
}

/* === Utility classes === */

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--clr-primary);
  color: var(--clr-white);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 1rem;
}

/* Display */
.hidden { display: none; }
.text-center { text-align: center; }
.text-italic { font-style: italic; }

/* Margin top helpers */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.25rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }
.mt-6 { margin-top: 2.5rem; }

/* Margin bottom helpers */
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 2.5rem; }

/* Card border accent variants */
.card--primary {
    border-left: 3px solid var(--clr-primary);
}

.card--primary-mid {
    border-left: 3px solid var(--clr-primary-mid);
}

.card--accent {
    border-left: 3px solid var(--clr-accent);
}

.card--danger {
    border-left: 3px solid var(--clr-danger);
}

/* Card heading color variants */
.card-heading--primary {
    color: var(--clr-primary);
}

/* Card meta color variant */
.card-meta--danger {
    color: var(--clr-danger);
}

/* Bio layout: flex section with image sidebar */
.bio-section-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Bio content column (flex grow) */
.bio-content {
    flex: 1;
    min-width: 280px;
}

/* Bio image sidebar */
.bio-sidebar {
    flex-shrink: 0;
    max-width: 320px;
}

/* Rounded image with shadow */
.img-rounded {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Image caption */
.img-caption {
    text-align: center;
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Bio person card (inline card within sidebar) */
.bio-person-card {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: var(--clr-white);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.bio-person-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.bio-person-card a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1.5px solid var(--clr-primary);
}

.bio-person-card p {
    font-size: 0.85rem;
    color: var(--clr-dark-text);
    line-height: 1.7;
}

/* Forecast loading spinner */
.forecast-loading {
    text-align: center;
    padding: 2rem;
    color: var(--clr-text-muted);
    font-size: 0.85rem;
}

.forecast-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--clr-border);
    border-top-color: var(--clr-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.8rem;
}

/* Forecast no-data state */
.forecast-nodata {
    text-align: center;
    padding: 2rem;
    color: var(--clr-text-muted);
    font-size: 0.85rem;
}

/* CLI card paragraph spacing */
.cli-card-intro {
    margin-bottom: 0.8rem;
}

/* Globe section label */
.globe-section-label {
    padding: 0 2rem;
    max-width: 700px;
    margin: 0 auto 1rem;
}

/* Live badge container */
.live-badge-wrap {
    margin-top: 0.3rem;
}

/* Timeline layout wrapper */
.timeline-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Timeline flex column */
.timeline-col {
    flex: 1;
    min-width: 0;
}

/* Timeline aside */
.timeline-aside {
    flex-shrink: 0;
    width: 240px;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
}

.timeline-aside-text {
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    line-height: 1.7;
}

/* Timeline first-term dot style */
.tl-dot--muted {
    background: var(--clr-text-muted);
}

/* Timeline first-term year style */
.tl-year--muted {
    border-left-color: var(--clr-text-muted);
}

/* Flip-flop section header */
.ff-section-header {
    margin-bottom: 2.5rem;
}

.ff-section-title {
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--clr-text);
    margin-bottom: 0.3rem;
}

.ff-section-desc {
    font-size: 0.85rem;
    color: var(--clr-text-secondary);
    margin-bottom: 0;
}

/* Bio intro margin override */
.bio-intro--mb-lg {
    margin-bottom: 2rem;
}

/* Article body text */
.article-body {
    font-size: 0.9rem;
    color: var(--clr-dark-text);
    line-height: 1.85;
}

/* Article paragraph spacing */
.article-body p {
    margin-bottom: 1rem;
}

/* Article sources line */
.article-sources {
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    margin-top: 1rem;
    line-height: 1.6;
}

.article-sources a {
    color: var(--clr-primary);
}

/* Marquee wrap styles (inline border fix) */
.marquee-wrap--bordered {
    overflow: hidden;
    margin: 1rem 0;
    border-top: 1px solid var(--clr-border);
    border-bottom: 1px solid var(--clr-border);
    padding: 0.6rem 0;
}

/* Inline link style (used within body copy and cards) */
.link-primary-underline {
    color: var(--clr-primary);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1.5px solid var(--clr-primary);
    font-size: 0.82rem;
}

/* Wicked-def max-width constraint */
.wicked-def-wrap {
    max-width: 680px;
}

/* Post-normal article card heading */
.article-card-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* Post-normal main card content */
.pn-card-body {
    font-size: 0.9rem;
    color: var(--clr-dark-text);
    line-height: 1.85;
}

/* Forecast chart card margin top */
.fc-chart-card--mt {
    margin-top: 1rem;
}

/* Card with text-center alignment */
.card--centered {
    text-align: center;
}

/* Projects card spacing */
.card--mb-3 {
    margin-bottom: 1.5rem;
}

/* Section-label with inline positioning override */
.section-label--globe {
    padding: 0 2rem;
    max-width: 700px;
    margin: 0 auto 1rem;
}

/* Teaser card (coming soon) */
.card--teaser {
  opacity: 0.6;
  pointer-events: none;
}
.card--teaser .coming-soon-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
}

/* Typewriter heading cursor */
#typewriter-heading::after {
  content: '|';
  animation: tw-blink 0.7s step-end infinite;
  color: var(--clr-primary);
  font-weight: 300;
}
#typewriter-heading.done::after {
  content: '';
  animation: none;
}
@keyframes tw-blink {
  50% { opacity: 0; }
}
