@charset "utf-8";

/* ==========================================
   Modern CSS Reset & Theme Variables
   ========================================== */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-focus: rgba(37, 99, 235, 0.15);
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-navigator: #ffffff;
  --bg-header: #1e3a8a;
  --bg-footer: #0f172a;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-white: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --input-bg: #ffffff;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --card-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-focus: rgba(96, 165, 250, 0.2);
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-navigator: #1e293b;
    --bg-header: #1e3a8a;
    --bg-footer: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --border-focus: #60a5fa;
    --input-bg: #0f172a;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.2);
    --card-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  }
}

/* ==========================================
   Global Elements
   ========================================== */
body {
  margin: 0;
  padding: 0;
  color: var(--text-main);
  background-color: var(--bg-page);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul, ol, dl {
  padding: 0;
  margin: 0;
}

h1, h2, h3, h4, h5, h6, p {
  margin-top: 0;
  margin-bottom: 12px;
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

h2 {
  clear: both;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 28px;
  margin-bottom: 16px;
  position: relative;
  padding-left: 12px;
}
h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}
a img {
  border: none;
}

/* ==========================================
   Layout Containers & Grid
   ========================================== */
#main {
  margin: 0 auto;
  max-width: 1200px;
  box-sizing: border-box;
  padding: 0 16px;
}

.container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 20px 0;
  box-shadow: var(--card-shadow);
  box-sizing: border-box;
}

.column {
  width: 50%;
  float: left;
  box-sizing: border-box;
}

/* Clearfix */
.clear {
  clear: both;
}

/* ==========================================
   Header & Navigator
   ========================================== */
#header {
  height: auto;
  min-height: 60px;
  background-color: var(--bg-header);
  background-image: linear-gradient(135deg, #1e3a8a, #3b82f6);
  padding: 16px 24px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--text-white);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
#header a {
  color: var(--text-white);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
}
#header a:hover {
  text-decoration: none;
  opacity: 0.9;
}

.navigator {
  background-color: var(--bg-navigator);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  margin: 12px 0;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
}
.navigator .fltlft {
  flex-grow: 1;
}
.navigator .fltrt {
  margin-left: 20px;
}
.navigator .clear {
  display: none;
}
.navigator p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.navigator a {
  font-weight: 500;
}

/* ==========================================
   Interface & Calculator Widgets
   ========================================== */
/* Three box layout on calculator pages: Image (topleftbox), Inputs (interface), Outputs (topbox) */
.topleftbox, .interface, .topbox {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--card-shadow);
  box-sizing: border-box;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Fix width & float layouts for Desktop */
@media only screen and (min-width: 1100px) {
  .topleftbox {
    width: 31%;
    float: left;
    margin-right: 2%;
  }
  .interface {
    width: 32%;
    float: left;
    margin-right: 2%;
  }
  .topbox {
    width: 33%;
    float: left;
  }

  /* Height Helper Classes */
  .height-193 {
    height: 300px;
  }
  .height-260 {
    height: 360px;
  }
  .height-310 {
    height: 410px;
  }
  .height-320 {
    height: 420px;
  }
  .height-450 {
    height: 500px;
  }
  .height-520 {
    height: 580px;
  }
}

.topleftbox img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  align-self: center;
  margin: auto 0;
}

/* Form Styling */
form p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 500;
  font-size: 0.95rem;
}

form input[type="text"], form textarea {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  width: 100%;
  flex-grow: 1;
}
form input[type="text"]:focus, form textarea:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-focus);
}

form select {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
}
form select:focus {
  border-color: var(--border-focus);
  outline: none;
}
form select.narrow {
  width: auto;
  min-width: 80px;
}

/* Calculator button */
#calculate, input[type="submit"] {
  background-color: var(--primary-color);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
#calculate:hover, input[type="submit"]:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}
#calculate:active, input[type="submit"]:active {
  transform: translateY(0);
}

/* Output Display Styling */
.large-font {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 10px;
}
.medium-font {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}
.small-font {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.red-font {
  color: #ef4444;
  font-weight: 600;
}

/* ==========================================
   Graphs
   ========================================== */
.graph {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.graph:hover {
  box-shadow: var(--card-shadow-hover);
}
.graph canvas {
  background-color: #ffffff; /* keep canvas graph background white for visibility */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-width: 100%;
  height: auto;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}
.graph p {
  margin-top: 10px;
  margin-bottom: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
}

@media only screen and (min-width: 1100px) {
  .graph {
    width: 48%;
    float: left;
    margin-right: 2%;
    box-sizing: border-box;
  }
  .graph:last-of-type {
    margin-right: 0;
  }
}

/* ==========================================
   Home Menu Calculator Lists
   ========================================== */
.inside-box {
  margin: 10px 0;
}

.half-box {
  width: 50%;
  float: left;
  padding: 10px;
  box-sizing: border-box;
}
.half-box a {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
  height: 100%;
  justify-content: center;
  gap: 12px;
}
.half-box a:hover {
  text-decoration: none;
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  color: var(--primary-color);
}
.half-box img {
  width: 100%;
  max-width: 160px;
  height: auto;
  border-radius: var(--radius-sm);
}

@media only screen and (min-width: 1100px) {
  .column {
    width: 50%;
    float: left;
    padding: 0 10px;
  }
}

/* ==========================================
   Table & Lists Styling
   ========================================== */
table#t01 {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
}
table#t01 th {
  color: var(--text-white);
  background-color: var(--primary-color);
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border: none;
}
table#t01 td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}
table#t01 tr:last-child td {
  border-bottom: none;
}
table#t01 tr:nth-child(even) {
  background-color: var(--bg-page);
}
table#t01 tr:nth-child(odd) {
  background-color: var(--bg-card);
}

/* ==========================================
   Footer
   ========================================== */
.footer {
  background-color: var(--bg-footer);
  color: #94a3b8;
  padding: 24px 32px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-top: 30px;
  font-size: 0.9rem;
}
.footer p {
  margin: 0;
}
.footer a {
  color: #cbd5e1;
  text-decoration: underline;
}
.footer a:hover {
  color: var(--text-white);
}

/* ==========================================
   Mobile & Responsive Adjustments
   ========================================== */
@media only screen and (max-width: 1099px) {
  #header {
    border-radius: 0;
  }
  .column {
    width: 100%;
    float: none;
    padding: 0;
  }
  .topleftbox, .interface, .topbox {
    width: 100%;
    float: none;
    margin-right: 0;
    height: auto;
  }
  .half-box {
    width: 50%;
  }
}

@media only screen and (max-width: 500px) {
  .navigator {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .navigator .fltrt {
    float: none;
    align-self: flex-end;
    margin-left: 0;
  }
  .half-box {
    width: 100%;
  }
}

/* ==========================================
   Equation Display Formatting
   ========================================== */
.equations-block {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}
.equation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.eq-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 180px;
}
.eq-formula {
  display: inline-flex;
  align-items: center;
  font-weight: 550;
  color: var(--text-main);
}
.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  padding: 0 6px;
  font-size: 0.95rem;
}
.numerator {
  border-bottom: 1.5px solid var(--text-main);
  padding-bottom: 2px;
  text-align: center;
  width: 100%;
}
.denominator {
  padding-top: 2px;
  text-align: center;
  width: 100%;
}
.eq-legend {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 12px;
}

/* ==========================================
   Modern Stacked Form Elements
   ========================================== */
.form-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 14px;
}
.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}
.input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.input-container input[type="text"] {
  width: 100%;
  flex-grow: 1;
}
.input-container select {
  width: 100%;
}
.input-container .unit {
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ==========================================
   Radio Layout Fix for Legacy Forms
   ========================================== */
form p:has(input[type="radio"]) {
  display: block;
  line-height: 1.8;
}
form p:has(input[type="radio"]) input[type="text"] {
  width: auto;
  max-width: 120px;
  display: inline-block;
  margin: 0 6px;
  vertical-align: middle;
}
form p:has(input[type="radio"]) select {
  width: auto;
  display: inline-block;
  margin: 0 6px;
  vertical-align: middle;
}
form p:has(input[type="radio"]) input[type="radio"] {
  margin-right: 4px;
  vertical-align: middle;
}

/* ==========================================
   Era Grid Layout
   ========================================== */
.era-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 24px;
}
.era-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}
.era-item:hover {
  border-color: var(--primary-color);
  background-color: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.era-item span:first-child {
  font-weight: 600;
  color: var(--primary-color);
}
.era-item span:last-child {
  color: var(--text-muted);
}

/* ==========================================
   Table Form Layout Fix for Interface Cards
   ========================================== */
.interface table {
  width: 100% !important;
  border-collapse: collapse;
}
.interface td {
  padding: 6px 0;
  vertical-align: middle;
  white-space: nowrap;
}
.interface td input[type="text"] {
  width: 80px !important;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
