:root {
  --green: #203a2d;
  --green-soft: #3f5d49;
  --cream: #fbf7ee;
  --paper: #fffdf8;
  --gold: #b68b38;
  --red: #a34b2a;
  --ink: #20231f;
  --muted: #626a5d;
  --line: rgba(32, 58, 45, 0.18);
  --shadow: 0 18px 45px rgba(32, 35, 31, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.65;
}

[hidden] {
  display: none !important;
}

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

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--paper);
  padding: 10px 14px;
  z-index: 20;
}

.skip-link:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 247, 238, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-text {
  display: grid;
  gap: 3px;
  justify-items: center;
  min-width: 0;
  text-align: center;
  width: clamp(232px, 24vw, 304px);
}

.brand-text span {
  display: block;
  color: var(--green);
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 700;
  line-height: 1;
}

.brand-text small {
  display: block;
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  letter-spacing: 0.125em;
  line-height: 1;
  text-transform: uppercase;
  width: 100%;
}

.brand-text small::before {
  content: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  white-space: nowrap;
  text-transform: uppercase;
}

.site-nav a {
  border-radius: 4px;
  padding: 10px 9px;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus {
  background: #eadfc9;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--green);
  padding: 9px 12px;
  font: 700 13px Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}

.hero {
  position: relative;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(14, 27, 21, 0.74), rgba(14, 27, 21, 0.30), rgba(14, 27, 21, 0.10));
}

.hero-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  color: white;
}

.hero h1,
.section h2 {
  margin: 0;
  color: inherit;
  font-size: clamp(38px, 7vw, 86px);
  line-height: 0.95;
}

.subtitle {
  max-width: 900px;
  margin: 18px 0 24px;
  font-size: clamp(20px, 3vw, 31px);
  white-space: nowrap;
}

.merit-badge {
  width: 220px;
  margin: 0 0 26px;
  border: 8px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 12px 18px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

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

.button.secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--green);
}

.section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 86px 0;
}

.intro {
  max-width: 960px;
}

.section-copy p {
  margin: 0 0 18px;
}

.section h2 {
  color: var(--green);
  font-size: clamp(34px, 5vw, 58px);
}

.section h3 {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 27px;
  line-height: 1.15;
}

.dog-card {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dog-card p {
  margin: 0 0 8px;
}

.band {
  width: 100%;
  max-width: none;
  background: #efe6d4;
  border-block: 1px solid var(--line);
  padding-inline: max(16px, calc((100% - 1120px) / 2));
}

.section-heading {
  margin-bottom: 28px;
}

.announcement {
  max-width: 850px;
  background: var(--paper);
  border-left: 6px solid var(--gold);
  padding: 28px;
  box-shadow: var(--shadow);
}

.announcement p {
  margin: 0 0 14px;
}

.dog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.dog-card {
  display: flex;
  flex-direction: column;
}

.dog-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.dog-card div {
  padding: 18px;
}

.dog-role {
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.gallery-grid button {
  cursor: zoom-in;
  display: block;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 6px;
  color: var(--green);
  font: 700 12px Arial, Helvetica, sans-serif;
  text-align: center;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 6px solid var(--paper);
  box-shadow: 0 8px 18px rgba(32, 35, 31, 0.14);
}

.gallery-grid button:hover,
.gallery-grid button:focus,
.gallery-grid button.is-active {
  border-color: rgba(32, 58, 45, 0.4);
  background: rgba(255, 253, 248, 0.7);
}

.gallery-viewer {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.gallery-feature {
  margin: 0;
  min-width: 0;
  text-align: center;
}

.gallery-feature img {
  width: min(780px, 100%);
  max-height: 620px;
  margin: 0 auto;
  object-fit: contain;
  border: 8px solid var(--paper);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.gallery-feature figcaption,
.lightbox figcaption {
  margin-top: 12px;
  color: var(--green);
  font: 700 14px Arial, Helvetica, sans-serif;
  text-align: center;
}

.gallery-feature figcaption:empty,
.lightbox figcaption:empty {
  display: none;
}

.gallery-control,
.lightbox-nav {
  min-height: 44px;
  border: 1px solid rgba(32, 58, 45, 0.24);
  border-radius: 4px;
  background: var(--paper);
  color: var(--green);
  padding: 11px 14px;
  font: 700 12px Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}

.gallery-control {
  cursor: pointer;
}

.gallery-control:hover,
.gallery-control:focus {
  border-color: var(--red);
  color: var(--red);
}

.link-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.link-list a {
  display: flex;
  align-items: center;
  min-height: 74px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--green);
  padding: 16px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(32, 35, 31, 0.08);
}

.link-list a:hover,
.link-list a:focus {
  border-color: var(--gold);
}

.contact-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 44px;
  align-items: start;
}

.contact-copy p {
  margin: 0 0 13px;
}

.contact-copy span {
  color: var(--muted);
}

.contact-form {
  display: grid;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 24px;
  box-shadow: var(--shadow);
}

.contact-form label {
  display: grid;
  gap: 6px;
  color: var(--green);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid rgba(32, 58, 45, 0.28);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: 16px Arial, Helvetica, sans-serif;
  padding: 12px;
}

.application-callout,
.application-status,
.form-status,
.admin-status {
  color: var(--green);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.application-page h1 {
  margin: 0 0 18px;
  color: var(--green);
  font-size: clamp(38px, 6vw, 70px);
  line-height: 1;
}

.application-shell {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 44px;
  align-items: start;
}

.admin-page {
  background: #f2eee4;
  font-family: Arial, Helvetica, sans-serif;
}

.admin-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.admin-header h1 {
  margin: 0;
  color: var(--green);
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1;
}

.admin-label {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-card {
  display: grid;
  gap: 14px;
  align-content: start;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px;
  box-shadow: 0 12px 28px rgba(32, 35, 31, 0.08);
}

.admin-card.wide,
.auth-card,
.admin-actions {
  grid-column: 1 / -1;
}

.auth-card {
  margin-bottom: 18px;
}

.admin-card h2 {
  margin: 0;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1.1;
}

.admin-card p {
  margin: 0;
}

.admin-card label,
.repeat-row label,
.gallery-edit-row label,
.dog-edit-row label {
  display: grid;
  gap: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-card input,
.admin-card textarea {
  width: 100%;
  border: 1px solid rgba(32, 58, 45, 0.28);
  border-radius: 3px;
  background: white;
  color: var(--ink);
  font: 15px Arial, Helvetica, sans-serif;
  padding: 11px;
  text-transform: none;
}

.toggle-row {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.toggle-row input {
  width: 20px;
  height: 20px;
}

.repeat-editor,
.gallery-editor,
.dog-editor,
.submissions-list {
  display: grid;
  gap: 12px;
}

.repeat-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.35fr) minmax(0, 0.65fr);
  gap: 12px;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.editor-heading h2 {
  margin: 0;
}

.gallery-edit-row,
.dog-edit-row {
  display: grid;
  grid-template-columns: 120px minmax(160px, 0.34fr) minmax(0, 0.44fr) minmax(160px, 0.22fr);
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.dog-edit-row {
  grid-template-columns: 140px minmax(0, 1fr) minmax(180px, 0.25fr);
}

.editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.image-preview {
  width: 120px;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #efe6d4;
  border: 1px dashed rgba(32, 58, 45, 0.34);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.dog-edit-row .image-preview {
  width: 140px;
  aspect-ratio: 4 / 5;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-tools {
  display: grid;
  gap: 10px;
}

.image-picker input {
  padding: 8px;
}

.image-picker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
}

.submission-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.submission-item div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.submission-item p,
.submission-item span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-footer {
  background: var(--green);
  color: white;
  padding: 28px 16px;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(86px, 0.12fr) minmax(0, 1fr) minmax(86px, 0.12fr);
  align-items: center;
  gap: 16px;
  background: rgba(15, 22, 18, 0.86);
  padding: 54px 18px 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox figure {
  margin: 0;
  min-width: 0;
}

.lightbox img {
  max-height: 84vh;
  max-width: 100%;
  width: auto;
  margin: 0 auto;
  border: 8px solid var(--paper);
  box-shadow: var(--shadow);
}

.lightbox figcaption {
  color: white;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  background: var(--paper);
  color: var(--green);
  padding: 10px 14px;
  font: 700 13px Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .topbar {
    min-height: 74px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 74px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px;
  }

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

  .site-nav a {
    padding: 12px;
  }

  .hero {
    min-height: 560px;
  }

  .contact-section,
  .application-shell {
    grid-template-columns: 1fr;
  }

  .dog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-grid,
  .link-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-viewer,
  .lightbox {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-feature,
  .lightbox figure {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .gallery-prev,
  .lightbox-prev {
    grid-column: 1;
    grid-row: 2;
  }

  .gallery-next,
  .lightbox-next {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 760px) {
  .admin-header,
  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-grid,
  .repeat-row,
  .gallery-edit-row,
  .dog-edit-row,
  .editor-fields {
    grid-template-columns: 1fr;
  }

  .image-preview,
  .dog-edit-row .image-preview {
    width: 100%;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .brand-text span {
    font-size: 25px;
  }

  .brand-text {
    display: grid;
    gap: 4px;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .brand-text small {
    letter-spacing: 0.05em;
    max-width: 180px;
  }

  .brand-text small::before {
    content: none;
  }

  .hero {
    min-height: 540px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .subtitle {
    font-size: clamp(13px, 3.7vw, 21px);
  }

  .merit-badge {
    width: 190px;
  }

  .section {
    padding-block: 58px;
  }

  .dog-grid,
  .gallery-grid,
  .link-list {
    grid-template-columns: 1fr;
  }
}
