:root {
  color-scheme: light;
  font-family: system-ui, "PingFang HK", sans-serif;
  color: #172d24;
  background: #f6f5ee;
  --green: #245c47;
  --border: #d8dfd5;
  --muted: #4e6057;
  --serif: Georgia, "Songti TC", serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--green); }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 4px; }
.shell { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 21px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font: bold 22px var(--serif);
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}

.languages {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: #fff;
}

.languages button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 32px;
  background: transparent;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
}

.languages button[aria-pressed="true"] { background: var(--green); color: white; }

main { padding-bottom: 40px; }
h1, h2, p { margin: 0; }

h1 {
  margin-block: 36px 25px;
  font: 400 clamp(2.25rem, 5.2vw, 4.25rem)/1.08 var(--serif);
  letter-spacing: -.045em;
}

:lang(zh-HK) h1 { letter-spacing: 0; }
#status { color: var(--muted); }
#retry { margin-top: 12px; }

.specimen {
  display: grid;
  grid-template-columns: minmax(0, 1.68fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: white;
  box-shadow: 0 12px 40px #162a1f09;
}

.illustration {
  position: relative;
  display: grid;
  place-items: center;
  padding: 20px 24px 62px;
  min-height: 358px;
  border-right: 1px solid var(--border);
}

.illustration img {
  display: block;
  width: 100%;
  height: clamp(210px, 29vw, 342px);
  object-fit: contain;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 15px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: white;
  color: var(--green);
  font-size: .875rem;
  font-weight: 650;
}

.action:hover { background: #eef5eb; }
#enlarge { position: absolute; bottom: 16px; right: 16px; }

.field-notes {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(20px, 4vw, 44px);
  background: #f0f4ed;
}

.scientific { color: var(--green); font: italic 1.06rem/1.4 var(--serif); }

#fish-name {
  margin-block: 7px 10px;
  font: 400 clamp(1.9rem, 4.2vw, 3.5rem)/1.06 var(--serif);
  letter-spacing: -.035em;
}

#fish-name:lang(zh-HK) { letter-spacing: 0; }

.alternate {
  padding: 4px 9px;
  border-radius: 20px;
  background: #dfeadc;
  color: #244c39;
  font-size: .875rem;
}

.description { margin-block: 21px 0; color: #293e34; line-height: 1.65; }
.source { margin-top: 17px; font-size: .875rem; text-underline-offset: 3px; }

.collection { margin-top: 31px; }
.collection h2 { margin-bottom: 13px; font: 400 1.45rem var(--serif); }

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

.fish-card {
  display: grid;
  grid-template-rows: 76px auto;
  place-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: .9rem;
  font-weight: 600;
}

.fish-card:hover { border-color: #85a597; }

.fish-card[aria-pressed="true"] {
  border-color: var(--green);
  background: #e7f0e4;
  color: #1e4c38;
  box-shadow: inset 0 0 0 1px var(--green);
}

.fish-card img {
  width: 100%;
  height: 76px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

#viewer {
  width: min(96vw, 1080px);
  max-width: none;
  max-height: 94vh;
  padding: 16px;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 18px;
}

#viewer::backdrop { background: #102219bf; }

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.viewer-bar h2 { font: 400 1.5rem var(--serif); }
#full-image { display: block; width: 100%; max-height: 76vh; object-fit: contain; }

@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .masthead { padding-block: 14px; }
  h1 { margin-block: 24px 16px; }
  .specimen { grid-template-columns: 1fr; border-radius: 18px; }
  .illustration { min-height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 12px 56px; }
  .illustration img { height: min(55vw, 300px); }
  .description { margin-top: 14px; }
  .fish-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
