/* ============================================================
   COLOR PALETTE (preserved from original)
   ------------------------------------------------------------
   Neutrals : #ffffff -> #999999
   Accent 1 : Tomato    (#ff6347)
   Accent 2 : DodgerBlue(#1e90ff)
   Accent 3 : Violet    (#ee82ee) / Green (#00cc00 for links)
   Shadows & structural accents pull from outside this palette
   (deep indigo/blue) so the core palette stays clean.
   ============================================================ */

:root {
  /* Core palette */
  --color-white: #ffffff;
  --color-gray: #999999;
  --color-tomato: tomato;
  --color-dodgerblue: dodgerblue;
  --color-violet: violet;
  --color-green: #00cc00;

  /* Accent / effect colors (outside core palette) */
  --shadow-color: #3066be;
  --border-accent: #090c9b;
  --highlight-accent: #f1e862;
  --table-border: #b509bb;

  /* Surfaces */
  --bg-body: var(--color-gray);
  --bg-panel: rgba(255, 255, 255, 0.06);

  /* Typography */
  --font-base: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Effects */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 4px 16px 0 var(--shadow-color);
  --transition-base: all 0.25s ease;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-base);
  background-color: var(--bg-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 {
  text-align: center;
  color: var(--color-tomato);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
  color: var(--color-tomato);
  font-size: clamp(1.25rem, 2.6vw, 1.875rem);
  font-weight: 600;
  max-width: 95vw;
  margin: 0 auto;
  background-size: cover;
  background-repeat: no-repeat;
}

form h2 {
  display: block;
  color: var(--color-white);
  font-size: clamp(1.1rem, 2.4vw, 2.25rem);
  text-align: center;
  max-width: 33vw;
  width: auto;
  background-size: cover;
  background-repeat: no-repeat;
}

h3 {
  text-align: center;
  color: var(--color-dodgerblue);
  width: auto;
  margin: 0 auto;
}

h4 {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.4vw auto 1vw;
  max-width: 95vw;
  height: auto;
  font-size: clamp(1.25rem, 3vw, 2.25rem);
  text-align: center;
  background-size: cover;
  background-repeat: no-repeat;
  border-bottom: 3px solid var(--border-accent);
  box-shadow: var(--shadow-glow);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ============================================================
   LINKS
   ============================================================ */
a {
  color: var(--color-green);
  text-decoration: none;
  font-size: clamp(0.9rem, 2vw, 1.5rem);
  transition: var(--transition-base);
}

a:visited {
  color: var(--color-tomato);
}

a:hover {
  opacity: 0.8;
}

/* ============================================================
   HEADER / FOOTER
   ============================================================ */
header {
  background-size: cover;
  background-repeat: no-repeat;
  max-width: 50vw;
  min-width: 420px;
  height: auto;
  margin: 0 auto 0.75vw;
  color: var(--color-violet);
  text-align: center;
  font-size: clamp(1.5rem, 2.8vw, 2.5rem);
  box-shadow: var(--shadow-glow);
  border-radius: var(--radius-md);
  padding: 1rem;
}

footer,
.page-footer {
  text-align: center;
}

.page-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 95vw;
  margin: 0 auto;
  background-size: cover;
  background-repeat: no-repeat;
}

.page-footer img {
  max-width: 100vw;
  border-radius: var(--radius-sm);
}

/* ============================================================
   LAYOUT: SECTION / ARTICLE
   ============================================================ */
section {
  position: relative;
  max-width: 75vw;
  margin: 0 auto;
  font-size: clamp(1rem, 2.2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

article {
  margin: 0 auto;
  font-size: clamp(0.9rem, 2vw, 1.25rem);
  word-wrap: break-word;
}

/* ============================================================
   CITY SELECTOR
   ============================================================ */
.city-selector {
  text-align: center;
  margin: 20px 0;
  color: var(--color-violet);
}

.city-selector select {
  padding: 6px 12px;
  font-size: 1em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-gray);
  background-color: var(--color-white);
  transition: var(--transition-base);
}

.city-selector select:hover,
.city-selector select:focus {
  box-shadow: var(--shadow-soft);
}

/* ============================================================
   TABLE / FORECAST
   ============================================================ */
#table-container {
  width: 100vw;
  overflow-x: auto;
  box-sizing: border-box;
  padding: 10px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

th,
td {
  border: 1px solid var(--table-border);
  padding: 10px;
  vertical-align: top;
}

th {
  text-align: center;
}

.heading-period,
.forecast-period {
  text-align: center;
}

.forecast-period {
  margin-bottom: 10px;
}

.heading-period .period-name,
.forecast-period .period-name {
  color: var(--color-tomato);
  font-weight: bold;
}

.heading-period .period-name {
  font-size: 1.4em;
}

.forecast-period .period-name {
  font-size: 1.1em;
}

.heading-period .temperature,
.forecast-period .temperature {
  color: var(--color-violet);
  font-weight: bold;
}

.heading-period .temperature {
  font-size: 1.2em;
}

.heading-period .detailed,
.forecast-period .detailed {
  margin-top: 5px;
  color: var(--color-white);
}

.heading-period .detailed {
  font-size: 0.95em;
}

.forecast-period .detailed {
  font-size: 0.9em;
}

/* ============================================================
   THEME OPTIONS
   ============================================================ */
.theme-options label {
  display: flex;
  justify-content: flex-end;
  margin: 20px auto;
  padding-right: 20px;
  color: var(--color-violet);
}

/* ============================================================
   ACCORDION
   ============================================================ */
.accordion-section {
  color: var(--color-violet);
  cursor: pointer;
  border: 3px solid var(--highlight-accent);
  border-radius: var(--radius-md);
  justify-content: center;
  align-items: center;
  min-width: 300px;
  max-width: 40vw;
  height: auto;
  margin: 0 auto;
  transition: var(--transition-base);
}

.accordion-section:hover {
  box-shadow: var(--shadow-soft);
}

.accordion-content {
  display: none;
  width: auto;
  font-weight: bold;
}

.accordion-content a,
.table-cert a {
  text-decoration: none;
  font-size: clamp(0.9rem, 2vw, 1.5rem);
}

.accordion-content img {
  display: block;
  width: min(50vw, 400px);
  margin: 0 auto;
  border-radius: var(--radius-sm);
}

.active {
  display: block;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.collapse-button,
.collapse-all-link {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 10px 20px;
  background-color: var(--color-dodgerblue);
  color: var(--color-white);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: var(--transition-base);
}

.collapse-button:hover,
.collapse-all-link:hover {
  background-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* ============================================================
   FORMS
   ============================================================ */
.form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

label {
  display: inline-block;
}

/* ============================================================
   IMAGES
   ============================================================ */
.inline-img {
  display: block;
  vertical-align: middle;
  width: 66vw;
  height: auto;
  border-radius: var(--radius-sm);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media screen and (max-width: 768px) {
  h2 {
    text-align: center;
  }

  form h2,
  header,
  .accordion-section {
    max-width: 90vw;
  }
}
