/* ================================================
   Triadive — Main Stylesheet
   Design language: developers.openai.com reference
   - System sans-serif throughout (no serif headings)
   - Pure white background, near-black text, single subtle accent
   - Generous whitespace, big hero typography
   - Light borders, no heavy shadows on hover
   ================================================ */

/* 1. CSS Variables */
:root {
 --color-bg: #ffffff;
 --color-surface: #f7f7f8;
 --color-surface-hover: #f1f1f2;
 --color-text: #0d0d0d;
 --color-text-muted: #555;
 --color-text-faint: #888;
 --color-accent: #0d0d0d;
 --color-accent-hover: #3a3a3a;
 --color-border: #e5e5e5;
 --color-border-strong: #d0d0d0;
 --color-code-bg: #f5f5f5;
 --font-body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
 --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
 --max-width: 1200px;
 --content-width: 720px;
 --radius: 8px;
 --radius-sm: 4px;
}

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

html {
 font-size: 16px;
 -webkit-text-size-adjust: 100%;
}

body {
 font-family: var(--font-body);
 color: var(--color-text);
 background-color: var(--color-bg);
 line-height: 1.6;
 min-height: 100vh;
 display: flex;
 flex-direction: column;
 -webkit-font-smoothing: antialiased;
 -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }

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

a:hover { color: var(--color-text-muted); }

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

/* Inline link styling — links in prose need underline (WCAG 1.4.1).
   Nav and footer links have their own styling. */
.prose p a, article p a, .content a, main p a, .text-content a, .article-body a,
.footer-bottom p a, .main-footer a, .footer-bottom a {
 text-decoration: underline;
 text-decoration-thickness: 1px;
 text-underline-offset: 2px;
}

/* 3. Typography — all sans-serif, modern sizes */
h1, h2, h3, h4, h5, h6 {
 font-family: var(--font-body);
 color: var(--color-text);
 line-height: 1.15;
 font-weight: 600;
 letter-spacing: -0.02em;
}

h1 { font-size: 3rem; margin: 0 0 1rem; letter-spacing: -0.03em; }
h2 { font-size: 1.75rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
h4 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }

p { margin-bottom: 1rem; }

code, pre {
 font-family: var(--font-mono);
 font-size: 0.875em;
 background: var(--color-code-bg);
 padding: 1px 6px;
 border-radius: var(--radius-sm);
 color: #1a1a1a;
}

pre {
 padding: 1rem 1.25rem;
 overflow-x: auto;
 margin: 1.25rem 0;
 line-height: 1.5;
}

pre code {
 background: transparent;
 padding: 0;
 border-radius: 0;
}

blockquote {
 border-left: 3px solid var(--color-border-strong);
 padding: 0.25rem 1rem;
 margin: 1.25rem 0;
 color: var(--color-text-muted);
 font-style: italic;
}

hr {
 border: 0;
 border-top: 1px solid var(--color-border);
 margin: 2.5rem 0;
}

/* 4. Top utility bar — minimal, no heavy black band */
.top-bar {
 background-color: var(--color-bg);
 border-bottom: 1px solid var(--color-border);
 padding: 0 2rem;
 height: 60px;
 display: flex;
 align-items: center;
 gap: 2rem;
 max-width: var(--max-width);
 margin: 0 auto;
}

.top-wordmark {
 color: var(--color-text);
 font-family: var(--font-body);
 font-weight: 700;
 font-size: 1.05rem;
 letter-spacing: -0.02em;
}

.top-wordmark:hover { color: var(--color-text-muted); text-decoration: none; }

.top-tagline {
 color: var(--color-text-muted);
 font-size: 0.9rem;
 flex: 1;
}

.top-links {
 display: flex;
 gap: 1.5rem;
}

.top-links a {
 color: var(--color-text-muted);
 font-size: 0.9rem;
 font-weight: 500;
}

.top-links a:hover { color: var(--color-text); text-decoration: none; }

/* 5. Section tab bar — clean, no uppercase letterspace */
.tab-bar {
 background: var(--color-bg);
 border-bottom: 1px solid var(--color-border);
}

.tab-bar-inner {
 max-width: var(--max-width);
 margin: 0 auto;
 padding: 0 2rem;
 display: flex;
 gap: 2rem;
 height: 48px;
 align-items: center;
 overflow-x: auto;
}

.tab-bar-inner a {
 color: var(--color-text-muted);
 font-size: 0.95rem;
 font-weight: 500;
 padding: 0.25rem 0;
 border-bottom: 2px solid transparent;
 white-space: nowrap;
}

.tab-bar-inner a:hover {
 color: var(--color-text);
 text-decoration: none;
}

.tab-bar-inner a.active {
 color: var(--color-text);
 border-bottom-color: var(--color-text);
}

/* 6. Page Hero (section landing pages) — big & open */
.page-hero {
 max-width: var(--max-width);
 margin: 0 auto;
 padding: 4rem 2rem 2.5rem;
}

.page-hero h1 {
 font-size: 3.5rem;
 margin-bottom: 1rem;
 letter-spacing: -0.035em;
}

.page-hero p {
 font-size: 1.25rem;
 color: var(--color-text-muted);
 max-width: 720px;
 line-height: 1.5;
}

.page-content {
 max-width: var(--max-width);
 margin: 0 auto;
 padding: 0 2rem 4rem;
}

/* 7. Homepage — Hero */
.hero-section {
 max-width: var(--max-width);
 margin: 0 auto;
 padding: 3rem 2rem 1.5rem;
}

.hero-grid {
 display: grid;
 grid-template-columns: 2fr 1fr;
 gap: 4rem;
}

@media (max-width: 900px) {
 .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
}

.hero-featured h2 {
 font-size: 2.5rem;
 margin: 0.5rem 0 1.25rem;
 letter-spacing: -0.025em;
 line-height: 1.15;
}

.hero-featured h2 a { color: var(--color-text); }
.hero-featured h2 a:hover { color: var(--color-text-muted); text-decoration: none; }

.hero-featured p {
 color: var(--color-text-muted);
 margin-bottom: 1.25rem;
 font-size: 1.125rem;
 line-height: 1.5;
}

.hero-sidebar h3 {
 font-size: 0.75rem;
 text-transform: uppercase;
 letter-spacing: 0.1em;
 color: var(--color-text-faint);
 margin: 0.5rem 0 1.25rem;
 padding-bottom: 0.75rem;
 border-bottom: 1px solid var(--color-border);
 font-weight: 600;
}

.sidebar-article {
 padding: 1rem 0;
 border-bottom: 1px solid var(--color-border);
}

.sidebar-article:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-article:first-of-type { padding-top: 0; }

.sidebar-article .date-text {
 display: block;
 margin-bottom: 0.25rem;
}

.sidebar-article h4 {
 font-size: 1.05rem;
 margin: 0.25rem 0 0;
 font-weight: 600;
 line-height: 1.35;
}

.sidebar-article h4 a { color: var(--color-text); }
.sidebar-article h4 a:hover { color: var(--color-text-muted); text-decoration: none; }

/* 8. Date + category */
.date-text {
 font-size: 0.75rem;
 color: var(--color-text-faint);
 text-transform: uppercase;
 letter-spacing: 0.05em;
 font-weight: 600;
}

/* 9. Section headers */
.section-header {
 max-width: var(--max-width);
 margin: 0 auto;
 padding: 2.5rem 2rem 0.75rem;
 display: flex;
 align-items: baseline;
 justify-content: space-between;
}

.section-header h2 {
 font-size: 1.75rem;
 margin: 0;
 letter-spacing: -0.02em;
}

.explore-link {
 font-size: 0.95rem;
 color: var(--color-text-muted);
 font-weight: 500;
}

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

/* 10. Card grid — clean, no heavy shadows */
.card-grid {
 max-width: var(--max-width);
 margin: 1rem auto 0;
 padding: 0 2rem;
 display: grid;
 grid-template-columns: repeat(3, 1fr);
 gap: 2rem;
}

@media (max-width: 900px) {
 .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
 .card-grid { grid-template-columns: 1fr; }
}

.article-card {
 padding: 0.5rem 0;
 border: none;
 background: transparent;
 transition: opacity 0.15s;
}

.article-card:hover { opacity: 0.75; }

.article-card .date-text {
 display: block;
 margin-bottom: 0.5rem;
}

.article-card h3 {
 font-size: 1.25rem;
 margin: 0.5rem 0 0.75rem;
 letter-spacing: -0.015em;
 line-height: 1.3;
 font-weight: 600;
}

.article-card h3 a { color: var(--color-text); }
.article-card h3 a:hover { color: var(--color-text-muted); text-decoration: none; }

.article-card p {
 font-size: 0.95rem;
 color: var(--color-text-muted);
 margin: 0.5rem 0 0;
 line-height: 1.55;
}

/* 11. Article body */
.article-body {
 max-width: var(--content-width);
 margin: 0 auto;
 padding: 0 2rem 4rem;
 font-size: 1.0625rem;
 line-height: 1.7;
 color: #2a2a2a;
}

.article-body h2 {
 font-size: 1.875rem;
 margin: 2.5rem 0 0.75rem;
 letter-spacing: -0.02em;
}

.article-body h2:first-child,
.article-body h3:first-child {
 margin-top: 0;
}

.article-body h3 {
 font-size: 1.375rem;
 margin: 1.75rem 0 0.5rem;
}

.article-body p { margin-bottom: 1.25rem; }
.article-body ul, .article-body ol { margin: 0 0 1.5rem 1.5rem; }
.article-body li { margin-bottom: 0.5rem; }

.article-body strong { font-weight: 600; color: var(--color-text); }
.article-body em { font-style: italic; }

.accent-link {
 color: var(--color-text);
 font-weight: 500;
 text-decoration: underline;
 text-underline-offset: 2px;
}

/* 12. Share bar */
.share-bar {
 display: flex;
 align-items: center;
 gap: 10px;
 margin: 3rem 0 2rem;
 padding: 1.25rem 0;
 border-top: 1px solid var(--color-border);
 border-bottom: 1px solid var(--color-border);
}

.share-label {
 font-size: 0.7rem;
 font-weight: 600;
 letter-spacing: 0.1em;
 text-transform: uppercase;
 color: var(--color-text-faint);
 margin-right: 0.5rem;
}

.share-btn {
 display: inline-flex;
 align-items: center;
 gap: 5px;
 padding: 8px 14px;
 border-radius: var(--radius-sm);
 font-size: 0.8125rem;
 border: 1px solid var(--color-border-strong);
 background: transparent;
 cursor: pointer;
 font-family: inherit;
 color: var(--color-text);
 transition: background 0.15s, border-color 0.15s;
}

.share-btn:hover {
 background: var(--color-surface);
 border-color: var(--color-text-muted);
 text-decoration: none;
 color: var(--color-text);
}

/* 13. Disclaimer (in-article) */
.disclaimer {
 margin: 2.5rem 0;
 padding: 1.25rem 1.5rem;
 background: var(--color-surface);
 border-left: 3px solid var(--color-border-strong);
 border-radius: var(--radius-sm);
 font-size: 0.875rem;
 line-height: 1.65;
 color: var(--color-text-muted);
}

.disclaimer strong { color: var(--color-text); }

/* 14. Footer — minimal, clean */
.main-footer {
 background: var(--color-surface);
 color: var(--color-text-muted);
 padding: 4rem 2rem 2rem;
 margin-top: 4rem;
 border-top: 1px solid var(--color-border);
}

.footer-grid {
 max-width: var(--max-width);
 margin: 0 auto;
 display: grid;
 grid-template-columns: 2fr 1fr 1fr 1fr;
 gap: 3rem;
}

@media (max-width: 900px) {
 .footer-grid {
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
 }
}

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

.footer-brand h4 {
 color: var(--color-text);
 font-size: 1.15rem;
 margin-bottom: 0.75rem;
 font-weight: 600;
}

.footer-brand p {
 font-size: 0.9rem;
 line-height: 1.6;
 color: var(--color-text-muted);
 max-width: 380px;
}

.footer-nav h5 {
 color: var(--color-text);
 font-size: 0.875rem;
 margin-bottom: 1rem;
 font-weight: 600;
}

.footer-nav ul { list-style: none; }

.footer-nav li {
 margin-bottom: 0.5rem;
 font-size: 0.9rem;
}

.footer-nav a {
 color: var(--color-text-muted);
}

.footer-nav a:hover {
 color: var(--color-text);
 text-decoration: none;
}

.footer-bottom {
 max-width: var(--max-width);
 margin: 3rem auto 0;
 padding-top: 1.5rem;
 border-top: 1px solid var(--color-border);
 font-size: 0.8125rem;
 color: var(--color-text-faint);
 line-height: 1.5;
}

.footer-bottom p { margin-bottom: 0.5rem; }

/* 15. Resource card (section index) */
.resource-card {
 background: transparent;
 border: none;
 padding: 0.5rem 0;
}

.resource-card:hover { opacity: 0.75; }

/* 16. Statement-style blocks (legacy from trade-log era — kept slim for any reuse) */
.trade-statement {
 background: var(--color-surface);
 border: 1px solid var(--color-border);
 border-radius: var(--radius);
 padding: 1.5rem;
 margin: 1.5rem 0;
 font-family: var(--font-mono);
 font-size: 0.875rem;
}

.trade-statement .field {
 display: grid;
 grid-template-columns: 180px 1fr;
 gap: 0.5rem;
 margin-bottom: 0.25rem;
}

.trade-statement .field-label {
 color: var(--color-text-faint);
 font-family: var(--font-body);
 font-size: 0.75rem;
 text-transform: uppercase;
 letter-spacing: 0.05em;
 font-weight: 600;
}

.trade-statement .field-value { color: var(--color-text); }

.trade-statement .pnl-positive { color: #0a7c2f; font-weight: 600; }
.trade-statement .pnl-negative { color: #c41e3a; font-weight: 600; }

/* 17. Premium CTA banner */
.premium-cta {
 background: var(--color-text);
 color: #fff;
 padding: 3rem 2rem;
 border-radius: var(--radius);
 margin: 2rem 0;
 text-align: center;
}

.premium-cta h2 { color: #fff; margin-bottom: 0.75rem; }
.premium-cta p { color: rgba(255,255,255,0.85); margin-bottom: 1.5rem; max-width: 540px; margin-left: auto; margin-right: auto; }

.premium-cta .btn {
 display: inline-block;
 background: #fff;
 color: var(--color-text);
 padding: 0.75rem 1.5rem;
 border-radius: var(--radius-sm);
 font-weight: 600;
 text-decoration: none;
}

.premium-cta .btn:hover { background: #f0f0f0; text-decoration: none; color: var(--color-text); }

/* 18. Mobile nav (hamburger) */
.nav-toggle {
 display: none;
 background: transparent;
 border: none;
 font-size: 1.5rem;
 cursor: pointer;
 color: var(--color-text);
 padding: 0.25rem;
 line-height: 1;
}

@media (max-width: 720px) {
 .nav-toggle { display: block; }
 .top-bar .top-tagline { display: none; }
 .top-links { display: none; }
 .top-bar { gap: 1rem; padding: 0 1.5rem; height: 56px; }
 .tab-bar-inner { padding: 0 1.5rem; gap: 1.5rem; }
 .tab-bar-inner { display: none; }
 .tab-bar.open .tab-bar-inner { display: flex; flex-direction: column; height: auto; padding: 1rem 1.5rem; gap: 1rem; align-items: flex-start; }
 .tab-bar.open { border-bottom: 1px solid var(--color-border); }
 .hero-section, .hero-grid, .page-hero, .page-content, .card-grid, .section-header, .article-body, .main-footer {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
 }
 .hero-featured h2 { font-size: 2rem; }
 .page-hero h1 { font-size: 2.5rem; }
}