:root {
  --gb-blue: #0047AB;
  --gb-dark-blue: #00327A;
  --gb-cream: #FFF9EE;
  --gb-white: #FFFFFF;
  --gb-text: #333333;
  --gb-muted: #666666;
  --gb-line: #d9ccb7;
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--gb-cream);
  color: var(--gb-text);
  line-height: 1.7;
}

a {
  color: var(--gb-blue);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--gb-blue); }
h1 { font-size: 2.8rem; line-height: 1.15; }
h2 { font-size: 2rem; line-height: 1.2; }
p { margin-bottom: 18px; }

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

/* ---------- Brand Header ---------- */
.brand-header {
  background: var(--gb-blue);
  color: var(--gb-white);
  padding: 18px 24px 14px;
}

.brand-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.brand-link { flex: 0 0 auto; }

.brand-mascot {
  display: block;
  width: 125px;
  max-width: 125px;
  height: auto;
}

.brand-text { text-align: center; }
.brand-text h1 { color: var(--gb-white); margin: 0 0 4px; }
.tagline { margin: 0; font-size: 1.15rem; color: var(--gb-white); }

/* ---------- Navigation ---------- */
.main-nav {
  background: var(--gb-dark-blue);
  text-align: center;
  padding: 11px 15px;
}

.main-nav a {
  color: var(--gb-white);
  display: inline-block;
  margin: 3px 13px;
  font-weight: 700;
}

.main-nav a:hover,
.main-nav .current { text-decoration: underline; }

/* ---------- Main ---------- */
.wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px 70px;
}

.page-intro {
  max-width: 820px;
  margin-bottom: 34px;
}

.page-intro h1 { margin-bottom: 16px; }

.recipe-box-app {
  display: grid;
  grid-template-columns: minmax(270px, 360px) 1fr;
  align-items: start;
  gap: 50px;
  padding: 34px;
  border: 3px solid var(--gb-blue);
  border-radius: 16px;
  background: rgba(255,255,255,0.24);
}

.box-panel { text-align: center; }

.box-stage {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.recipe-box-image {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transform-origin: center bottom;
}

.box-caption {
  color: var(--gb-muted);
  font-size: .95rem;
  margin: 0;
}

.search-panel h2 { margin-bottom: 14px; }

.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  border: 2px solid #b9aa94;
  border-radius: 9px;
  font-size: 1rem;
  background: #fff;
}

.search-form input:focus {
  outline: 3px solid rgba(0,71,171,.18);
  border-color: var(--gb-blue);
}

.search-form button,
.viewer-actions button {
  border: 0;
  border-radius: 9px;
  background: var(--gb-blue);
  color: #fff;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.search-form button:hover,
.viewer-actions button:hover { background: var(--gb-dark-blue); }

.search-help {
  margin: 0 0 16px;
  font-size: .9rem;
  color: var(--gb-muted);
}

.results-status {
  min-height: 1.6em;
  font-weight: 700;
  color: var(--gb-blue);
  margin-bottom: 8px;
}

.recipe-results {
  display: grid;
  gap: 10px;
}

.recipe-result {
  width: 100%;
  border: 1px solid #d8cbb9;
  border-left: 5px solid var(--gb-blue);
  border-radius: 9px;
  background: #fff;
  padding: 13px 15px;
  text-align: left;
  cursor: pointer;
  color: var(--gb-text);
}

.recipe-result:hover,
.recipe-result:focus-visible {
  border-color: var(--gb-blue);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  outline: none;
}

.recipe-result-number {
  display: inline-block;
  min-width: 70px;
  color: var(--gb-blue);
  font-weight: 800;
}

.recipe-result-title { font-weight: 700; }

/* ---------- Retrieval animation ---------- */
.retrieval-card {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 30%;
  width: 52%;
  aspect-ratio: 0.77;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0,0,0,.20);
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, 48%) scale(.72);
  transform-origin: center top;
  pointer-events: none;
}

.retrieval-card-blue { height: 24%; background: var(--gb-blue); }

.retrieval-card-brand {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 5px 6px;
  color: var(--gb-blue);
  font-size: .52rem;
  line-height: 1.1;
  text-align: left;
}

.retrieval-card-brand img {
  width: 28%;
  height: auto;
  margin-top: -1px;
}

.box-stage.opening .recipe-box-image {
  animation: box-pop .18s ease-out;
}

.box-stage.retrieving .retrieval-card {
  z-index: 3;
  animation: card-rise .34s cubic-bezier(.2,.8,.2,1) forwards;
}

.box-stage.expanding .retrieval-card {
  z-index: 5;
  animation: card-expand .26s ease-in forwards;
}

@keyframes box-pop {
  0% { transform: scale(.98); }
  100% { transform: scale(1); }
}

@keyframes card-rise {
  0% { opacity: 0; transform: translate(-50%, 48%) scale(.72); }
  20% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -38%) scale(.86); }
}

@keyframes card-expand {
  from { opacity: 1; transform: translate(-50%, -38%) scale(.86); }
  to { opacity: 0; transform: translate(-50%, -65%) scale(2.6); }
}

/* ---------- PDF viewer ---------- */
.viewer-section {
  margin-top: 42px;
  scroll-margin-top: 20px;
}

.viewer-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 14px;
}

.viewer-number {
  margin: 0 0 2px;
  color: var(--gb-blue);
  font-weight: 800;
}

.viewer-heading h2 { margin: 0; }

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.viewer-actions a { font-weight: 700; }
.viewer-actions button { padding: 9px 13px; font-size: .9rem; }

.recipe-viewer {
  display: block;
  width: 100%;
  min-height: 820px;
  border: 3px solid var(--gb-blue);
  border-radius: 12px;
  background: #fff;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--gb-dark-blue);
  color: var(--gb-white);
  margin-top: 60px;
  padding: 0;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-logo {
  width: 95px;
  height: 95px;
  object-fit: cover;
  border-radius: 50%;
}

.footer-brand-text span { display: block; font-size: .95rem; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
}

.footer-nav a,
.footer-nav a:visited {
  color: var(--gb-white) !important;
  text-decoration: none;
  font-weight: 600;
}

.footer-nav a:hover { text-decoration: underline; }

.footer-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
}

.footer-social a,
.footer-social a:visited,
.footer-social a:active,
.footer-social a:hover,
.footer-social a *,
.footer-social svg,
.footer-social i {
  color: #fff !important;
  fill: #fff !important;
  text-decoration: none !important;
}

.footer-social a {
  font-size: 1.75rem;
  line-height: 1;
  transition: transform .15s ease;
}

.footer-social a:hover { transform: scale(1.15); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.2);
  text-align: center;
  padding: 12px 20px 14px;
  font-size: .85rem;
}

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  .brand-header-inner { flex-direction: column; gap: 8px; }
  .brand-mascot { width: 100px; max-width: 100px; }
  .brand-text h1 { font-size: 2.2rem; }
  .main-nav a { margin: 5px 8px; }
  .wrapper { padding: 35px 22px 55px; }
  .recipe-box-app { grid-template-columns: 1fr; gap: 25px; padding: 24px 18px; }
  .box-stage { width: min(82vw, 320px); }
  .viewer-heading { align-items: flex-start; flex-direction: column; }
  .viewer-actions { justify-content: flex-start; }
  .recipe-viewer { min-height: 650px; }
}

@media (max-width: 560px) {
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.7rem; }
  .search-form { flex-direction: column; }
  .search-form button { width: 100%; }
  .footer-nav { flex-direction: column; gap: 8px; }
  .recipe-viewer { min-height: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
