/* ============================================================
   CSS Custom Properties (Design Tokens)
   ============================================================ */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-muted: #6b7280;
  --color-accent: #6366f1;
  --color-accent-hover: #4f46e5;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-border: #e5e7eb;
  --color-success-bg: #ecfdf5;
  --color-success-text: #065f46;
  --color-success-strike: #9ca3af;

  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 0.625rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);

  --max-width: 680px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   Utility: Screen-reader only
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Container
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo svg {
  color: var(--color-accent);
  flex-shrink: 0;
}

/* Navigation */
.nav-list {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-list a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
  position: relative;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  color: var(--color-accent);
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 500px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
}

.btn--danger {
  background: transparent;
  color: var(--color-danger);
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

.btn--danger:hover,
.btn--danger:focus-visible {
  color: var(--color-danger-hover);
  background: #fef2f2;
  border-radius: var(--radius);
}

/* ============================================================
   Section Titles
   ============================================================ */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

/* ============================================================
   To-Do Section
   ============================================================ */
.todo-section {
  padding: 3rem 0 4rem;
}

/* To-do form */
.todo-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.todo-form__input {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  min-width: 0;
}

.todo-form__input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.todo-form__input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ============================================================
   Task List
   ============================================================ */
.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Individual task item */
.todo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
  animation: fadeSlideIn 0.3s ease-out;
}

.todo-item:hover {
  box-shadow: var(--shadow-md);
  border-color: #d1d5db;
}

/* Checkbox */
.todo-checkbox {
  --size: 1.25rem;
  appearance: none;
  width: var(--size);
  height: var(--size);
  border: 2px solid var(--color-border);
  border-radius: 0.35rem;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  transition: background 0.2s, border-color 0.2s;
}

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

.todo-checkbox:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.todo-checkbox:checked::after {
  content: '';
  width: 0.35rem;
  height: 0.65rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.todo-checkbox:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Task text */
.todo-text {
  flex: 1;
  font-size: 0.975rem;
  word-break: break-word;
  transition: color 0.2s, text-decoration 0.2s;
}

/* Completed state */
.todo-item--done .todo-text {
  color: var(--color-success-strike);
  text-decoration: line-through;
}

.todo-item--done {
  background: var(--color-success-bg);
  border-color: #a7f3d0;
}

/* Delete button inside task */
.todo-delete {
  flex-shrink: 0;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 2.5rem 1rem;
  font-size: 1rem;
}

.empty-state--hidden {
  display: none;
}

/* ============================================================
   About Section
   ============================================================ */
.about-section {
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--color-border);
}

.about-section p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 520px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--color-border);
  text-align: center;
  padding: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 520px) {
  .header__inner {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

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

  .hero p {
    font-size: 1rem;
  }

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

  .todo-form .btn {
    width: 100%;
  }

  .todo-item {
    padding: 0.7rem 0.85rem;
    gap: 0.5rem;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .nav-list {
    gap: 1rem;
    font-size: 0.9rem;
  }
}