@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Nunito:wght@500;600;700;800&display=swap');

:root {
  --ink: #173f35;
  --ink-soft: #45665d;
  --paper: #fffaf0;
  --white: #ffffff;
  --sun: #ffd166;
  --orange: #f07b3f;
  --mint: #dff3df;
  --blue: #d8eff8;
  --pink: #f9d7dc;
  --line: #173f3522;
  --shadow: 0 12px 35px #173f3517;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 16px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 4px solid #3e8cb6; outline-offset: 3px; }
.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; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; background: var(--ink); color: white; padding: 12px 18px; border-radius: 10px; }
.skip-link:focus { top: 16px; }

.site-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-family: "Baloo 2"; font-size: 1.5rem; font-weight: 800; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; background: var(--sun); border-radius: 13px 13px 15px 15px; transform: rotate(-3deg); font-size: 1.15rem; }
.brand-mark.small { width: 32px; height: 32px; font-size: .9rem; }
nav { display: flex; gap: 5px; background: #fff; border: 1px solid var(--line); padding: 5px; border-radius: 999px; }
.nav-button { border: 0; background: transparent; border-radius: 999px; padding: 9px 18px; font-weight: 800; cursor: pointer; }
.nav-button.active { background: var(--ink); color: white; }
main { min-height: calc(100vh - 170px); }
.view { max-width: 1240px; margin: 0 auto; padding: 20px 28px 80px; }
.hero { min-height: 270px; display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 45px 48px; border-radius: 32px; background: var(--mint); position: relative; overflow: hidden; }
.hero::after { content: "🐕"; position: absolute; right: 12%; top: -36px; font-size: 10rem; opacity: .12; transform: rotate(-10deg); }
.hero-copy { max-width: 680px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 8px; font-weight: 900; letter-spacing: .14em; font-size: .78rem; color: #1f715b; }
h1, h2, h3 { font-family: "Baloo 2", system-ui, sans-serif; line-height: 1.04; }
h1 { font-size: clamp(2.75rem, 6vw, 5rem); margin: 0 0 12px; letter-spacing: -.04em; }
.hero p:not(.eyebrow) { max-width: 620px; font-size: 1.16rem; line-height: 1.55; margin: 0; }
.surprise-button, .primary-button { border: 0; background: var(--sun); padding: 15px 22px; border-radius: 16px; font-weight: 900; cursor: pointer; box-shadow: 0 5px 0 #d9a82e; transition: transform .18s; white-space: nowrap; position: relative; z-index: 1; }
.surprise-button:hover, .primary-button:hover { transform: translateY(-2px) rotate(-1deg); }
.toolbar { display: flex; justify-content: space-between; gap: 18px; margin: 30px 0 20px; }
.search-box { flex: 1; max-width: 470px; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: white; border: 2px solid var(--line); border-radius: 16px; }
.search-box span { font-size: 1.5rem; font-weight: 900; }
.search-box input { width: 100%; min-height: 51px; border: 0; background: transparent; color: var(--ink); outline: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { border: 2px solid var(--line); background: white; border-radius: 999px; padding: 10px 16px; font-weight: 800; cursor: pointer; }
.filter.active { background: var(--ink); color: white; border-color: var(--ink); }
.select-box, .filters select { border: 2px solid var(--line); background: white; border-radius: 999px; padding: 10px 34px 10px 16px; min-height: 44px; font-weight: 800; color: var(--ink); cursor: pointer; }
.alphabet { display: flex; gap: 5px; overflow-x: auto; padding: 2px 2px 18px; scrollbar-width: thin; }
.letter { flex: 0 0 auto; min-width: 34px; height: 34px; padding: 0 7px; border: 1px solid var(--line); border-radius: 10px; background: white; font-weight: 900; cursor: pointer; }
.letter:first-child { padding: 0 13px; }
.letter.active { background: var(--orange); border-color: var(--orange); color: white; }
.results-row { display: flex; justify-content: space-between; color: var(--ink-soft); margin: 0 2px 14px; }
.results-row p { margin: 0; }
.photo-credit { font-size: .82rem; }
.dog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.dog-card { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .18s, box-shadow .18s; }
.dog-card:hover { transform: translateY(-5px); box-shadow: 0 18px 40px #173f3524; }
.dog-image-wrap { aspect-ratio: 4 / 3; overflow: hidden; background: var(--blue); position: relative; }
.dog-image { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; transition: transform .35s; }
.photo-missing { width: 100%; height: 100%; min-height: inherit; display: grid; place-items: center; align-content: center; gap: 7px; background: linear-gradient(135deg, var(--blue), var(--mint)); color: var(--ink-soft); }
.photo-missing span { font-size: 3rem; }
.photo-missing small { font-weight: 900; }
.dog-card:hover .dog-image { transform: scale(1.035); }
.origin-pill { position: absolute; left: 14px; top: 14px; background: #fffef8e8; backdrop-filter: blur(6px); border-radius: 999px; padding: 7px 11px; font-size: .78rem; font-weight: 900; }
.dog-card-body { padding: 18px; }
.name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dog-card h2 { margin: 0 0 4px; font-size: 1.55rem; }
.pronunciation-button { flex: none; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #b9d8ce; border-radius: 999px; background: #edf8f4; color: #17634f; padding: 7px 10px; font: inherit; font-size: .73rem; font-weight: 900; cursor: pointer; transition: transform .18s, background .18s; }
.pronunciation-button:hover { transform: translateY(-1px); background: #dff2eb; }
.pronunciation-button.speaking { animation: sound-pulse .7s ease-in-out infinite alternate; background: var(--sun); }
@keyframes sound-pulse { to { transform: scale(1.05); } }
.dog-tagline { margin: 0 0 16px; color: var(--ink-soft); min-height: 44px; line-height: 1.4; }
.quick-facts { display: flex; gap: 8px; flex-wrap: wrap; }
.fact-pill { background: var(--paper); padding: 7px 9px; border-radius: 10px; font-size: .78rem; font-weight: 800; }
.open-hint { margin: 16px 0 0; display: flex; justify-content: space-between; font-weight: 900; color: #17634f; font-size: .88rem; }
.empty-state { text-align: center; padding: 70px 20px; background: white; border-radius: 24px; }
.empty-state span { font-size: 4rem; }
.loading-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; background: white; border-radius: 24px; color: var(--ink-soft); }
.loading-state span { font-size: 4rem; animation: paw-bounce 1.2s ease-in-out infinite; }
.loading-state p, .loading-state h2 { margin: 0; }
.load-more { display: block; margin: 0 auto; }
.load-more[hidden] { display: none; }
@keyframes paw-bounce { 50% { transform: translateY(-9px) rotate(-6deg); } }

dialog { width: min(1050px, calc(100% - 28px)); max-height: 92vh; padding: 0; border: 0; border-radius: 28px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 80px #102e28aa; overflow: auto; }
dialog::backdrop { background: #102e28b3; backdrop-filter: blur(4px); }
.dialog-close { position: fixed; z-index: 10; margin: 16px 0 0 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: white; font-size: 1.8rem; cursor: pointer; box-shadow: var(--shadow); }
.passport-hero { display: grid; grid-template-columns: 1.15fr .85fr; min-height: 410px; }
.passport-primary { width: 100%; height: 100%; min-height: 410px; object-fit: cover; background: var(--blue); }
.passport-intro { padding: 42px; display: flex; flex-direction: column; justify-content: center; }
.passport-intro h2 { font-size: clamp(2.7rem, 5vw, 4.6rem); margin: 0 0 8px; }
.passport-pronunciation { align-self: flex-start; margin: 0 0 18px; font-size: .83rem; padding: 8px 12px; }
.passport-intro .tagline { font-size: 1.1rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 24px; }
.passport-label { display: inline-flex; align-self: flex-start; background: var(--sun); padding: 7px 12px; border-radius: 999px; font-weight: 900; font-size: .75rem; letter-spacing: .09em; }
.passport-body { padding: 38px 42px 48px; }
.fact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 34px; }
.fact-box { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 15px; }
.fact-box span { display: block; color: var(--ink-soft); font-size: .76rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 4px; }
.fact-box strong { font-family: "Baloo 2"; font-size: 1.12rem; }
.details-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-panel { border-radius: 20px; padding: 24px; background: var(--mint); }
.detail-panel:nth-child(2) { background: var(--blue); }
.detail-panel h3 { margin: 0 0 9px; font-size: 1.35rem; }
.detail-panel p { margin: 0; line-height: 1.58; }
.gallery-heading { display: flex; align-items: end; justify-content: space-between; margin: 34px 0 14px; }
.gallery-heading h3 { margin: 0; font-size: 1.55rem; }
.gallery-heading p { margin: 0; color: var(--ink-soft); font-size: .85rem; }
.photo-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.photo-gallery button { border: 0; padding: 0; border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--blue); aspect-ratio: 1; }
.photo-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.source-note, .learn-more, .also-known { margin-top: 18px; color: var(--ink-soft); font-size: .88rem; line-height: 1.55; }
.source-note a, .learn-more a { color: #17634f; font-weight: 800; }

.quiz-view { display: grid; place-items: center; min-height: calc(100vh - 170px); }
.quiz-panel { width: min(750px, 100%); background: white; border-radius: 30px; padding: 42px; box-shadow: var(--shadow); }
.quiz-start, .quiz-result { text-align: center; }
.quiz-mascot { display: block; font-size: 5rem; margin-bottom: 8px; }
.quiz-panel h1 { font-size: clamp(2.5rem, 6vw, 4.3rem); }
.quiz-panel > p { line-height: 1.55; color: var(--ink-soft); font-size: 1.08rem; }
.primary-button { margin-top: 18px; }
.quiz-progress-row { display: flex; justify-content: space-between; font-weight: 900; font-size: .9rem; }
.progress-track { height: 10px; background: #e7eee9; border-radius: 10px; margin: 12px 0 30px; overflow: hidden; }
#progress-bar { height: 100%; width: 20%; background: var(--orange); transition: width .25s; }
.quiz-question h2 { font-size: 2rem; margin: 0 0 20px; }
.quiz-dog-photo { width: 100%; height: 240px; object-fit: cover; border-radius: 18px; margin-bottom: 24px; background: var(--blue); }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quiz-option { text-align: left; border: 2px solid var(--line); background: var(--paper); padding: 16px; border-radius: 15px; font-weight: 900; cursor: pointer; }
.quiz-option:hover { border-color: var(--orange); }
.quiz-option.correct { background: var(--mint); border-color: #469e70; }
.quiz-option.wrong { background: var(--pink); border-color: #cc6877; }
.quiz-feedback { margin-top: 18px; padding: 15px 18px; background: var(--blue); border-radius: 15px; line-height: 1.5; }
.next-button { margin-top: 14px; border: 0; border-radius: 12px; background: var(--ink); color: white; padding: 12px 18px; font-weight: 900; cursor: pointer; }
.score-ring { width: 135px; height: 135px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: var(--sun); font-family: "Baloo 2"; font-size: 2rem; font-weight: 900; border: 8px solid #fff1bd; }
footer { max-width: 1240px; margin: 0 auto; border-top: 1px solid var(--line); padding: 28px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); }
footer div { display: flex; align-items: center; gap: 9px; color: var(--ink); }

@media (max-width: 900px) {
  .dog-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 36px; }
  .toolbar { flex-direction: column; }
  .search-box { max-width: none; }
  .passport-hero { grid-template-columns: 1fr; }
  .passport-primary { min-height: 340px; max-height: 460px; }
  .fact-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .site-header { height: auto; padding: 16px 18px; }
  .brand { font-size: 1.1rem; }
  .brand-mark { width: 34px; height: 34px; }
  .nav-button { padding: 8px 12px; }
  .view { padding: 10px 16px 55px; }
  .hero { min-height: 360px; align-items: flex-start; flex-direction: column; padding: 30px 24px; }
  .hero::after { right: -20px; top: 90px; }
  .surprise-button { margin-top: auto; }
  .dog-grid { grid-template-columns: 1fr; }
  .results-row { align-items: flex-start; gap: 6px; flex-direction: column; }
  .passport-intro, .passport-body { padding: 28px 22px; }
  .details-columns { grid-template-columns: 1fr; }
  .photo-gallery { grid-template-columns: repeat(2, 1fr); }
  .quiz-panel { padding: 28px 20px; }
  .quiz-options { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
