/*============================
  CSS VARIABLES (MATERIAL DESIGN PALETTE)
============================*/
:root {
  /* Material Design Blue Theme */
  --color-primary:   #1976d2;    /* Blue 700 */
  --color-secondary: #2196f3;    /* Blue 500 */
  --color-accent:    #ff5722;    /* Deep Orange 500 */

  /* Backgrounds & surfaces */
  --color-bg:        #e3f2fd;    /* Blue 50 */
  --color-surface:   #ffffff;    /* White */

  /* Text & borders */
  --color-text:      #212121;    /* Grey 900 */
  --color-border:    #bbdefb;    /* Blue 200 */
  --color-muted:     #757575;    /* Grey 600 */

  /* Utility neutrals */
  --color-hr:        #e0e0e0;    /* Grey 300 */
}

/*============================
  1. RESET
============================*/
html, body,
h1,h2,h3,h4,h5,h6,
p,blockquote,dl,dt,dd,
figure,fieldset,legend,
ul,ol,li,
table,thead,tbody,tfoot,tr,th,td,
button,input,select,textarea,
iframe,hr {
  margin: 0;
  padding: 0;
}
html, body { overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img, table, code, .section, .wrapper { max-width: 100%; }
pre, code { white-space: pre-wrap; word-wrap: break-word; }
    
body {
  background: #e3f2fd;
  color: #212121;
}
img, video, embed, object {
  max-width: 100%;
  height: auto;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--color-hr);
  height: 1px;
  margin: 1em 0;
}

/*============================
  2. BASE
============================*/
html {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 1.1em;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-bg);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

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

a {
  text-decoration: none;
  color: inherit;
}

/*============================
  3. TYPOGRAPHY
============================*/
h1, h2, h3, h4 {
  font-family: 'Roboto', Arial, sans-serif;
  font-weight: 500;
  color: var(--color-primary);
  line-height: 1.7;
  margin: 0.5em 0;
}

h1 {
  font-size: 1.5em;
  color: #424242; /* Grey 800 */
  margin: 0.1em 0.5em 0 0;
}
h2 { font-size: 1.4em; }
h3 {
  font-size: 1.1em;
  margin-top: 0.5em;
}

p { margin: 0.5em 0; }

ul, ol {
  list-style: none;
  margin-bottom: 0.5em;
}

li {
  position: relative;
  padding-left: 1.5em;
  margin: 0.3em 0;
  font-size: 0.97em;
}
li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

small, sup, sub {
  font-size: 0.8em;
}

code, pre {
  font-family: 'Roboto Mono', monospace;
  font-size: 1.1em;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/*============================
  4. LAYOUT
============================*/
.wrapper {
  max-width: 769px;
  margin: 0 auto 120px;
  background: var(--color-surface);
}

.header-container,
.footer-container,
.main aside {
  background: var(--color-primary);
  color: var(--color-surface);
}

.header-container {
  height: 35px;
  padding-left: 8px;
}

.footer-container {
  padding: 1%;
}

.section {
  clear: both;
  padding: 0 5px;
}

.group::after {
  content: "";
  display: table;
  clear: both;
}

.col {
  float: left;
  margin: 0 1.6% 1% 0;
}
.col:first-child {
  margin-left: 0;
}

.span_1_of_2 { width: 48.3%; }
.span_2_of_2 { width: 100%; }
.span_1_of_3 { width: 31.6%; }
.span_3_of_3 { width: 100%; }

/*============================
  5. COMPONENTS
============================*/
/* Calculator */
.calculator {
  background-color: #f3f9ff;    /* Blue 25 */
  padding: 0 0.5em;
  border: 1px solid #90caf9;    /* Blue 300 */
  border-radius: 3px;
  border-top-left-radius: 0;
  margin: 1em 0;
}
.calculator table {
  width: 100%;
  border-spacing: 0 3px;
  border-collapse: separate;
}
.calculator small {
  line-height: 1em;
}
.calculator input:disabled,
.calculator textarea:disabled {
  box-shadow: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
}

/* Calculator Tabs */
.calculator-tabbed {
  margin: 1.5em 0 0;
}
.calculator-tab button {
  font-size: 1em;
  background-color: var(--color-primary);
  color: var(--color-surface);
  border: none;
  cursor: pointer;
  padding: 0.5em 1em;
  border-top-left-radius: 10px;
  border-top-right-radius: 3px;
  transition: background 0.3s;
}
.calculator-tab button.active {
  background-color: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid #90caf9;
  border-bottom: none;
}

/* Form Controls */
button, input, select, textarea {
  font-size: 1.2em;
  line-height: 1.4;
  padding: 0.2em;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-surface);
  color: var(--color-text);
  margin-bottom: 1em;
}
button {
  margin: 1em 0 0;
}
input, select {
  width: 100%;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Tables */
table.lin1 {
  width: 100%;
  margin-bottom: 1em;
}
table.lin1 th {
  font-weight: 700;
  padding: 0.2em;
}
table.lin1 td, table.lin1 th {
  padding: 3px;
  font-size: 0.9em;
  height: 1.8em;
}
table.lin1 tr:nth-child(even) {
  background: var(--color-surface);
  color: #1565c0;           /* Blue 800 */
}
table.lin1 tr:nth-child(odd) {
  background: #f3f9ff;     /* Light Green 50 */
  color: var(--color-accent);
}

/* Definition & Formula Boxes */
.definition-box,
.formula-box,
.solution {
  border-radius: 4px;
  padding: 12px 15px;
  margin: 1em 0;
}
.definition-box {
  background: #fafafa;      /* Grey 50 */
  border-left: 4px solid var(--color-primary);
}
.formula-box {
  background: #e3f2fd;     /* Blue 50 */
  border-left: 4px solid #2196f3;    /* Blue 500 */
  font-family: 'Roboto Mono', monospace;
  font-size: 1.1em;
}
.example-box .solution code {
  background: #f3f9ff;     /* Blue 25 */
  border-left: 3px solid #2196f3;    /* Blue 500 */
  padding: 8px 12px;
  color: var(--color-accent);
}

/* FAQ */
.faq-list {
  margin: 1em 0;
}
.faq-item + .faq-item {
  margin-top: 1em;
}

/* Interactive Chart */
#kmSlider {
  width: 100%;
  margin: 0.5em 0 1em;
}

/*============================
  6. UTILITIES
============================*/
.centered {
  text-align: center;
  overflow-x: auto;
}
.centered::-webkit-scrollbar {
  display: none;
}

.bold     { font-weight: bolder; }
.big      { font-size: 1.3em; }
.destacado{ color: var(--color-accent); }
.tld      { color: #ffc107; }    /* Amber 500 */

.switch {
  margin: -0.2em 0.1em 1.2em 0.1em;
  cursor: pointer;
  font-size: large;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

    /* Table of Contents */
.toc {
  position: sticky;
  top: 0;
  padding: 10px;
  z-index: 100;
  font-size: 0.9em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
}

.toc strong {
  margin-right: 0.5em;
}

.toc a {
  color: #1976d2;          /* Blue 700 */
  transition: color 0.2s;
}

/* Separators */
.toc a:not(:last-child)::after {
  content: "|";
  margin: 0 0.5em;
  color: #9e9e9e;          /* Grey 500 */
}

/* Mobile friendly: collapse into a column on very small screens */
@media (max-width: 480px) {
  .toc {
    flex-direction: column;
    gap: 0.25em;
  }
  .toc a:not(:last-child)::after {
    content: "";
    margin: 0;
  }
}

/*============================
  7. RESPONSIVE
============================*/
@media (max-width: 768px) {
  .formula-box,
  .solution {
    padding: 10px;
  }
  .example-box h4 {
    font-size: 1em;
  }
}

@media (max-width: 480px) {
  .col,
  .span_1_of_2,
  .span_2_of_2,
  .span_1_of_3 {
    width: 100% !important;
    margin: 1% 0;
  }
}

@media (max-width: 360px) {
  .title-image-container {
    height: 70px;
  }
}

/* Header + Logo */
.site-header {
  display: flex;
  align-items: center;
  height: 100%;
}

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

.site-logo {
  height: 30px;
  width: auto;
  margin: 0 10px 0 -5px;
}

.title {
  color: #fff;             /* keep your existing title color */
  font-size: 1.2em;        /* adjust as needed */
  line-height: 30px;       /* vertically center text in the header */
}

.tld {
  color: #ffc107;          /* Amber 500 */
}
    
/*============================
  1. AD UNITS RESET
============================*/
ins {
  text-align: center !important;
}

/*============================
  2. SIDE BARS
============================*/
/* hidden by default */
#left-bar,
#right-bar {
  position: absolute;
  top: 60px;
  display: none;
  visibility: hidden;
  padding: 0;
}

/* show at ≥1270px */
@media (min-width: 1270px) {
  #left-bar,
  #right-bar {
    display: block;
    visibility: visible;
  }
}

/* 1270–1299px: narrow ads */
@media (min-width: 1270px) and (max-width: 1299px) {
  #left-bar {
    left: 50%;
    transform: translateX(-255px);
    min-width: 250px;
  }
  #right-bar {
    left: 50%;
    transform: translateX(773px);
    min-width: 250px;
  }
}

/* ≥1300px: wide ads */
@media (min-width: 1300px) {
  #left-bar {
    left: 50%;
    transform: translateX(-350px);
    min-width: 336px;
  }
  #right-bar {
    left: 50%;
    transform: translateX(786px);
    min-width: 336px;
  }
}

/*============================
  3. AD BLOCKS
============================*/
/* common ad styling */
#ad-1, #ad-2, #ad-3 {
  width: 100%;
  min-width: 250px;
  aspect-ratio: 1 / 1;       /* keep square */
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px auto;
  text-align: center !important;
}

/* slight margin tweak for #ad-2 */
#ad-2 { margin-top: 20px; }

/* hide #ad-1 on desktops */
@media (min-width: 700px) {
  #ad-1 {
    display: none;
  }
}