:root {
  --color-bg: #FBE6DA;        /* main page background */
  --color-header: #FDF6F0;    /* header/footer strip*/
  --color-red: #D33643;       /* primary button / accent */
  --color-red-dark: #b32835;  /* hover state for red button */
  --color-text: #1E000E;      /* primary text color */
  --color-text-muted: #6b5a5f;/* secondary/subtext */
  --color-border: #1E000E;    /* card + button borders (dark, matches text) */
  --color-card-bg: #FDF6F0;   /* card backgrounds */
  --color-selected: #8ea3d1;  /* blue-ish selected state */

  /* Typography */
  --font-display: 'Calistoga', Georgia, serif;        /* headlines, wordmark */
  --font-body: '42dot Sans', -apple-system, sans-serif; /* everything else */

  /* Spacing scale  */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  /* Shared measurements */
  --radius: 12px;
  --border-width: 2px;
  --max-width: 1100px;
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
}

a {
  color: inherit;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}


.site-header {
  background-color: var(--color-header);
  border-bottom: var(--border-width) solid var(--color-border);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
}

.site-header__logo {
  width: 32px;
  height: 32px;
  background-color: var(--color-red);
  border: var(--border-width) solid var(--color-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.site-header__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-text);
}


.site-footer {
  margin-top: auto;
  background-color: var(--color-header);
  border-top: var(--border-width) solid var(--color-border);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.site-footer a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}


.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-lg);
}


.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--color-border);
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

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

.btn-primary {
  background-color: var(--color-red);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-red-dark);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.btn-link {
  background: none;
  border: none;
  text-decoration: underline;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0;
}


a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-selected);
  outline-offset: 2px;
}

/* ============================================
   Page: Homepage (index.html)
============================================ */
.home-hero {
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: var(--space-md);
}

.home-hero__title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 400;
}

.home-hero__subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.home-hero__cta {
  font-size: 1.05rem;
}

/* ============================================
   Shared: Progress stepper
   (used on age.html, favorites.html, results.html)
============================================ */
.stepper-bar {
  background-color: var(--color-bg);
  border-bottom: var(--border-width) solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  justify-content: center;
}

.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.stepper__step {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.stepper__circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  border: var(--border-width) solid var(--color-border);
  background-color: transparent;
  color: var(--color-text);
}

.stepper__label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Step states: complete (checkmark, filled) / active (number, filled dark) / upcoming (outlined, muted) */
.stepper__step--complete .stepper__circle {
  background-color: var(--color-selected);
  color: white;
}
.stepper__step--complete .stepper__label {
  color: var(--color-text);
}

.stepper__step--active .stepper__circle {
  background-color: var(--color-text);
  color: white;
}
.stepper__step--active .stepper__label {
  color: var(--color-text);
  font-weight: 600;
}

.stepper__step--upcoming .stepper__circle,
.stepper__step--upcoming .stepper__label {
  opacity: 0.5;
}

.stepper__connector {
  width: 40px;
  height: var(--border-width);
  background-color: var(--color-text-muted);
  opacity: 0.4;
}

/* ============================================
   Page: Age selection (age.html)
============================================ */
.page-heading {
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-lg);
}

.page-heading h1 {
  font-size: 2.25rem;
  margin-bottom: var(--space-sm);
}

.page-heading p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.age-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
  width: 100%;
  max-width: var(--max-width);
  margin-bottom: var(--space-lg);
}

.age-card {
  position: relative;
  background-color: var(--color-card-bg);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  text-align: left;
  font-family: var(--font-body);
  color: var(--color-text);
}

.age-card:hover {
  border-color: var(--color-red);
}

.age-card--selected {
  background-color: var(--color-selected);
  border-color: var(--color-text);
}

.age-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-card-bg);
  border: var(--border-width) solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

.age-card__title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.age-card__subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.age-card--selected .age-card__subtitle {
  color: var(--color-text);
}

.age-card__check {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--color-text);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.age-card--selected .age-card__check {
  display: flex;
}

.page-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn:disabled:hover {
  background-color: var(--color-red);
}

/* ============================================
   Page: Favorites picker (favorites.html)
============================================ */
.favorites-page {
  align-items: stretch; /* override the centered .site-main for this wider page */
  max-width: var(--max-width);
  margin: 0 auto;
}

.favorites-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.favorites-header-row .page-heading {
  text-align: left;
  margin: 0;
}

.selection-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background-color: var(--color-text);
  color: white;
  border: var(--border-width) solid var(--color-border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: var(--space-xs);
}

.filter-pill {
  background: transparent;
  border: var(--border-width) solid var(--color-border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.filter-pill--active {
  background-color: var(--color-text);
  color: white;
}

.filter-note {
  align-self: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-left: var(--space-xs);
}

.search-input {
  border: var(--border-width) solid var(--color-border);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  min-width: 260px;
  background-color: var(--color-card-bg);
  color: var(--color-text);
}

.favorites-status {
  text-align: center;
  padding: var(--space-md);
  color: var(--color-text-muted);
  display: none;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.media-card {
  background-color: var(--color-card-bg);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  font-family: var(--font-body);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
}

.media-card--selected {
  box-shadow: 0 0 0 2px var(--color-selected) inset;
}

.media-card__poster {
  position: relative;
  aspect-ratio: 2 / 1.15;
  background-color: var(--color-selected);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-card__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card__poster-fallback {
  font-size: 2rem;
}

.media-card__type-tag {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: var(--color-card-bg);
  border: var(--border-width) solid var(--color-border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
}

.media-card__toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--color-card-bg);
  border: var(--border-width) solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.media-card--selected .media-card__toggle {
  background-color: var(--color-text);
  color: white;
}

.media-card__body {
  padding: var(--space-sm);
}

.media-card__title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.media-card__subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.media-card__added {
  font-size: 0.75rem;
  color: var(--color-text);
  font-weight: 600;
  margin-top: 0.3rem;
}

.page-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

/* ============================================
   Page: Results (results.html)
============================================ */
.results-page {
  max-width: 1000px;
  width: 100%;
}

.results-header-row {
  width: 100%;
  margin-bottom: var(--space-lg);
}

.based-on-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.based-on-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.deck-container {
  position: relative;
  width: 100%;
  height: 600px;
  margin-bottom: var(--space-xl);
}

/* Base Card Styling */
.book-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-header);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  transition: transform 0.4s ease, opacity 0.4s ease;
  box-shadow: 4px 4px 0px rgba(30, 0, 14, 0.1);
}

/* Stacking logic for the top 3 visible cards */
.book-card:nth-last-child(1) {
  transform: translateY(0) scale(1);
  z-index: 3;
}
.book-card:nth-last-child(2) {
  transform: translateY(12px) scale(0.98);
  z-index: 2;
  opacity: 0.9;
}
.book-card:nth-last-child(3) {
  transform: translateY(24px) scale(0.96);
  z-index: 1;
  opacity: 0.8;
}

/* Inner Layout using Grid */
.book-card__layout {
  display: grid;
  grid-template-columns: 200px 1fr 120px;
  gap: var(--space-md);
}

.book-card__cover img {
  width: 100%;
  border-radius: 8px;
  border: var(--border-width) solid var(--color-border);
}

.info-box {
  background-color: #F6D6D9; 
  border: var(--border-width) solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-sm);
  margin: var(--space-sm) 0;
}

.book-card__match {
  background-color: #F6D6D9;
  border: var(--border-width) solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  padding: var(--space-md) var(--space-sm);
  height: fit-content;
}

/* Swipe Animations */
.swipe-right {
  transform: translateX(120%) rotate(15deg) !important;
  opacity: 0 !important;
}

.swipe-left {
  transform: translateX(-120%) rotate(-15deg) !important;
  opacity: 0 !important;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background-color: var(--color-header);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
}

.action-bar__buttons {
  display: flex;
  gap: var(--space-sm);
}