/* ======================
   Global CSS Brand Guidelines for:
   Features 
   Elements 
   Font type, size, colors
   Dark/Light mode variables
   Typography scale
   Spacing tokens
   Button variants
   Form components
   Card layouts
   Shadows, borders, radii
====================== */
:root {
--bg: #f7f7f7;
--bg-alt: #ffffff;
--text-main: #111111;
--text-muted: #555555;
--accent: #000000;
--border: #dddddd;
--link: #000000;
}

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

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
   "Helvetica Neue", Arial, sans-serif;
background: var(--bg);
color: var(--text-main);
line-height: 1.6;
}

a {
color: var(--link);
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

/* Layout wrapper */

.page {
max-width: 1200px;
margin: 0 auto;
padding: 0 16px 40px;
background: var(--bg-alt);
min-height: 100vh;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.03);
}

/* Top bar / header */

header {
border-bottom: 1px solid var(--border);
padding: 16px 0 8px;
margin-bottom: 8px;
}

.top-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
font-size: 0.9rem;
color: var(--text-muted);
}

.top-bar-left {
display: flex;
gap: 16px;
align-items: center;
flex-wrap: wrap;
}

.top-bar-right {
display: flex;
gap: 8px;
align-items: center;
flex-wrap: wrap;
}

.btn-small {
border: 1px solid var(--border);
border-radius: 999px;
padding: 4px 10px;
background: #f0f0f0;
cursor: pointer;
font-size: 0.8rem;
}

.btn-small.primary {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}

/* Brand / nav */

.branding-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 0 4px;
}

.logo {
font-family: "Georgia", "Times New Roman", serif;
font-size: 1.8rem;
letter-spacing: 0.08em;
text-transform: uppercase;
}

.logo span {
font-weight: 700;
}

nav {
display: flex;
align-items: center;
gap: 16px;
font-size: 0.9rem;
}

.nav-links {
display: flex;
gap: 12px;
}

.nav-link {
text-transform: uppercase;
letter-spacing: 0.08em;
font-size: 0.75rem;
color: var(--text-muted);
font-weight: 600;
}

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

.hamburger {
display: none;
cursor: pointer;
flex-direction: column;
gap: 4px;
}

.hamburger span {
width: 20px;
height: 2px;
background: var(--text-main);
}

.mobile-nav {
display: none;
border-top: 1px solid var(--border);
padding: 8px 0 4px;
}

.mobile-nav.open {
display: block;
}

.mobile-nav a {
display: inline-block;
margin: 4px 8px 4px 0;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted);
}

/* Breaking bar */
.breaking {
border-top: 1px solid var(--border);
border-bottom: 1px solid var(--border);
padding: 6px 0;
display: flex;
align-items: center;
gap: 12px;
font-size: 0.85rem;
}

.breaking-label {
text-transform: uppercase;
letter-spacing: 0.14em;
font-weight: 700;
color: #b71c1c;
}

.breaking-headline {
font-weight: 500;
}

/* Main layout */

main {
padding: 16px 0 0;
}

.layout {
display: grid;
grid-template-columns: 2.3fr 1.2fr;
gap: 24px;
margin-bottom: 32px;
}

/* Hero article */

.hero {
border-right: 1px solid var(--border);
padding-right: 12px;
}

.hero img {
width: 100%;
display: block;
margin-bottom: 12px;
height: auto;
border-radius: 2px;
}

.hero-section-label {
text-transform: uppercase;
font-size: 0.75rem;
color: var(--accent);
letter-spacing: 0.12em;
margin-bottom: 6px;
font-weight: 600;
}

.hero h1 {
font-family: "Georgia", "Times New Roman", serif;
font-size: 2rem;
line-height: 1.15;
margin-bottom: 8px;
}

.hero-meta {
font-size: 0.8rem;
color: var(--text-muted);
margin-bottom: 10px;
}

.hero-summary {
font-size: 0.94rem;
color: var(--accent);
}

/* Sidebar */

.sidebar {
font-size: 0.9rem;
}

.sidebar-block {
margin-bottom: 18px;
border-bottom: 1px solid var(--border);
padding-bottom: 12px;
}

.sidebar-title {
text-transform: uppercase;
font-size: 0.8rem;
letter-spacing: 0.14em;
margin-bottom: 8px;
font-weight: 700;
}

.sidebar-story {
margin-bottom: 10px;
}

.sidebar-story h3 {
font-family: "Georgia", serif;
font-size: 1rem;
margin-bottom: 2px;
}

.sidebar-story p {
font-size: 0.8rem;
color: var(--text-muted);
}

/* Grid of articles */

.section-heading {
text-transform: uppercase;
letter-spacing: 0.14em;
font-size: 0.85rem;
margin-bottom: 12px;
font-weight: 700;
}

.cards {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 20px;
}

.card {
border-top: 1px solid var(--border);
padding-top: 10px;
display: flex;
flex-direction: column;
gap: 6px;
}

.card img {
width: 100%;
border-radius: 2px;
margin-bottom: 6px;
}

.card h2 {
font-family: "Georgia", serif;
font-size: 1.1rem;
line-height: 1.25;
}

.card p {
font-size: 0.85rem;
color: var(--text-muted);
}

.card .tag {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.14em;
color: var(--text-muted);
}

/* Footer */

footer {
border-top: 1px solid var(--border);
font-size: 0.75rem;
color: var(--text-muted);
padding: 16px 0 24px;
margin-top: 32px;
}

footer a {
font-size: 0.75rem;
}

.footer-center {
text-align: center;
margin-top: 40px;
padding: 20px 0;
}

.footer-center div {
margin: 6px 0;
}

/* Article Tables (Blog Formatting) */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}

table th,
table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

table th {
  background: #f3f3f3;
  font-weight: 600;
}

/* ============================
   ARTICLE STYLES (BLOG FORMAT)
   ============================ */

/* Headings inside article */
.article-content h1,
.article-content h2,
.article-content h3 {
  font-family: "Georgia", "Times New Roman", serif;
  margin-bottom: 12px;
  line-height: 1.3;
}

/* Paragraph spacing */
.article-content p {
  margin-bottom: 16px;
  font-size: 1rem;
}

/* Lists */
.article-content ul,
.article-content ol {
  margin: 12px 0 16px 24px;
  padding-left: 0;
}

.article-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* Responsive article images */
.article-content img {
  width: 100%;
  height: auto;
  border-radius: 2px;
  margin: 20px 0;
}

/* Table styles */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
}

.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.article-content th {
  background: #f4f4f4;
  font-weight: 600;
}

/* Space between sections */
.article-content section {
  margin-bottom: 32px;
}

.content-section {
  margin-bottom: 40px;  /* adjust spacing here */
}

/* Responsive */

@media (max-width: 900px) {
.layout {
   grid-template-columns: 1fr;
}

.hero {
   border-right: none;
   padding-right: 0;
   border-bottom: 1px solid var(--border);
   padding-bottom: 16px;
}

.cards {
   grid-template-columns: repeat(2, minmax(0, 1fr));
}
}

@media (max-width: 700px) {
.top-bar {
   flex-direction: column;
   align-items: flex-start;
}

nav {
   justify-content: flex-end;
}

.nav-links {
   display: none;
}

.hamburger {
   display: flex;
}

.cards {
   grid-template-columns: 1fr;
}

.hero h1 {
   font-size: 1.6rem;
}

.page {
   padding: 0 10px 24px;
}
}

/* ============================================
   DARK MODE — Auto-detect (prefers-color-scheme)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-alt: #161616;
    --text-main: #f5f5f5;
    --text-muted: #bbbbbb;
    --accent: #ffffff;
    --border: #333333;
    --link: #ffffff;
  }

  body {
    background: var(--bg);
    color: var(--text-main);
  }

  .page {
    background: var(--bg-alt);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  }

  header,
  footer,
  .sidebar-block,
  .card,
  .hero {
    border-color: var(--border);
  }

  .top-bar,
  .branding-row,
  .mobile-nav,
  .breaking {
    border-color: var(--border);
    color: var(--text-muted);
  }

  a {
    color: var(--link);
  }

  a:hover {
    text-decoration: underline;
  }

  /* Buttons */
  .btn-small {
    background: #2a2a2a;
    border-color: var(--border);
    color: var(--text-main);
  }

  .btn-small.primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
  }

  /* Cards & hero images */
  .card img,
  .hero img {
    filter: brightness(0.9);
  }

  /* Article table */
  table th {
    background: #222;
    color: var(--text-main);
  }

  table td {
    background: #181818;
  }

  /* Mobile nav links */
  .mobile-nav a {
    color: var(--text-muted);
  }

  /* Breaking news label */
  .breaking-label {
    color: #ff6b6b;
  }
}

/* ============================================
   Profile Page
   ============================================ */
.profile-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0 16px;
  text-align: center;
}

.profile-header .avatar {
  width: 240px;        /* larger, more balanced */
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 14px auto;
}

.profile-header .subtitle {
  margin-top: 8px;
  display: block;
}

.profile-header .username {
  margin-top: 6px;
  font-weight: 600;
}

.nav-link {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Unified Profile Section Spacing */
#wellness-section,
#lifestyle-section {
  margin-top: 32px;
  padding: 0 0 40px 0;
}

/* Ensure hidden sections fully collapse */
#wellness-section[hidden],
#lifestyle-section[hidden] {
  display: none !important;
}

/* Large CTA buttons consistent with index.css CTA aesthetics */
.save-btn {
  width: 100%;
  display: block;
  padding: 14px 0;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  margin-top: 20px;
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
}

.save-btn:hover {
  opacity: 0.9;
}

/* Profile Navigation Bar */
.info-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.info-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.info-icon:hover {
  color: var(--accent);
}

.info-icon.is-active svg {
  color: var(--accent);
}

/* Lifestyle Form Fields */
.lifestyle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 16px;
}

.lifestyle-grid label {
  display: block;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
}

.lifestyle-grid input,
.lifestyle-grid select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-main);
  font-size: .9rem;
}

/* Make any full-row item span both columns */
.lifestyle-grid label.full-row {
  grid-column: 1 / -1;
}

/* Beautify the textarea */
.lifestyle-grid textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-main);
  font-size: .9rem;
  min-height: 160px;
  resize: vertical;
}


img.responsive,
.content-section img,
.hero img,
.article-content img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

/* Mobile-specific media constraint */

@media (max-width: 768px) {
  .hero img,
  .content-section img,
  .article-content img {
    max-height: 260px;
    width: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
  }
}

/* ChatGPT Section */
.chatgpt-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
}

.chatgpt-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  border-radius: 10px;
  background: #fafafa;
  margin-bottom: 15px;
  border: 1px solid #ddd;
}

.chatgpt-message {
  margin-bottom: 12px;
  line-height: 1.5;
}

.chatgpt-user {
  font-weight: 600;
  color: var(--primary-color);
}

.chatgpt-assistant {
  color: #444;
}

.chatgpt-input-row {
  display: flex;
  gap: 10px;
}

#chatgpt-input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

/* ============================================================
   FINAL DARK-MODE FIX FOR ALL ACCORDION LEVELS
   Removes ALL hard-coded white/light backgrounds.
   Forces all summaries + bodies to use global theme variables.
   ============================================================ */

details.accordion-level-1,
details.accordion-level-2,
details.accordion-level-3 {
  background: var(--bg-alt) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-main) !important;
}

/* Summary bars */
details.accordion-level-1 > summary,
details.accordion-level-2 > summary,
details.accordion-level-3 > summary {
  background: var(--bg-alt) !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* When open */
details[open] > summary {
  background: var(--bg) !important;
  color: var(--text-main) !important;
}

/* Inner panels (the boxes in your screenshot) */
.accordion-body {
  background: var(--bg-alt) !important;
  color: var(--text-main) !important;
  border: none !important;
}

/* Remove residual white from nested wrappers */
details.accordion-level-2,
details.accordion-level-3 {
  background-color: var(--bg-alt) !important;
}

/* Outline labels */
.outline-label,
.prompt-text-label {
  color: var(--text-main) !important;
}

/* ============================
   Global Caption Style
   ============================ */
.caption {
  font-size: 0.75rem;          /* clean, discreet */
  color: var(--text-muted);    /* auto dark-mode compatible */
  text-align: left;          /* optional but elegant */
  margin-top: -4px;            /* pulls closer to the image */
  margin-bottom: 12px;         /* spacing consistency */
}

/* ============================================
   UNIFIED GLOBAL FOOTER
   Overrides all previous footer variants
   ============================================ */

.unified-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.unified-footer .footer-copy {
  margin-bottom: 10px;
}

.unified-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.unified-footer a {
  color: var(--link);            /* automatically white in dark mode */
  text-decoration: none;
  transition: opacity 0.2s ease, text-decoration-color 0.2s ease;
  opacity: 0.85;
}

.unified-footer a:hover {
  opacity: 1;
  text-decoration: underline;    /* consistent underline hover */
}

.unified-footer span {
  color: var(--text-muted);
  opacity: 0.6;
}
