:root {
  --color-bg: #f4f7f5;
  --color-text: #1f2a24;
  --color-accent: #2f6f8f;
  --color-header: #1f4f68;
  --color-nav: #ffffff;
  --color-button: #2f6f8f;
  --color-button-text: #ffffff;
  --border: rgba(31, 42, 36, 0.14);
  --shadow: 0 10px 30px rgba(31, 42, 36, 0.08);
  --radius: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --max: 960px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:hover,
a:focus-visible {
  color: var(--color-header);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

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

.container {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  background: var(--color-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding-block: 0.5rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-header);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(47, 111, 143, 0.1);
  outline: none;
}

.nav-toggle {
  display: none;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.site-main {
  padding: 2rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  color: rgba(31, 42, 36, 0.7);
  font-size: 0.95rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  border-radius: 10px;
  text-decoration: none;
  flex: 0 0 auto;
}

.logo-link:hover,
.logo-link:focus-visible {
  outline: 3px solid rgba(47, 111, 143, 0.25);
  outline-offset: 3px;
}

.mrbies-logo-link {
  padding: 5px;
  border-radius: 14px;
  border: 3px solid #2f6f8f;
  animation: mrbies-pulse-border 2.4s ease-in-out infinite;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem 2rem;
  margin-bottom: 1.35rem;
  width: 100%;
}

.hero-copy {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 34rem;
}

.hero-copy h1 {
  margin: 0 0 0.75rem;
}

.hero-copy p {
  margin: 0;
}

.hero-logos {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
  flex: 0 1 auto;
  margin-left: auto;
}

.hero-logos .logo-link img {
  height: 140px;
  width: auto;
  max-width: min(280px, 42vw);
  display: block;
  object-fit: contain;
  border-radius: 8px;
}

.hero-logos .techie-logo-link img {
  max-width: 140px;
}

@keyframes mrbies-pulse-border {
  0% {
    border-color: #2f6f8f;
    box-shadow: 0 0 0 0 rgba(47, 111, 143, 0.45);
  }
  25% {
    border-color: #5f9a4e;
    box-shadow: 0 0 0 6px rgba(95, 154, 78, 0.18);
  }
  50% {
    border-color: #d9894b;
    box-shadow: 0 0 0 10px rgba(217, 137, 75, 0.12);
  }
  75% {
    border-color: #f2c94c;
    box-shadow: 0 0 0 6px rgba(242, 201, 76, 0.18);
  }
  100% {
    border-color: #2f6f8f;
    box-shadow: 0 0 0 0 rgba(47, 111, 143, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mrbies-logo-link {
    animation: none;
    border-color: #2f6f8f;
  }
}

@media (max-width: 760px) {
  .hero-top {
    flex-direction: column;
  }

  .hero-logos {
    margin-left: 0;
    justify-content: flex-start;
    width: 100%;
  }

  .hero-logos .logo-link img {
    height: 100px;
    max-width: min(200px, 46vw);
  }

  .hero-logos .techie-logo-link img {
    max-width: 100px;
  }
}

.hero {
  padding: 2.5rem 0 1rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.75rem);
  line-height: 1.05;
  margin: 0 0 0.75rem;
  color: var(--color-header);
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0 0 1.5rem;
  max-width: 38rem;
  font-size: 1.15rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--color-button);
  color: var(--color-button-text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover,
.btn:focus-visible {
  filter: brightness(1.05);
  color: var(--color-button-text);
  outline: 3px solid rgba(47, 111, 143, 0.25);
  outline-offset: 2px;
}

.btn-secondary {
  background: #fff;
  color: var(--color-header);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  color: var(--color-header);
}

.btn-danger {
  background: #8a3b2c;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 1rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin: 0 0 0.5rem;
  color: var(--color-header);
}

.lede {
  margin: 0 0 1.25rem;
  max-width: 40rem;
}

.flash {
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}

.flash-success {
  background: #e5f4ea;
  color: #21633a;
}

.flash-error {
  background: #fdecea;
  color: #8a3b2c;
}

.form {
  display: grid;
  gap: 1rem;
  max-width: 28rem;
}

.form-wide {
  max-width: 40rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="color"],
input[type="file"],
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--color-text);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.help {
  font-weight: 400;
  color: rgba(31, 42, 36, 0.7);
  font-size: 0.95rem;
}

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

.card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.card h2,
.card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-header);
  line-height: 1.25;
}

.card p {
  margin: 0;
  color: rgba(31, 42, 36, 0.75);
}

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

.media-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.media-item img,
.media-item video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dde5e0;
}

.media-item .caption {
  padding: 0.75rem 0.9rem 1rem;
}

.caption-edit {
  padding-bottom: 0.9rem;
}

.caption-form {
  display: grid;
  gap: 0.55rem;
}

.caption-form input[type="text"] {
  min-height: 2.5rem;
}

.caption-form .btn {
  justify-self: start;
  min-height: 2.4rem;
  padding: 0.45rem 0.95rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(31, 42, 36, 0.7);
}

.stack {
  display: grid;
  gap: 1rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}

.checkbox-row input {
  width: 1.15rem;
  height: 1.15rem;
}

.color-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 0.75rem;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    justify-content: flex-start;
    width: 100%;
  }

  .header-inner {
    flex-wrap: wrap;
  }
}

/* Family Recipes */
.recipe-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.recipe-filters {
  margin-bottom: 1.25rem;
}

.recipe-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.recipe-mine {
  align-self: end;
  min-height: 2.75rem;
}

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

.recipe-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease;
}

.recipe-card:hover,
.recipe-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(47, 111, 143, 0.35);
  outline: none;
  color: inherit;
}

.recipe-card-image,
.recipe-card-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dde5e0;
}

.recipe-card-placeholder {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  color: var(--color-header);
  font-size: 1.35rem;
}

.recipe-card-body {
  padding: 0.95rem 1rem 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.recipe-card-body h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-header);
  line-height: 1.2;
}

.recipe-card-category {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.recipe-card-meta {
  margin: 0;
  color: rgba(31, 42, 36, 0.72);
  font-size: 0.95rem;
}

.recipe-view-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.recipe-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0;
}

.recipe-facts li {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
}

.recipe-hero-image {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #f0f4f2;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.recipe-body {
  font-size: 1.08rem;
  white-space: normal;
}

.recipe-notes {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.recipe-notes h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-header);
}

.recipe-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.recipe-current-image {
  display: grid;
  gap: 0.65rem;
}

.recipe-current-image img {
  max-width: 280px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.comment-list {
  gap: 1rem;
}

.comment-item {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.comment-meta {
  margin: 0 0 0.35rem;
  color: rgba(31, 42, 36, 0.7);
  font-size: 0.92rem;
}

.cook-mode {
  background: #f7faf8;
  min-height: 100vh;
}

.cook-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
}

.cook-stage {
  width: min(820px, calc(100% - 2rem));
  margin: 1.25rem auto 3rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem 2rem;
  box-shadow: var(--shadow);
}

.cook-stage h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  margin: 0.2rem 0 0.5rem;
  color: var(--color-header);
}

.cook-byline {
  margin: 0 0 1rem;
  color: rgba(31, 42, 36, 0.7);
}

.cook-body {
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  line-height: 1.65;
}

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .flash,
  .no-print,
  .cook-toolbar,
  .recipe-view-top .inline-actions,
  #comments {
    display: none !important;
  }

  body,
  .cook-mode {
    background: #fff !important;
  }

  .cook-stage,
  .printable-recipe,
  .panel {
    box-shadow: none !important;
    border: 0 !important;
  }

  .cook-stage {
    width: 100%;
    margin: 0;
    padding: 0;
  }
}
