/* ============================================================
   The Fucking Weather — Stylesheet
   ============================================================ */

/* --- Google Font loaded in HTML --- */

/* ============================================================
   CSS Custom Properties (overridden per bg class)
   ============================================================ */
:root {
  --text-primary:    #ffffff;
  --text-secondary:  rgba(255,255,255,0.75);
  --text-muted:      rgba(255,255,255,0.5);
  --search-bg:       rgba(255,255,255,0.15);
  --search-border:   rgba(255,255,255,0.3);
  --search-text:     #ffffff;
  --search-ph:       rgba(255,255,255,0.5);
  --card-bg:         rgba(255,255,255,0.12);
  --card-border:     rgba(255,255,255,0.2);
  --link-color:      rgba(255,255,255,0.6);
  --shadow:          0 4px 30px rgba(0,0,0,0.3);
}

/* Light-text override for snow/blizzard (light backgrounds) */
.bg-snow,
.bg-blizzard {
  --text-primary:   #1a1a2e;
  --text-secondary: rgba(0,0,0,0.65);
  --text-muted:     rgba(0,0,0,0.45);
  --search-bg:      rgba(0,0,0,0.1);
  --search-border:  rgba(0,0,0,0.2);
  --search-text:    #1a1a2e;
  --search-ph:      rgba(0,0,0,0.4);
  --card-bg:        rgba(0,0,0,0.08);
  --card-border:    rgba(0,0,0,0.15);
  --link-color:     rgba(0,0,0,0.45);
  --shadow:         0 4px 30px rgba(0,0,0,0.1);
}

/* ============================================================
   Background Classes
   ============================================================ */
body {
  transition: background 1.2s ease, color 0.6s ease;
}

.bg-thunderstorm {
  background: linear-gradient(160deg, #1a0a2e 0%, #2d1b4e 40%, #3d2060 70%, #1f1035 100%);
}
.bg-rain-heavy {
  background: linear-gradient(160deg, #1a2030 0%, #253040 40%, #1c2a3a 70%, #131d28 100%);
}
.bg-rain-light {
  background: linear-gradient(160deg, #2a3d52 0%, #3a5068 40%, #2d4558 70%, #1e3244 100%);
}
.bg-blizzard {
  background: linear-gradient(160deg, #e8edf2 0%, #f2f5f8 40%, #dce3ea 70%, #c8d4de 100%);
}
.bg-snow {
  background: linear-gradient(160deg, #c8d8e8 0%, #dce8f4 40%, #b8cedd 70%, #a8bece 100%);
}
.bg-fog {
  background: linear-gradient(160deg, #3a3830 0%, #4a4840 40%, #383630 70%, #282820 100%);
}
.bg-hot {
  background: linear-gradient(160deg, #7a1010 0%, #b83020 40%, #d05010 70%, #a02818 100%);
}
.bg-warm {
  background: linear-gradient(160deg, #1a6090 0%, #2a80b8 40%, #1878a8 70%, #0e5880 100%);
}
.bg-pleasant {
  background: linear-gradient(160deg, #2a5070 0%, #3a6880 40%, #2a5870 70%, #1c4260 100%);
}
.bg-cold {
  background: linear-gradient(160deg, #1a2840 0%, #223050 40%, #1c2a48 70%, #141e34 100%);
}

/* ============================================================
   Base / Reset
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   App Layout
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
}

/* ============================================================
   Header
   ============================================================ */
header h1 {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
}

/* ============================================================
   Search Section
   ============================================================ */
#search-section {
  display: flex;
  justify-content: center;
}

#search-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
}

#search-input {
  flex: 1;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--search-text);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input::placeholder {
  color: var(--search-ph);
}

#search-input:focus {
  border-color: var(--search-text);
  box-shadow: 0 0 0 2px var(--search-bg);
}

#search-btn {
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 10px;
  padding: 0.65rem 1.4rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--search-text);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#search-btn:hover {
  background: rgba(255,255,255,0.25);
}

#search-btn:active {
  transform: scale(0.97);
}

/* ============================================================
   Loading / Error States
   ============================================================ */
#loading {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 2rem 0;
}

#error-msg {
  text-align: center;
  color: #ff8080;
  background: rgba(255,0,0,0.12);
  border: 1px solid rgba(255,0,0,0.25);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  font-size: 1rem;
}

/* ============================================================
   Weather Display
   ============================================================ */
#weather-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

#location {
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* --- Temperature Block --- */
#temp-block {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1;
}

#temperature {
  font-size: clamp(6rem, 22vw, 12rem);
  font-weight: 900;
  color: var(--text-primary);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

#unit-toggle-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 1.2rem;
  gap: 0.4rem;
}

#unit-label {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

#toggle-unit {
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s;
  white-space: nowrap;
}

#toggle-unit:hover {
  background: rgba(255,255,255,0.25);
}

/* --- Condition --- */
#condition {
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* --- Content Block (one-liner + advice) --- */
#content-block {
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#one-liner {
  font-size: clamp(1.3rem, 4.5vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

#advice {
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Share Button --- */
#share-btn {
  align-self: center;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 8px;
  padding: 0.45rem 1.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

#share-btn:hover {
  background: rgba(255,255,255,0.25);
  color: var(--text-primary);
}

#share-btn:active {
  transform: scale(0.97);
}

#share-btn.copied {
  color: #7fffb0;
  border-color: #7fffb0;
}

/* ============================================================
   Forecast
   ============================================================ */
#forecast-section {
  margin-top: 0.5rem;
}

#forecast {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.forecast-day {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  min-width: 80px;
  flex: 1;
  max-width: 120px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  box-shadow: var(--shadow);
}

.forecast-day .day-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.forecast-day .day-condition {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

.forecast-day .day-temps {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.forecast-day .day-temps .low {
  font-weight: 300;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  text-align: center;
  padding: 1rem 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

footer a {
  color: var(--link-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   Responsive Adjustments
   ============================================================ */
@media (max-width: 480px) {
  #app {
    padding: 1.25rem 1rem;
    gap: 1rem;
  }

  #forecast {
    gap: 0.4rem;
  }

  .forecast-day {
    min-width: 60px;
    padding: 0.6rem 0.5rem;
  }

  #unit-toggle-group {
    padding-top: 0.8rem;
  }
}

@media (max-width: 340px) {
  .forecast-day .day-condition {
    display: none;
  }
}
