/* ¿Who Knows? — Design System: Ink & Signal */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,700;1,400&family=Sora:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Custom Properties ── */
:root {
  --bg:          #0E0F11;
  --bg-surface:  #13141A;
  --bg-elevated: #1A1B22;
  --bg-input:    #17181F;
  --border:      #272830;
  --border-mid:  #33343F;
  --text-1:      #F2EFE8;
  --text-2:      #8A8898;
  --text-3:      #4A4A58;
  --accent:      #C8A96E;
  --accent-lt:   #DFC089;
  --accent-dim:  rgba(200, 169, 110, 0.12);
  --accent-ring: rgba(200, 169, 110, 0.22);
  --error:       #C26060;
  --error-bg:    rgba(194, 96, 96, 0.09);
  --success:     #4FA87A;
  --success-bg:  rgba(79, 168, 122, 0.09);
  --radius-sm:   5px;
  --radius:      8px;
  --radius-lg:   14px;
  --radius-pill: 999px;
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --t:           180ms;
  --font-serif:  'Playfair Display', Georgia, serif;
  --font-sans:   'Sora', system-ui, sans-serif;
  --font-mono:   'DM Mono', 'Courier New', monospace;
  --nav-h:       58px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-1);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle grain overlay for depth */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t) var(--ease); }
a:hover { color: var(--accent-lt); }

/* ── Page Shell ── */
.page { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Navigation ── */
.navigation {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 15, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
  white-space: nowrap;
  text-align: left;
}

nav h1 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
  display: inline-block;
  margin-right: 0;
}

nav h1 a {
  color: var(--text-1);
  display: inline-block;
}

nav h1 a:hover { color: var(--accent); }

nav a { display: inline-block; }

#nav-login,
#nav-register,
#nav-logout {
  float: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-left: 6px;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
  margin-right: 0;
}

#nav-login:hover,
#nav-logout:hover {
  color: var(--text-1);
  background: var(--bg-elevated);
}

#nav-register {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(200, 169, 110, 0.2);
}

#nav-register:hover {
  background: rgba(200, 169, 110, 0.18);
  color: var(--accent-lt);
}

/* ── Body area ── */
div.page div.body { flex: 1; padding: 0; display: flex; flex-direction: column; }

div.page div.body .footer { margin-top: auto; }

/* ── Search Hero ── */
.search-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 24px 52px;
}

.search-hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  opacity: 0.8;
}

.search-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(38px, 5.5vw, 72px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text-1);
  text-align: center;
  margin-bottom: 10px;
}

.search-hero-sub {
  font-size: 14px;
  font-style: italic;
  color: var(--text-2);
  margin-bottom: 44px;
  letter-spacing: 0.01em;
}

/* ── Search Bar ── */
.search-bar-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 620px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-pill);
  padding: 5px 5px 5px 22px;
  gap: 8px;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.search-bar-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), 0 8px 40px rgba(0,0,0,0.5);
}

/* Search input — override global input rule */
#search-input {
  flex: 1;
  width: auto !important;
  padding: 8px 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-1);
  outline: none;
  box-shadow: none !important;
  min-width: 0;
}

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

/* Search button */
#search-button {
  flex-shrink: 0;
  width: auto !important;
  margin: 0 !important;
  padding: 9px 22px !important;
  background: var(--accent) !important;
  color: #0D0C09 !important;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none !important;
  border-radius: var(--radius-pill) !important;
  cursor: pointer;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease) !important;
  box-shadow: none;
}

#search-button:hover {
  background: var(--accent-lt) !important;
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(200, 169, 110, 0.25) !important;
}

#search-button:active {
  transform: scale(0.98);
  box-shadow: none !important;
  background-color: var(--accent) !important;
}

/* ── Search Results ── */
#results {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 24px 60px;
  width: 100%;
}

/* JS-injected result cards */
#results .result-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeSlide 0.28s var(--ease) both;
}
#results .result-item:last-child { border-bottom: none; }

#results .result-item a { display: block; }

#results .result-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

#results .result-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
  margin-bottom: 6px;
  transition: color var(--t) var(--ease);
}

#results .result-title:hover { color: var(--accent-lt); text-decoration: underline; }

#results .result-snippet {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Global input / button defaults ── */
input {
  font-family: var(--font-sans);
  font-size: 14.5px;
  color: var(--text-1);
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 11px 15px;
  width: 100%;
  margin: 0;
  outline: none;
  -webkit-appearance: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

input::placeholder { color: var(--text-3); }

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

input[type="submit"] {
  background: var(--accent);
  color: #0D0C09;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 12px 28px;
  width: 100%;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}

input[type="submit"]:hover { background: var(--accent-lt); }
input[type="submit"]:active { transform: scale(0.99); }

button {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 10px 20px;
  cursor: pointer;
  width: auto;
  margin: 0;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}

button:hover { background: #1F2029; border-color: #3A3B48; }
button:active { background: var(--bg-elevated); box-shadow: none; }

/* ── Form Pages (Login / Register) ── */
.form-page {
  display: flex;
  justify-content: center;
  padding: 56px 24px 60px;
  min-height: calc(100vh - var(--nav-h) - 58px);
}

.form-container {
  width: 100%;
  max-width: 400px;
}

.form-container h2 {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.1;
  margin-bottom: 6px;
}

.form-container .form-sub {
  font-size: 13.5px;
  color: var(--text-2);
  margin-bottom: 36px;
}

form dl {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

form dl dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}

form dl dd { margin: 0; }

.actions { margin-top: 4px; }

/* ── Flash / Error messages ── */
ul.flashes {
  list-style: none;
  margin: 0;
  padding: 0;
  margin-bottom: 18px;
}

ul.flashes li {
  background: var(--success-bg);
  border: 1px solid rgba(79, 168, 122, 0.25);
  border-radius: var(--radius);
  padding: 11px 15px;
  font-size: 13.5px;
  color: var(--success);
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  top: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: min(400px, calc(100vw - 32px));
}

.toast {
  pointer-events: all;
  display: grid;
  grid-template-columns: 28px 1fr 24px;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
  border-left-width: 3px;
  border-left-style: solid;
  border-top: 1px solid;
  border-right: 1px solid;
  border-bottom: 1px solid;
  animation: toast-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
  min-width: 260px;
}

.toast--success {
  background: rgba(16, 26, 22, 0.92);
  border-color: rgba(79, 168, 122, 0.18);
  border-left-color: var(--success);
  color: #A8D9BC;
}

.toast--error {
  background: rgba(24, 14, 14, 0.92);
  border-color: rgba(194, 96, 96, 0.18);
  border-left-color: var(--error);
  color: #E09898;
}

.toast--out {
  animation: toast-out 0.2s ease-in forwards;
}

.toast__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast--success .toast__icon {
  background: rgba(79, 168, 122, 0.15);
  color: var(--success);
}

.toast--error .toast__icon {
  background: rgba(194, 96, 96, 0.15);
  color: var(--error);
}

.toast__message {
  line-height: 1.45;
  color: inherit;
}

.toast__close {
  background: transparent;
  border: none;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.35;
  font-size: 16px;
  line-height: 1;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: opacity var(--t), background var(--t);
  flex-shrink: 0;
  box-shadow: none;
}

.toast__close:hover {
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  box-shadow: none;
}

.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 1px 0 0;
  opacity: 0.6;
  animation: toast-progress 4s linear forwards;
}

.toast--success .toast__progress { background: var(--success); }
.toast--error   .toast__progress { background: var(--error); }

@keyframes toast-in {
  from { transform: translateY(-16px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)     scale(1);    opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateY(0)     scale(1);    opacity: 1; }
  to   { transform: translateY(-8px)  scale(0.97); opacity: 0; }
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ── Footer ── */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.footer a {
  color: var(--text-3);
  transition: color var(--t) var(--ease);
}

.footer a:hover { color: var(--accent); }

/* ── About Page ── */
.about-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 60px 28px 80px;
}

.about-page h1 {
  font-family: var(--font-serif);
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.1;
  margin-bottom: 16px;
}

.about-page p {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 48px;
  max-width: 560px;
}

.about-page h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-1);
  margin-bottom: 22px;
}

.about-page img {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  filter: brightness(0.92) saturate(0.9);
}

/* ── Divider accent line ── */
.accent-line {
  display: block;
  width: 36px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 32px;
  opacity: 0.7;
}

.result-item {
  margin-bottom: 20px;
}

.result-title {
  font-size: 18px;
  font-weight: bold;
  color: blue;
}

.result-snippet {
  font-size: 14px;
  color: #555;
  margin-top: 5px;
}

/* ── Weather ── */
.weather-hero { padding: 56px 24px 32px; text-align: center; }

.weather-current {
  max-width: 480px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

.weather-now-card {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}

.weather-now-icon { font-size: 64px; line-height: 1; }

.weather-now-temp {
  font-family: var(--font-serif);
  font-size: 52px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.weather-unit { font-size: 28px; color: var(--text-2); }
.weather-now-desc { font-size: 16px; color: var(--text-1); margin-top: 6px; }
.weather-now-wind { font-size: 13px; color: var(--text-2); margin-top: 4px; font-family: var(--font-mono); }

.weather-loading { color: var(--text-2); text-align: center; padding: 40px 0; }

.weather-forecast { width: 100%; max-width: 900px; margin: 0 auto 60px; padding: 0 24px; box-sizing: border-box; }

.weather-forecast-title {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-2);
  margin-bottom: 16px;
  font-weight: 500;
}

.weather-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.weather-day-card {
  flex: 1 0 110px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: border-color var(--t) var(--ease);
}

.weather-day-card:hover { border-color: var(--border-mid); }

.weather-day-date { font-size: 11px; color: var(--text-2); margin-bottom: 8px; font-family: var(--font-mono); }
.weather-day-icon { font-size: 28px; margin-bottom: 6px; }
.weather-day-desc { font-size: 11px; color: var(--text-2); margin-bottom: 8px; line-height: 1.3; }

.weather-day-temps { display: flex; justify-content: center; gap: 8px; font-family: var(--font-mono); }
.weather-temp-high { color: var(--accent); font-size: 13px; font-weight: 500; }
.weather-temp-low { color: var(--text-3); font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  nav { padding: 0 16px; }
  .search-hero { padding: 48px 16px 36px; }
  .search-bar-wrapper { padding: 5px 5px 5px 16px; }
  #results { padding: 8px 16px 48px; }
  .form-page { padding: 40px 16px; }
  .footer { padding: 16px; flex-direction: column; gap: 8px; text-align: center; }
  .about-page { padding: 40px 16px 60px; }
}
