/*
 * Styles for the Allergen Aware Dining website
 *
 * The colour palette is intentionally soft and friendly to evoke a sense of
 * calm and reassurance. Rounded corners, generous spacing and clear
 * typography improve readability and approachability. Elements scale
 * gracefully on small screens and support keyboard navigation.
 */

:root {
  --primary: #A4D8D8;      /* pastel turquoise */
  --secondary: #F8C8DC;    /* pastel pink */
  --accent: #FDE7B8;       /* pastel yellow */
  --background: #F8FAFC;   /* very light grey */
  --card-bg: #FFFFFF;      /* card background */
  --card-border: #E0E5EC;  /* subtle border */
  --text-dark: #2E2E2E;    /* primary text colour */
  --text-light: #555555;   /* secondary text colour */
  --highlight: #D7ECF5;    /* highlight for selection */
}

/* Global resets */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--background);
  color: var(--text-dark);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.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;
}

/* Header */
.site-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background-color: var(--primary);
  color: var(--text-dark);
  border-bottom: 2px solid var(--card-border);
}

.site-header h1 {
  margin: 0;
  font-size: 2rem;
}

.site-header .tagline {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: var(--text-light);
}

/* Filters section */
.filters {
  margin: 1rem auto;
  padding: 1rem;
  max-width: 900px;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filters h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: var(--text-dark);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.filter-row label,
.filter-label {
  font-weight: 600;
  margin-right: 0.5rem;
}

/* Search input */
#searchInput {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 0.95rem;
}

/* Allergen checkboxes */
.allergen-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.allergen-option {
  display: flex;
  align-items: center;
}

.allergen-checkbox {
  position: absolute;
  opacity: 0;
}

.allergen-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border: 2px solid var(--card-border);
  background-color: var(--secondary);
  transition: background-color 0.2s, border-color 0.2s;
}

.allergen-checkbox:checked + label {
  background-color: var(--highlight);
  border-color: var(--primary);
}

.type-cuisine-row select {
  padding: 0.4rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 0.95rem;
  background-color: var(--background);
}

/* Restaurants list */
.restaurants-list {
  max-width: 900px;
  margin: 1rem auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 0 0.5rem;
}

@media (min-width: 640px) {
  .restaurants-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .restaurants-list {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.restaurant-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.restaurant-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: var(--text-dark);
}

/* Make links inside restaurant titles visually distinct */
.restaurant-card h3 a {
  color: var(--primary);
  text-decoration: underline;
}

.restaurant-card h3 a:hover {
  text-decoration: none;
}

.restaurant-info {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.allergen-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.allergen-icons span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  background-color: var(--secondary);
  color: var(--text-dark);
  position: relative;
  border: 1px solid var(--card-border);
}

.allergen-icons span[data-present="false"] {
  /* Grey out allergens that are not present and draw a slash through them
     to provide a clear visual distinction. */
  opacity: 1;
  background-color: var(--card-border);
  color: var(--text-light);
}

/* Add a diagonal slash over allergens that are not present */
.allergen-icons span[data-present="false"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--text-light);
  transform: rotate(-45deg);
  transform-origin: center;
}

/* Highlight allergens that are present with a subtle coloured border */
.allergen-icons span[data-present="true"] {
  background-color: var(--secondary);
  color: var(--text-dark);
  font-weight: bold;
  border-color: var(--highlight);
}

.favourite-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #d2a579; /* neutral star colour */
  transition: transform 0.1s;
}

.favourite-button.favourited {
  color: #f3c623; /* golden star when favourited */
}

.favourite-button:hover {
  transform: scale(1.1);
}

.disclaimer {
  max-width: 900px;
  margin: 2rem auto;
  padding: 1rem;
  font-size: 0.85rem;
  background-color: var(--accent);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text-dark);
}

.disclaimer p {
  margin: 0;
}