/* =========================
   ROOT VARIABLES (MAPPED)
   ========================= */

:root {
    --orange: #F27B22; 
    --orange_yellow: #F8951D; 
    --yellow: #F5BC04; 
    --dark: #040404;
    --mid: #67686A;
    --light_mid: #c8c9ca;
    --light: #FFFFFF;
    --sucess: #1a7f37;

  /* legacy variable mapping */
  --border: var(--mid);
  --muted: #6b6b6b;
  --bg: linear-gradient(135deg, var(--dark), var(--mid));
  --soft: var(--light);
}

/* =========================
   BASE / RESET
   ========================= */

html {
    background-color: black;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100vh;
  overflow-y: scroll;
  overflow-x: hidden;
}

body {
  /* font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; */
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  color: var(--dark);
  background: var(--bg);

  display: flex;
  justify-content: center;
}


input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}

input[type=number] {
    -moz-appearance:textfield; /* Firefox */
}

/* =========================
   TYPOGRAPHY
   ========================= */

h1 {
  font-size: 20px;
  margin: 0 0 10px 0;
}

h2 {
  font-size: 16px;
  margin: 0 0 8px 0;
}

p {
  margin: 6px 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.small {
  font-size: 12px;
}

/* =========================
   HEADER / LOGO
   ========================= */

.site-header {
  position: fixed;
  top: 0px;
  left: 0px;
  display: flex;
  align-items: center;
  width: 100%;
  height: 10vh;
  /* gap: 10px; */
  justify-content: space-between;

  background-color: var(--dark);
  opacity: 0.9;

  z-index: 1000;
}

.site-logo {
    padding-left: max(5vw, 20px);
    height: 7vh;
  overflow: hidden;
  /* background-color: none; */
}

.site-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
background-color: none;
}

.site-title {
    padding-right: max(5vw, 30px);
  font-weight: 800;
  font-size: min(2.5vw, 20px);
  
  color: var(--light);
    background-color: none;
}

/* =========================
   CARD (CALCULATOR)
   ========================= */

.card {
  border: 2px solid var(--dark);
  border-radius: 16px;
  padding: 20px 20px 0 20px;
  max-width: 800px;
  width: 80vw;
  background: var(--soft);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  margin-top: 12vh;
  margin-bottom: 20px;

  height: 100%;
    z-index: 1;             
}

#unitBtn{
    height: auto;
    width: 5% !important;
    /* flex-shrink: 0;  */
    padding: 10px 12px; 
    min-width: 60px;
}

/* =========================
   GRID SYSTEM
   ========================= */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: flex;
  justify-content: space-evenly;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 220px) {
  .grid,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
/* =========================
   FORM ELEMENTS
   ========================= */

label {
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}

input,
select,
button,
details {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  /* color: white; */
  font-size: 14px;
  box-sizing: border-box;
}

input,
select {
  background: #fff;
  color: var(--dark);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(255, 140, 26, 0.3);
}

/* =========================
   BUTTONS
   ========================= */

button {
  cursor: pointer;
  font-weight: 800;
  background: var(--orange);
  color: var(--light);
  border: none;
}

button:hover {
  filter: brightness(0.95);
}

button:active {
  transform: translateY(1px);
}


/* #calcbtn {
    width: 20vw !important;
}

#resetbtn {
    width: 20vw !important;
} */
/* =========================
   MODE BUTTONS
   ========================= */

#modeAreaBtn, #modePeopleBtn{
    background-color: var(--light);
}

#modeAreaBtn.active {
  background: var(--light_mid);
}

#modePeopleBtn.active {
  background: var(--light_mid); 
}

/* =========================
   SEX LABELS
   ========================= */

label[for="malePct"], label[for="femalePct"] {
    border: none;
  background: var(--light_mid);
  color: var(--dark);
  /* border: 1px solid var(--mid); */
  cursor: default;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 12px;
  display: inline-block;
  user-select: none;
  pointer-events: none;

  justify-content: center;
  align-items: center;
  text-align: center;
}

/* =========================
   SEX SPLIT
   ========================= */

.sex-split {
  /* default is row */
}

@media (max-width: 960px) {
  .sex-split {
    flex-direction: column;
  }
}

/* =========================
   SEPARATORS
   ========================= */

.hr {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

/* =========================
   RESULTS (ANIMATED)
   ========================= */

.results {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    max-height 0.6s ease,
    opacity 0.4s ease,
    transform 0.4s ease;
}

.card.show-results .results {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   TABLES
   ========================= */

table {
  border-collapse: collapse;
  width: 100%;

}

/* @media (max-width: 400px) {
  th {
    font-size: 5px;
  }
} */

/* th,
td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;

  font-size: 5px;
} */

th,
td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  font-size: min(15px, 2.8vw);
}

th {
  background: var(--dark);
  color: var(--light);
  font-weight: 800;

  /* font-size: min(10px, 3vw); */
}

tr:nth-child(even) {
  background: #e4e4e5;
}

/* =========================
   PILLS
   ========================= */

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

/* =========================
   ALERTS
   ========================= */

.warn {
  border-left: 4px solid var(--orange);
  padding: 10px 12px;
  background: #fff3cd;
  border-radius: 10px;
}

.ok {
  border-left: 4px solid #2da44e;
  padding: 10px 12px;
  background: #dafbe1;
  border-radius: 10px;
}

.error {
  border-left: 4px solid #cf222e;
  padding: 10px 12px;
  background: #ffebe9;
  border-radius: 10px;
}

/* =========================
   SEGMENTED CONTROL
   ========================= */

.seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.seg button {
  border: 0;
  border-radius: 0;
  width: auto;
  flex: 1;
  background: #fff;
  color: var(--dark);
}

.seg button.active {
  background: var(--soft);
  font-weight: 800;
}

/* =========================
   DETAILS / ACCORDION
   ========================= */

details {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

details summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: "▼";
  float: right;
  transition: transform 0.3s ease;
}

details:open summary::after {
  transform: rotate(180deg);
}

details .inside {
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: #fff;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

details:open .inside {
  max-height: 2000px;
  padding: 12px 12px;
}

/* =========================
   KPI BOXES
   ========================= */

.kpi {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

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

.kpi .box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.kpi .val {
  font-size: 18px;
  font-weight: 850;
  margin-top: 2px;
}

/* =========================
   FOOTER
   ========================= */

.site-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--dark);
  background: rgba(255, 255, 255, 0.4);
}

/* =========================
   MOBILE TABLE SCALING
   ========================= */

@media (max-width: 600px) {
  .card table {
    font-size: 11px;
  }
  .card th, .card td {
    padding: 3px 4px;
  }
}

/* Floating giraffes (background decoration) */
.floating-giraffes {
  position: fixed;
  inset: 0;
  pointer-events: none;   /* never block clicks */
  z-index: 0;             /* behind card */
}

/* Base giraffe style */
.giraffe {
  position: absolute;
  width: clamp(90px, 20vw, 320px);
  opacity: 0.9;
  animation: giraffe-float 10s ease-in-out infinite;
}

/* Left giraffe */
.giraffe.left {
  left: 30%;
  top: 55%;
  transform: translateX(-140%) translateY(0);
  animation-duration: 11s;
}

/* Right giraffe */
.giraffe.right {
  left: 70%;
  top: 40%;
  transform: translateX(40%) translateY(0) scale(0.8);

  animation-duration: 7s;
}

/* Hover animation */
@keyframes giraffe-float {
  0%   { transform: translate(var(--x, 0), 0); }
  50%  { transform: translate(var(--x, 0), -20px); }
  100% { transform: translate(var(--x, 0), 0); }
}

/* Lock transform X offsets cleanly */
.giraffe.left  { --x: -140%; }
.giraffe.right { --x:  40%; }
