/* Huss's Kitchen — global styles */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --bg: #f7f5f0;
  --bg-elevated: #fffefb;
  --text: #141210;
  --text-muted: #5c5854;
  --border: #e2ddd4;
  --accent: #c45c26;
  --accent-hover: #a34d20;
  --card-shadow: 0 1px 3px rgb(20 18 16 / 0.08);
}

[data-theme="dark"] {
  --bg: #1a1816;
  --bg-elevated: #24211e;
  --text: #f2efe9;
  --text-muted: #a39e96;
  --border: #3d3833;
  --accent: #e07a45;
  --accent-hover: #f0905c;
  --card-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.site-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
}

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

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* Homepage */
.home-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-wrap label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.search-input {
  width: 100%;
  max-width: 28rem;
  padding: 0.6rem 0.75rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-elevated);
  color: var(--text);
}

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

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tag-filters span {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.tag-btn {
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

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

.tag-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

[data-theme="dark"] .tag-btn[aria-pressed="true"] {
  color: #1a1816;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}

.recipe-card {
  display: block;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg-elevated);
  box-shadow: var(--card-shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.recipe-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.recipe-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.recipe-card .meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.recipe-card .cuisine {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* Recipe page */
.recipe-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.recipe-hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.recipe-description {
  margin: 0 0 1.5rem;
  max-width: 40rem;
  color: var(--text-muted);
}

.servings-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-elevated);
  width: fit-content;
}

.servings-control label {
  font-size: 0.875rem;
  font-weight: 500;
}

.servings-control button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--bg);
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.servings-control button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.servings-control button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.servings-value {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  min-width: 1.5rem;
  text-align: center;
}

.recipe-section-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.ingredient-list {
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}

.ingredient-list li {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.ingredient-list li:last-child {
  border-bottom: none;
}

.ingredient-qty {
  flex: 0 0 5.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: right;
}

.ingredient-name {
  flex: 1;
}

.steps-list {
  margin: 0 0 1.75rem;
  padding-left: 1.25rem;
}

.steps-list li {
  margin-bottom: 0.65rem;
  padding-left: 0.25rem;
}

.recipe-notes {
  margin: 0;
  padding: 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 0.35rem 0.35rem 0;
  background: var(--bg-elevated);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.recipe-notes strong {
  color: var(--text);
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

@media print {
  .site-header .theme-toggle,
  .tag-filters,
  .search-wrap,
  .servings-control,
  .recipe-back,
  .home-controls {
    display: none !important;
  }

  .site-header {
    border-bottom: 1px solid #000;
    background: #fff;
  }

  body,
  html {
    background: #fff;
    color: #000;
  }

  .recipe-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .ingredient-list li,
  .steps-list li {
    border-color: #ddd;
  }
}
