:root {
  --limestone: #f7f7f2;
  --paper: #ffffff;
  --navy: #132c3a;
  --navy-soft: #40505a;
  --green: #176b52;
  --green-dark: #0d5841;
  --amber: #d99a3d;
  --border: #dde2da;
  --border-strong: #cbd3c9;
  --shadow: 0 10px 28px rgba(19, 44, 58, 0.08), 0 2px 7px rgba(19, 44, 58, 0.05);
  --radius: 16px;
  --content: 1180px;
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--limestone);
  color: var(--navy);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.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;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(247, 247, 242, 0.96);
}

.header-inner {
  width: min(100% - 64px, 1368px);
  min-height: 68px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1.9vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.header-link {
  position: relative;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.96rem;
  font-weight: 650;
  text-decoration: none;
}

.header-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 3px;
  background: var(--amber);
  transform-origin: left;
  transition: transform 180ms ease;
}

.header-link:hover::after {
  transform: scaleX(0.72);
}

.hero {
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: 1536px;
  min-height: 448px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 47%) minmax(0, 53%);
}

.hero-copy {
  padding: 64px 20px 64px 42px;
  padding-left: max(42px, calc((100vw - 1450px) / 2));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.hero h1 {
  max-width: 700px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 4.05vw, 4.2rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.048em;
}

.hero-copy > p {
  max-width: 620px;
  margin: 28px 0 0;
  color: var(--navy-soft);
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  line-height: 1.55;
}

.primary-button {
  min-height: 52px;
  margin-top: 28px;
  padding: 0 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 7px 16px rgba(23, 107, 82, 0.16);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(23, 107, 82, 0.2);
}

.hero-media {
  position: relative;
  min-width: 0;
  height: 448px;
  min-height: 448px;
  margin: 0;
  overflow: hidden;
  background: #dfe7df;
}

.hero-media img {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: cover;
  object-position: center 45%;
  opacity: 0;
  transition: opacity 360ms ease;
}

.hero-media img.is-loaded {
  opacity: 1;
}

.hero-media figcaption {
  position: absolute;
  right: 14px;
  bottom: 12px;
  max-width: calc(100% - 28px);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(19, 44, 58, 0.9);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.7rem;
  line-height: 1.35;
}

.hero-media figcaption a {
  color: white;
}

.directory {
  padding: 28px 0 48px;
}

.directory-inner {
  width: min(100% - 64px, var(--content));
  margin-inline: auto;
}

.directory-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.search-field {
  position: relative;
  min-width: 0;
}

.search-field > svg {
  position: absolute;
  top: 50%;
  left: 19px;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #72808a;
  stroke-width: 1.8;
  stroke-linecap: round;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 56px;
  padding: 0 54px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--navy);
  font-size: 0.98rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-field input::placeholder {
  color: #75818a;
  opacity: 1;
}

.search-field input:focus {
  border-color: var(--green);
  background: white;
  box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.13);
}

.clear-search {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--navy-soft);
  cursor: pointer;
}

.clear-search:hover {
  background: #eef1ec;
}

.clear-search svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.filters {
  display: flex;
  gap: 10px;
}

.filter-button {
  min-width: 102px;
  min-height: 52px;
  padding: 0 17px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.filter-button:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.filter-button.is-active {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.filter-check {
  width: 19px;
  height: 19px;
  padding: 3px;
  border-radius: 50%;
  display: none;
  fill: none;
  stroke: var(--green);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  background: white;
}

.filter-button.is-active .filter-check {
  display: block;
}

.results-count {
  margin: 24px 0 14px;
  color: #5d6971;
  font-size: 0.95rem;
  font-weight: 500;
}

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

.institute-card {
  min-width: 0;
  min-height: 276px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 58%);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.institute-card:hover {
  border-color: #c8d2c8;
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(19, 44, 58, 0.11), 0 3px 8px rgba(19, 44, 58, 0.05);
}

.institute-card[hidden] {
  display: none;
}

.card-media {
  min-width: 0;
  height: 100%;
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  background: #e7ebe4;
}

.card-media img {
  width: 100%;
  height: 100%;
  min-height: 236px;
  display: block;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 320ms ease, transform 210ms ease;
}

.card-media img.is-loaded {
  opacity: 1;
}

.institute-card:hover .card-media img {
  transform: scale(1.02);
}

.card-media figcaption {
  position: relative;
  z-index: 1;
  min-height: 34px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  background: #f1f3ee;
  color: #657178;
  font-size: 0.65rem;
  line-height: 1.25;
}

.card-media figcaption a {
  color: inherit;
}

.card-content {
  min-width: 0;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
}

.card-content h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 1.7vw, 1.62rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.institute-type,
.institute-location {
  margin: 13px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.institute-location {
  margin-top: 8px;
  color: var(--navy);
  font-weight: 500;
}

.institute-type svg,
.institute-location svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: var(--green);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.institute-summary {
  margin: 13px 0 0;
  color: #46555e;
  font-size: 0.84rem;
  line-height: 1.55;
}

.card-actions {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 18px;
}

.card-actions a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 0.79rem;
  font-weight: 750;
  text-decoration: none;
}

.card-actions a:last-child {
  color: #52616a;
}

.card-actions svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 170ms ease;
}

.card-actions a:hover {
  text-decoration: underline;
}

.card-actions a:hover svg {
  transform: translate(2px, -1px);
}

.empty-state {
  min-height: 340px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  align-content: center;
  padding: 44px 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
}

.empty-state > svg {
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
}

.empty-state h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.65rem;
}

.empty-state p {
  margin: 8px 0 20px;
  color: var(--navy-soft);
}

.empty-state button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.source-note {
  margin-top: 22px;
  padding: 18px 22px;
  border-left: 4px solid var(--amber);
  border-radius: 9px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f0f0e9;
  color: #394951;
  font-size: 0.82rem;
}

.source-mark {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1.5px solid var(--amber);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #945e11;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1;
}

.source-note p {
  margin: 0;
}

.source-note .rights-note {
  margin-top: 5px;
  color: #617078;
  font-size: 0.74rem;
}

.site-footer {
  background: var(--navy);
  color: white;
}

.footer-inner {
  width: min(100% - 64px, var(--content));
  min-height: 92px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-inner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.77rem;
}

.footer-inner .footer-brand {
  color: white;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.footer-inner > span {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.36);
}

.footer-inner > a {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.77rem;
}

@media (max-width: 1120px) {
  .directory-tools {
    grid-template-columns: 1fr;
  }

  .filters {
    overflow-x: auto;
    padding: 2px 2px 7px;
    scrollbar-width: thin;
  }

  .filter-button {
    flex: 0 0 auto;
  }

  .institute-card {
    grid-template-columns: 1fr;
  }

  .card-media {
    height: 240px;
  }

  .card-media img {
    min-height: 206px;
  }

  .card-content {
    min-height: 292px;
  }
}

@media (max-width: 840px) {
  .header-inner,
  .directory-inner,
  .footer-inner {
    width: min(100% - 40px, var(--content));
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 430px;
    padding: 68px 28px 62px;
  }

  .hero h1 {
    font-size: clamp(3rem, 10vw, 4.5rem);
  }

  .hero-media,
  .hero-media img {
    height: 410px;
    min-height: 410px;
  }

  .institute-grid {
    grid-template-columns: 1fr;
  }

  .institute-card {
    grid-template-columns: minmax(0, 42%) minmax(0, 58%);
  }

  .card-media {
    height: auto;
  }

  .card-media img {
    min-height: 236px;
  }

  .card-content {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .header-inner,
  .directory-inner,
  .footer-inner {
    width: min(100% - 28px, var(--content));
  }

  .header-inner {
    min-height: 64px;
    gap: 16px;
  }

  .brand {
    max-width: 180px;
    font-size: 1.12rem;
    line-height: 1.05;
  }

  .header-link {
    font-size: 0.82rem;
  }

  .hero-copy {
    min-height: 388px;
    padding: 58px 20px 50px;
  }

  .hero h1 {
    font-size: clamp(2.75rem, 13vw, 3.7rem);
    line-height: 0.98;
  }

  .hero-copy > p {
    margin-top: 22px;
    font-size: 1.02rem;
  }

  .primary-button {
    width: 100%;
    margin-top: 24px;
  }

  .hero-media,
  .hero-media img {
    height: 290px;
    min-height: 290px;
  }

  .directory {
    padding-top: 20px;
  }

  .directory-tools {
    gap: 12px;
  }

  .search-field input {
    height: 54px;
  }

  .filters {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .filter-button {
    min-height: 46px;
    min-width: auto;
  }

  .results-count {
    margin-top: 18px;
  }

  .institute-grid {
    gap: 14px;
  }

  .institute-card {
    grid-template-columns: 1fr;
  }

  .card-media {
    height: 250px;
  }

  .card-media img {
    min-height: 216px;
  }

  .card-content {
    padding: 22px 20px 18px;
  }

  .card-content h2 {
    font-size: 1.55rem;
  }

  .institute-summary {
    font-size: 0.89rem;
  }

  .card-actions a {
    min-height: 44px;
    font-size: 0.84rem;
  }

  .source-note {
    padding: 16px;
  }

  .footer-inner {
    min-height: 132px;
    padding-block: 26px;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .footer-inner > span {
    display: none;
  }

  .footer-inner > a {
    margin: 8px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .primary-button:hover,
  .filter-button:hover,
  .institute-card:hover,
  .institute-card:hover .card-media img,
  .card-actions a:hover svg {
    transform: none;
  }
}
