:root {
  --ink: #20332d;
  --muted: #64736d;
  --paper: #f4f1e9;
  --card: #fffdf7;
  --accent: #f3d978;
  --accent-strong: #d7af2d;
  --button-bg: #f7eed1;
  --line: #d8ddd4; }

* {
  box-sizing: border-box; }

.intro {
  max-width: 680px;
  margin-bottom: 30px; }

.eyebrow {
  margin: 0 0 8px;
  color: #7b8b22;
  font: 700 0.78rem/1.2 Verdana, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase; }

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: .96; }

.intro p {
  margin: 16px 0 0;
  color: var(--muted);
  font: 1.05rem/1.55 Verdana, sans-serif; }

.group-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px; }

.group-filter button {
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  font: 700 .9rem/1.2 Verdana, sans-serif;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease; }

.group-filter button:hover {
  border-color: var(--accent-strong);
  background: var(--button-bg); }

.group-filter button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff; }

.group-filter button:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px; }

.gallery {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 36px 28px; }

.teacher-card {
  position: relative;
  min-width: 0;
  overflow: visible;
  transition: transform .2s ease, box-shadow .2s ease;
  height: auto;
  padding-bottom: 16px; }

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

.teacher-card:hover, .teacher-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(32, 51, 45, 0.15); }

.portrait-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: visible;
  margin-bottom: 28px;
  background: transparent;
  padding: 16px; }

.portrait {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.1rem;
  -webkit-mask-image: radial-gradient(circle at 100% 100%, transparent 0 42px, #000 42px);
  mask-image: radial-gradient(circle at 100% 100%, transparent 0 42px, #000 42px); }

.info-button {
  position: absolute;
  left: calc(100% - 24px);
  top: calc(100% - 24px);
  z-index: 0;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--button-bg);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(32, 51, 45, 0.2);
  transform: translate(-50%, -50%);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }

.info-button:hover, .info-button:focus-visible {
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(32, 51, 45, 0.18);
  transform: translate(-50%, -50%) scale(1.08); }

.info-button img {
  width: 44px;
  height: 52px;
  object-fit: contain; }

.teacher-caption {
  padding: 13px 0 0;
  background: transparent; }

.teacher-name {
  margin: 0;
  padding: 0;
  font-size: 1.12rem;
  line-height: 1.15;
  text-align: center; }

.teacher-details {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  color: var(--muted);
  font: .83rem/1.35 Verdana, sans-serif;
  text-align: center; }

.teacher-details span, .teacher-details a {
  overflow-wrap: anywhere; }

.teacher-details a {
  color: inherit; }

.modal[hidden] {
  display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(26, 39, 34, 0.72); }

.modal-dialog {
  position: relative;
  width: min(900px, 100%);
  max-height: min(720px, 94vh);
  overflow: auto;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer; }

.modal-content {
  min-height: 260px;
  padding: 46px 32px 32px; }

.modal-content h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2vw, 2.5rem); }

.modal-content p {
  max-width: 620px;
  color: var(--muted);
  font: 0.8rem/1.6 Verdana, sans-serif; }

.modal-frame {
  display: block;
  width: 100%;
  height: min(72vh, 650px);
  border: 0; }

.teacher-info-layout {
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: start; }

.teacher-info-layout.no-photo {
  grid-template-columns: minmax(0, 1fr); }

.teacher-info-image-wrap {
  width: 100%;
  min-height: 180px; }

.teacher-info-image {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 1.1rem;
  background: #f0f1ee;
  box-shadow: 0 10px 24px rgba(32, 51, 45, 0.12); }

.teacher-info-body {
  min-width: 0; }

.teacher-info-role,
.teacher-info-subjects {
  margin: 0 0 10px; }

.teacher-info-list {
  display: grid;
  gap: 8px;
  margin-top: 16px; }

.teacher-info-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font: 0.95rem/1.5 Verdana, sans-serif; }

.teacher-info-label {
  align-self: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8em;
  white-space: nowrap; }

.teacher-info-value {
  overflow-wrap: anywhere; }

body.modal-open {
  overflow: hidden; }

@media (max-width: 640px) {
  .teacher-info-layout {
    grid-template-columns: 1fr; }
  .teacher-info-row-email {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px; }
  .teacher-info-row-email .teacher-info-value {
    font-size: .8em; }
  .teacher-info-body {
    order: 1; }
  .teacher-info-image-wrap {
    order: 2;
    max-width: 260px;
    width: 100%;
    margin: 0 auto; } }

@media (max-width: 700px) {
  .gallery {
    grid-template-columns: 1fr; } }

@media (max-width: 480px) {
  main {
    width: calc(100% - 20px); }
  .gallery {
    gap: 0 18px; }
  .portrait-wrap {
    margin-bottom: 23px; }
  .teacher-caption {
    padding-top: 10px; }
  .teacher-name {
    font-size: .98rem; }
  .teacher-details {
    font-size: .72rem; }
  .info-button {
    width: 46px;
    height: 46px; }
  .info-button img {
    width: 37px;
    height: 44px; }
  .modal-content {
    padding: 42px 20px 24px; } }
