/* ------------- CSS RESET (tiny) ------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ------------- ROOT VARIABLES ------------- */
:root {
  --bg: #f0f4f7;
  --card-bg: #ffffff;
  --text: #212529;
  --accent: #0066ff;
  --radius: 0.75rem;
  --shadow: 0 4px 10px rgba(0,0,0,0.08);
  --max-width: 48rem;       /* 768 px */
  --gutter: 1.25rem;        /* 20 px */
  --font-base: clamp(1rem, 2.5vw + 0.5rem, 1.125rem);
  --font-lg: clamp(1.25rem, 3vw + 0.5rem, 1.5rem);
}

/* ------------- PAGE LAYOUT ------------- */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: var(--font-base);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;   /* stack children top → bottom */
  justify-content: flex-start;
  align-items: center;      /* centre horizontally */
  gap: 2rem;                /* spacing between sections */
  min-height: 100vh;
  padding: var(--gutter);
}

/* ------------- HEADER STYLES ------------- */
.site-header {
  width: 100%;
  max-width: var(--max-width);
  background: var(--card-bg);
  padding: calc(var(--gutter) * 1.5) calc(var(--gutter) * 1.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.site-title {
  font-size: clamp(2rem, 4vw + 1rem, 2.5rem);
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.site-tagline {
  font-size: clamp(1rem, 2vw + 0.5rem, 1.25rem);
  color: var(--text);
}

/* ------------- MAIN CONTENT (WEATHER) ------------- */
main#infoContainer {
  width: 100%;
  max-width: var(--max-width);
  background: var(--card-bg);
  padding: calc(var(--gutter) * 1.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.45;
}

/* ------------- TYPOGRAPHY ------------- */
h2 {
  font-size: var(--font-lg);
  margin-bottom: 0.6em;
  color: var(--accent);
}

p + p {
  margin-top: 0.75em;
}

/* ------------- MEDIA QUERIES ------------- */
/* Slightly roomier layout on tablets & up */
@media (min-width: 40em) {     /* 640 px */
  body {
    align-items: center;       /* vertically centre once screen is taller */
  }
  main#infoContainer {
    padding: calc(var(--gutter) * 1.8);
  }
}

/* Dark‑mode user preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18202a;
    --card-bg: #202b36;
    --text: #e9eef2;
    --accent: #66b0ff;
    --shadow: 0 4px 10px rgba(0,0,0,0.6);
  }
}

/* ==========  CHAT CARD  ========== */
#chatBox {
  width: 100%;                     /* fill on phones … */
  max-width: var(--max-width);     /* … but never wider than the weather card */
  background: var(--card-bg);      /* same colours / radius / shadow */
  padding: calc(var(--gutter) * 1.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.45;
}

#chatBox h3 {                      /* keep heading aligned with weather h2 */
  margin-bottom: 0.6em;
  font-size: var(--font-lg);
  color: var(--accent);
}

/* keep very long words / URLs from stretching the card */
#feelResult {
  margin-top: 1rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;       /* NEW */
}

/* form: stay inside the card */
#feelForm {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

/* ensure the input never shrinks smaller than 0  (fixes safari “pop” effect) */
#feelForm input {
  flex: 1 1 0;                     /* allow grow & shrink but preserve min‑width */
  min-width: 0;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
}

#feelForm button {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

#feelForm button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==== Crypto card ============================================= */
/* ===== CRYPTO CARD (same width & look as other cards) ============ */
.crypto-card {
  width: 100%;
  max-width: var(--max-width);         /* matches other sections */
  margin-top: 0;                    /* space above */
  padding: calc(var(--gutter) * 1.8);  /* same rhythm */
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  line-height: 1.45;
}

.crypto-card h2 {
  color: var(--accent);
  margin-bottom: 0.2rem;
}

#cryptoSelect {
  margin-top: 0.8rem;
  width: 100%;
  font-size: 1rem;
  padding: 0.35rem 0.5rem;
}

.price-line {
  margin-top: 0.8rem;
  font-family: mono, Consolas, Menlo, monospace;
}

.desc-line {
  margin-top: 0.4rem;
  font-style: italic;
  white-space: pre-wrap;   /* NEW: keep line breaks & wrap long words */
  overflow-wrap: anywhere; /* break very long URLs/words if needed */
}

.site-stats {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.25rem;
}


/* ------------- FOOTER STYLES ------------- */
.site-footer {
  width: 100%;
  max-width: var(--max-width);
  background: var(--card-bg);
  padding: calc(var(--gutter) * 1.2) calc(var(--gutter) * 1.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--text);
}