/* Calczy — Public Site Styles (v2 — polished, responsive, app-ready) */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #0984e3;
  --primary-dark: #0767b3;
  --primary-light: #74b9ff;
  --accent: #00b894;
  --text: #2d3436;
  --text-light: #636e72;
  --text-muted: #95a5a6;
  --bg: #ffffff;
  --bg-alt: #f5f6fa;
  --bg-card: #ffffff;
  --border: #dfe6e9;
  --border-light: #ecf0f1;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --header-h: 60px;
  --max-w: 1100px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============ Header (sticky) ============ */
.site-header {
  background: var(--text);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-container {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 20px;
  gap: 16px;
}
.logo {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.5px;
}
.logo:hover { opacity: 0.9; }

.main-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.main-nav a {
  color: #b2bec3;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,0.1); }

.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Currency selector */
.currency-selector-container { flex-shrink: 0; }
.currency-selector {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s;
}
.currency-selector:hover { background: rgba(255,255,255,0.22); }
.currency-selector:focus { outline: 2px solid var(--primary-light); }
.currency-selector option { background: var(--text); color: #fff; }

/* Hamburger button (mobile only) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
}
.menu-toggle:hover { background: rgba(255,255,255,0.1); }

/* ============ Container ============ */
.container { max-width: 820px; margin: 0 auto; padding: 24px 20px; }

/* ============ Hero ============ */
.hero {
  text-align: center;
  padding: 56px 20px 40px;
  background: linear-gradient(135deg, #0984e3 0%, #6c5ce7 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
  margin-bottom: 32px;
}
.hero h1 { font-size: 36px; margin-bottom: 12px; font-weight: 800; letter-spacing: -1px; }
.hero p { font-size: 17px; opacity: 0.92; max-width: 600px; margin: 0 auto 24px; }

/* Search bar */
.search-container { max-width: 500px; margin: 0 auto; position: relative; }
.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.search-input:focus { outline: 2px solid var(--primary-light); }
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
}
.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-top: 8px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  text-align: left;
}
.search-results.active { display: block; }
.search-result-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-alt); }
.search-result-title { font-weight: 600; font-size: 14px; }
.search-result-cat { font-size: 12px; color: var(--text-muted); }
.search-no-results { padding: 16px; color: var(--text-muted); text-align: center; font-size: 14px; }

/* ============ Category section ============ */
.category-section { margin-bottom: 36px; }
.category-section h2 { font-size: 22px; margin-bottom: 16px; font-weight: 700; }
.category-section h2 a { color: var(--text); text-decoration: none; }
.category-section h2 a:hover { color: var(--primary); }
.see-all-link { margin-top: 12px; font-size: 14px; }
.see-all-link a { color: var(--primary); text-decoration: none; font-weight: 600; }
.see-all-link a:hover { text-decoration: underline; }
.subcategory-section { margin-bottom: 40px; }
.subcategory-section h2 { font-size: 20px; margin-bottom: 14px; font-weight: 700; padding-bottom: 6px; border-bottom: 2px solid var(--border, #e0e0e0); }

/* ============ Tool grid ============ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.tool-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.tool-card-title { font-weight: 700; font-size: 15px; }
.tool-card-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }

/* ============ Breadcrumbs ============ */
.breadcrumbs {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text); font-weight: 500; }

/* ============ Tool page ============ */
h1 { font-size: 30px; margin-bottom: 12px; font-weight: 800; letter-spacing: -0.5px; }
.tool-intro { color: var(--text-light); margin-bottom: 24px; font-size: 15px; line-height: 1.7; overflow-x: auto; }
.tool-intro h2 { font-size: 1.3em; font-weight: 700; color: var(--text); margin: 1.5em 0 0.5em; }
.tool-intro h3 { font-size: 1.1em; font-weight: 600; color: var(--text); margin: 1.2em 0 0.4em; }
.tool-intro p { margin: 0.6em 0; }
.tool-intro ul, .tool-intro ol { margin: 0.6em 0; padding-left: 1.5em; }
.tool-intro li { margin: 0.3em 0; }
.tool-intro table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.92em; }
.tool-intro th, .tool-intro td { border: 1px solid #dfe6e9; padding: 10px 12px; text-align: left; }
.tool-intro th { background: #0984e3; color: #fff; font-weight: 700; }
.tool-intro tr:nth-child(even) { background: #f8f9fa; }
.tool-intro tr:hover { background: #f1f2f6; }
.tool-intro strong { color: var(--text); }
.tool-intro code { background: #f1f2f6; padding: 2px 5px; border-radius: 3px; font-size: 0.9em; }
.tool-intro blockquote { border-left: 3px solid var(--accent); padding-left: 12px; margin: 1em 0; color: var(--text-light); }
.tool-widget {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

/* ============ Content sections ============ */
.content-section {
  margin-bottom: 28px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.content-section h2 { font-size: 20px; margin-bottom: 14px; font-weight: 700; }
.how-to-list { padding-left: 20px; }
.how-to-list li { margin-bottom: 8px; line-height: 1.6; }

/* ============ FAQ ============ */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  background: var(--bg-card);
  transition: border-color 0.15s;
}
.faq-item:hover { border-color: var(--primary-light); }
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px;
  color: var(--primary);
  font-weight: 300;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: 10px; color: var(--text-light); font-size: 14px; line-height: 1.6; }

/* ============ Related tools ============ */
.related-tools { margin-top: 32px; }
.related-tools h2 { font-size: 18px; margin-bottom: 14px; font-weight: 700; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.related-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.related-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--primary-light); }
.related-title { font-weight: 600; font-size: 14px; }
.related-category { font-size: 12px; color: var(--text-muted); }

/* ============ Ad slot ============ */
.ad-slot { min-height: 90px; margin: 24px 0; }

/* ============ Footer ============ */
.site-footer { background: var(--text); color: #b2bec3; margin-top: 48px; }
.footer-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 36px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}
.footer-section h3 { color: #fff; font-size: 14px; margin-bottom: 10px; font-weight: 700; }
.footer-section ul { list-style: none; }
.footer-section li { margin-bottom: 6px; }
.footer-section a { color: #b2bec3; text-decoration: none; font-size: 13px; }
.footer-section a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #444; padding: 16px 20px; text-align: center; font-size: 13px; }

/* ============ Calculator widget ============ */
.calc-form { display: grid; gap: 16px; }
.calc-field { display: flex; flex-direction: column; gap: 6px; }
.calc-field label { font-size: 14px; font-weight: 600; color: var(--text); }
.calc-field input, .calc-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.calc-field input:focus, .calc-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(9,132,227,0.12);
}
.calc-button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: 48px;
}
.calc-button:hover { background: var(--primary-dark); }
.calc-button:active { transform: scale(0.98); }

/* Calculator results */
.calc-results {
  margin-top: 20px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.calc-result-row:last-child { border-bottom: none; }
.calc-result-label { color: var(--text-light); font-size: 14px; }
.calc-result-value { font-weight: 700; font-size: 18px; }
.calc-result-highlight { color: var(--primary); font-size: 22px; }

/* ============ Category description ============ */
.category-desc { color: var(--text-light); margin-bottom: 24px; font-size: 15px; }

/* ============ Responsive — Tablet (<= 1024px) ============ */
@media (max-width: 1024px) {
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .footer-container { grid-template-columns: 1fr 1fr; }
  .footer-section:first-child { grid-column: 1 / -1; }
}

/* ============ Responsive — Mobile (<= 768px) ============ */
@media (max-width: 768px) {
  :root { --header-h: 56px; }

  .header-container { padding: 0 16px; gap: 8px; }
  .menu-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--text);
    flex-direction: column;
    padding: 8px;
    gap: 2px;
    box-shadow: var(--shadow-lg);
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .main-nav.open { display: flex; }
  .main-nav a {
    padding: 14px 16px;
    font-size: 15px;
    border-radius: var(--radius-sm);
  }
  .header-right { gap: 6px; }

  .hero { padding: 40px 16px 32px; border-radius: 0 0 16px 16px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }

  .container { padding: 20px 16px; }

  h1 { font-size: 24px; }
  .tool-intro { font-size: 14px; }

  .tool-widget { padding: 20px 16px; }
  .content-section { padding: 18px 16px; }

  .tool-grid { grid-template-columns: 1fr; gap: 12px; }
  .tool-card { padding: 16px; }

  .related-grid { grid-template-columns: 1fr; }

  .footer-container { grid-template-columns: 1fr; gap: 20px; padding: 28px 16px; }

  .calc-field input, .calc-field select { font-size: 16px; padding: 12px 14px; }
  .calc-button { width: 100%; }
  .calc-result-value { font-size: 16px; }
  .calc-result-highlight { font-size: 20px; }
}

/* ============ Responsive — Small mobile (<= 380px) ============ */
@media (max-width: 380px) {
  .hero h1 { font-size: 22px; }
  .search-input { font-size: 14px; padding: 12px 16px 12px 44px; }
  .currency-selector { font-size: 12px; padding: 6px 8px; }
}

/* ============ Safe area (notch / app) ============ */
@supports (padding: env(safe-area-inset-top)) {
  .site-header { padding-top: env(safe-area-inset-top); }
  .site-footer { padding-bottom: env(safe-area-inset-bottom); }
  .footer-bottom { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ============ Cookie Consent Banner ============ */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #2d3436;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 9999;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
}
.cookie-consent p {
  font-size: 14px;
  line-height: 1.5;
}
.cookie-consent a {
  color: #74b9ff;
  text-decoration: underline;
}
.cookie-btn {
  background: #0984e3;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cookie-btn:hover {
  background: #0767b3;
}
@media (max-width: 600px) {
  .cookie-consent {
    flex-direction: column;
    text-align: center;
    padding: 12px 16px;
  }
  .cookie-btn {
    width: 100%;
  }
}

/* ============ Formula & Example blocks (HCU) ============ */
.formula-block {
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 16px 20px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre;
  color: #24292e;
  margin: 0;
  text-align: left;
  tab-size: 2;
}
.tool-example {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}

/* Mobile adjustments for formula & example */
@media (max-width: 768px) {
  .formula-block { font-size: 13px; padding: 12px 14px; line-height: 1.7; }
  .tool-example { font-size: 14px; line-height: 1.6; }
}
@media (max-width: 380px) {
  .formula-block { font-size: 12px; padding: 10px 12px; }
  .tool-example { font-size: 13px; }
}

/* ============ Conversion Table (SEO content) ============ */
.table-intro { font-size: 14px; color: #586069; margin-bottom: 12px; }
.deep-content { font-size: 15px; line-height: 1.7; color: #24292e; }
.conversion-table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; border: 1px solid #e1e4e8; border-radius: 6px; }
.conversion-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.conversion-table thead { position: sticky; top: 0; background: #f6f8fa; }
.conversion-table th { padding: 8px 12px; text-align: left; font-weight: 600; border-bottom: 1px solid #e1e4e8; }
.conversion-table td { padding: 6px 12px; border-bottom: 1px solid #f0f0f0; }
.conversion-table tbody tr:nth-child(even) { background: #fafbfc; }
.conversion-table tbody tr:hover { background: #f0f4f8; }
@media (max-width: 768px) {
  .conversion-table { font-size: 13px; }
  .conversion-table th { padding: 6px 10px; }
  .conversion-table td { padding: 5px 10px; }
}

/* ============ Share + Cite buttons ============ */
.tool-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.action-btn { padding: 6px 14px; font-size: 13px; border: 1px solid #d1d5da; border-radius: 4px; background: #f6f8fa; cursor: pointer; color: #24292e; min-height: 32px; }
.action-btn:hover { background: #e1e4e8; }
.cite-box { background: #f6f8fa; border: 1px solid #e1e4e8; border-radius: 6px; padding: 12px 16px; margin: 8px 0 16px; }
.cite-label { font-weight: 600; font-size: 13px; margin: 8px 0 2px; }
.cite-text { font-size: 13px; color: #586069; margin: 0 0 8px; word-break: break-all; }

/* ============ E-E-A-T byline ============ */
.eeat-byline { margin: 24px 0 16px; padding: 14px 16px; background: #f6f8fa; border: 1px solid #e1e4e8; border-radius: 6px; }
.byline-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.byline-item { font-size: 13px; color: #24292e; }
.byline-note { font-size: 13px; color: #586069; margin: 8px 0 0; line-height: 1.5; }
.byline-note a { color: #0366d6; text-decoration: none; }
.byline-note a:hover { text-decoration: underline; }
@media (max-width: 768px) {
  .byline-row { flex-direction: column; gap: 4px; }
}
