:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --border: #e5e7eb;
  --error: #dc2626;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--primary);
}

/* ---------- Header / nav ---------- */
header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

nav {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

nav ul a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

nav ul a:hover {
  background: var(--bg);
  color: var(--text);
}

nav ul a.active {
  background: var(--primary);
  color: #fff;
}

/* ---------- Layout ---------- */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 16px;
}

h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.3rem;
  margin: 24px 0 8px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---------- Home cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.link-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

.link-card .icon {
  font-size: 2.2rem;
}

.link-card h2 {
  margin: 10px 0 4px;
}

.link-card p {
  color: var(--muted);
}

/* ---------- Buttons & forms ---------- */
button {
  font: inherit;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
}

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

button.secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

button.secondary:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}

.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-form input {
  flex: 1;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
}

.search-form input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

/* ---------- Status messages ---------- */
.status {
  color: var(--muted);
  margin: 12px 0;
  min-height: 1.6em;
}

.status.error {
  color: var(--error);
}

.hidden {
  display: none;
}

/* ---------- Jokes ---------- */
.joke-card {
  margin-top: 20px;
  text-align: center;
}

.joke-setup {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.joke-punchline {
  font-size: 1.15rem;
  color: var(--primary);
  margin-top: 16px;
}

/* ---------- Weather ---------- */
.weather-card .place {
  font-size: 1.4rem;
  font-weight: 700;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}

.weather-main .emoji {
  font-size: 3.5rem;
}

.weather-main .temp {
  font-size: 2.6rem;
  font-weight: 700;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.weather-details div {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
}

.weather-details span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- About ---------- */
.about-section ul {
  padding-left: 20px;
}

.about-section li {
  margin: 4px 0;
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px;
  font-size: 0.9rem;
}

/* ---------- Mobile ---------- */
@media (max-width: 500px) {
  h1 {
    font-size: 1.6rem;
  }

  .search-form {
    flex-direction: column;
  }

  nav {
    justify-content: center;
  }
}
