:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d9dee3;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181b22;
  --text: #e6e8eb;
  --muted: #9aa3ad;
  --border: #2a2f38;
  --accent: #60a5fa;
  --accent-text: #0f1115;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s, color 0.2s;
}

h1, h2, h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.nav {
  display: flex;
  gap: 1.25rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

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

/* Layout */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero {
  text-align: center;
  padding: 5rem 0 3rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero p {
  color: var(--muted);
  font-size: 1.15rem;
  margin-bottom: 2rem;
}

.section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

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

.card p:last-child {
  margin-bottom: 0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  font-size: 1.2rem;
  padding: 0.3rem 0.6rem;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
}

/* Forms */
label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

input,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.contact-form {
  max-width: 520px;
}

.status {
  margin-top: 1rem;
  color: var(--accent);
  font-weight: 500;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Playground widgets */
.counter-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem;
}

.todo-form {
  display: flex;
  gap: 0.5rem;
}

.todo-form input {
  margin-bottom: 0;
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.todo-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.todo-list li.done span {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-list li span {
  cursor: pointer;
  flex: 1;
}

.todo-list .remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.todo-list .remove:hover {
  color: #dc2626;
}

/* Footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.5rem;
  }

  .hero {
    padding: 3rem 0 2rem;
  }
}
