/* ============================================================
   MyCalcApp - Global Stylesheet
   ============================================================ */

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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --bg: #ffffff;
  --bg-muted: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --dark-bg: #020617;
  --dark-border: #1e293b;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --max-w: 1200px;
}

html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* ---- Layout ---- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }

/* ---- Header ---- */
header.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; }
nav.main-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav.main-nav a { padding: .4rem .75rem; border-radius: .5rem; font-size: .875rem; font-weight: 500; color: var(--text-muted); text-decoration: none; transition: all .15s; }
nav.main-nav a:hover, nav.main-nav a.active { color: var(--primary); background: var(--primary-light); }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: .5rem; color: var(--text-muted); font-size: 1.5rem; }
.mobile-nav { display: none; border-top: 1px solid var(--border); background: #fff; padding: 1rem 1.5rem; flex-direction: column; gap: .5rem; }
.mobile-nav a { padding: .75rem 1rem; border-radius: .5rem; font-weight: 500; color: var(--text-muted); text-decoration: none; display: block; }
.mobile-nav a:hover { color: var(--primary); background: var(--primary-light); }
.mobile-nav.open { display: flex; }

/* ---- Hero ---- */
.hero { background: var(--dark-bg); color: #fff; padding: 6rem 0; text-align: center; position: relative; overflow: hidden; border-bottom: 1px solid var(--dark-border); }
.hero-badge { display: inline-flex; align-items: center; gap: .5rem; background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; padding: .4rem 1rem; border-radius: 999px; font-size: .875rem; font-weight: 500; margin-bottom: 1.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 1.25rem; line-height: 1.15; }
.hero p { font-size: 1.2rem; color: #cbd5e1; max-width: 600px; margin: 0 auto 2rem; line-height: 1.7; }
.hero-glow { position: absolute; top: -100px; right: -200px; width: 600px; height: 600px; background: radial-gradient(circle, rgba(99,102,241,.2) 0%, transparent 70%); pointer-events: none; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .75rem 1.75rem; border-radius: var(--radius); font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; border: none; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25); }
.btn-outline:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-white { background: #fff; color: var(--primary); }
.btn-white:hover { background: #f1f5f9; color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-group { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; box-shadow: var(--shadow); transition: all .25s; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: rgba(99,102,241,.3); }
.card-icon { width: 48px; height: 48px; background: var(--primary-light); border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 1rem; transition: all .25s; }
.card:hover .card-icon { background: var(--primary); }
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.card p { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }
a.card-link { text-decoration: none; color: inherit; display: block; }

/* ---- Grid ---- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
@media (max-width: 1024px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* ---- Section Headings ---- */
.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: .75rem; }
.section-title p { color: var(--text-muted); font-size: 1.1rem; max-width: 550px; margin: 0 auto; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; color: var(--text); }
input, select, textarea { width: 100%; padding: .65rem .875rem; border: 1px solid var(--border); border-radius: .5rem; font-size: 1rem; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.input-lg { padding: 1rem 1rem; font-size: 1.3rem; font-weight: 600; }
textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* ---- Calculator Layout ---- */
.calc-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 3rem; }
@media (max-width: 768px) { .calc-layout { grid-template-columns: 1fr; } }
.calc-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); }
.calc-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.5rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.result-box { background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.result-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.result-value { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.result-sub { font-size: .85rem; color: var(--text-muted); margin-top: .15rem; }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .results-grid { grid-template-columns: 1fr; } }
.swap-icon { display: flex; justify-content: center; margin: 1rem 0; }
.swap-icon div { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--primary); }

/* ---- Page Hero (inner pages) ---- */
.page-hero { background: var(--bg-muted); border-bottom: 1px solid var(--border); padding: 3.5rem 0; }
.page-hero h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: .75rem; }
.page-hero p { color: var(--text-muted); font-size: 1.1rem; max-width: 620px; line-height: 1.7; }

/* ---- Breadcrumb ---- */
.breadcrumb { display: flex; gap: .5rem; align-items: center; font-size: .875rem; color: var(--text-muted); margin-bottom: 1.5rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-muted); }

/* ---- Prose (article content) ---- */
.prose { max-width: 740px; line-height: 1.8; }
.prose h2 { font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; letter-spacing: -.01em; }
.prose h3 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 .75rem; }
.prose p { margin-bottom: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.prose li { margin-bottom: .5rem; }
.prose strong { font-weight: 700; }
.prose a { color: var(--primary); }
.prose code { background: var(--bg-muted); padding: .15rem .4rem; border-radius: .25rem; font-size: .875em; }
.prose .formula-box { background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0; font-family: monospace; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose .cta-box { background: var(--primary-light); border: 1px solid rgba(99,102,241,.2); border-radius: var(--radius-lg); padding: 2rem; text-align: center; margin: 2.5rem 0; }
.prose .cta-box h3 { margin: 0 0 .75rem; font-size: 1.3rem; }
.prose .cta-box p { color: var(--text-muted); margin-bottom: 1.25rem; }

/* ---- FAQ ---- */
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.faq-item h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .75rem; }
.faq-item p { color: var(--text-muted); line-height: 1.7; }

/* ---- CTA Section ---- */
.cta-section { background: var(--primary); color: #fff; padding: 5rem 0; text-align: center; }
.cta-section h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; margin-bottom: 1rem; letter-spacing: -.02em; }
.cta-section p { font-size: 1.15rem; color: rgba(255,255,255,.85); max-width: 540px; margin: 0 auto 2rem; }

/* ---- Footer ---- */
footer.site-footer { background: var(--dark-bg); color: #94a3b8; border-top: 1px solid var(--dark-border); }
.footer-inner { padding: 4rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem; margin-bottom: 3rem; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand .logo { color: #fff; margin-bottom: .75rem; }
.footer-brand p { font-size: .875rem; line-height: 1.7; max-width: 260px; }
.footer-col h4 { color: #fff; font-size: .875rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 1rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: .6rem; }
.footer-col ul li a { color: #94a3b8; text-decoration: none; font-size: .875rem; transition: color .15s; }
.footer-col ul li a:hover { color: #a5b4fc; }
.footer-contact { font-size: .875rem; margin-top: .75rem; }
.footer-contact strong { color: #fff; display: block; margin-bottom: .25rem; }
.footer-contact a { color: var(--primary); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--dark-border); padding-top: 1.5rem; font-size: .8rem; color: #64748b; }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.tag { display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.tag-primary { background: var(--primary-light); color: var(--primary); }
.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-muted); text-decoration: none; font-size: .875rem; font-weight: 500; margin-bottom: 1.5rem; transition: color .15s; }
.back-link:hover { color: var(--primary); }
.disclaimer { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 1rem 1.25rem; font-size: .875rem; color: #92400e; margin-top: 1.5rem; }
.related-section { background: var(--bg-muted); border-top: 1px solid var(--border); padding: 3rem 0; }
.content-wrap { max-width: 900px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.article-wrap { max-width: 760px; margin: 0 auto; padding: 3rem 1.5rem; }

/* ---- Blog/Guide cards ---- */
.article-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); transition: all .25s; }
.article-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.article-card-body { padding: 1.5rem; }
.article-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; line-height: 1.4; }
.article-card p { color: var(--text-muted); font-size: .9rem; line-height: 1.6; margin-bottom: .75rem; }
.article-card a.read-more { font-size: .875rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.article-meta { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }

/* ---- Contact ---- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 768px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---- Basic calculator buttons ---- */
.calc-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: 1rem; }
.calc-btn { padding: 1rem; border: 1px solid var(--border); border-radius: .5rem; font-size: 1.1rem; font-weight: 600; background: var(--bg-muted); cursor: pointer; transition: all .15s; color: var(--text); }
.calc-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.calc-btn.op { background: var(--primary-light); color: var(--primary); }
.calc-btn.op:hover { background: var(--primary); color: #fff; }
.calc-btn.eq { background: var(--primary); color: #fff; grid-column: span 2; }
.calc-btn.eq:hover { background: var(--primary-dark); }
.calc-btn.wide { grid-column: span 2; }
.calc-display { background: var(--dark-bg); color: #fff; padding: 1.25rem 1rem; border-radius: .5rem; font-size: 2rem; font-weight: 700; text-align: right; margin-bottom: 1rem; min-height: 4rem; word-break: break-all; font-family: monospace; }

/* ---- Responsive ---- */
@media (max-width: 1024px) { nav.main-nav { display: none; } .hamburger { display: block; } }
@media (max-width: 640px) { .section { padding: 3rem 0; } .hero { padding: 4rem 0; } .calc-buttons { gap: .35rem; } .calc-btn { padding: .75rem .5rem; font-size: 1rem; } }
