/* ============================================
   Everyday English Canada — styles
   Soft off-white background, white cards,
   restrained Canadian-red accents.
   ============================================ */

:root {
  --bg: #faf8f6;
  --card-bg: #ffffff;
  --text: #23272e;
  --text-muted: #5c6470;
  --accent: #c0392b;
  --accent-dark: #a93226;
  --accent-soft: #fbeeec;
  --border: #e6e1dc;
  --shadow: 0 1px 3px rgba(35, 39, 46, 0.08), 0 4px 12px rgba(35, 39, 46, 0.05);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Header ---------- */

.site-header {
  background: var(--card-bg);
  border-bottom: 3px solid var(--accent);
  padding: 3rem 0 2.5rem;
  text-align: center;
}

.site-brand {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-title {
  margin: 0 auto 0.75rem;
  max-width: 34ch;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.25;
}

.site-description {
  margin: 0 auto;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ---------- Controls ---------- */

.controls {
  padding: 2rem 0 1rem;
}

.search-wrap {
  margin-bottom: 1rem;
}

.search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.search-input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.45rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-btn:hover {
  background: var(--accent-soft);
}

.filter-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.result-count {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Phrase cards ---------- */

.card-grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.phrase-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.phrase-category {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.phrase-english {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.phrase-chinese {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.phrase-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-left: 3px solid var(--border);
  padding-left: 0.6rem;
}

.copy-btn {
  margin-top: auto;
  align-self: flex-start;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--accent-dark);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

.copy-btn.is-copied {
  background: var(--accent);
  color: #fff;
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

/* ---------- About & footer ---------- */

.about {
  margin: 3rem 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

.about h2 {
  margin-top: 0;
}

.about p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Accessibility ---------- */

/* Visible keyboard focus for all interactive elements */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
