
:root {
  --paper: #f7f5f0;
  --putty: #e0dbd2;
  --beige: #c5c0b4;
  --ink: #2b2530;
  --screen-blue: #0d0da4;
  --slate: #56708f;
  --moss: #3e7119;
  --sprout: #88a660;
  --dandelion: #bfc041;
  --border: 2px solid var(--ink);
  --separator: 2px solid #fff;
  --crt:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 1 0 0 0 1.4 -0.45'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.10) 0 1px,
      rgba(0, 0, 0, 0.45) 1px 1px,
      rgba(0, 0, 0, 0) 2px 1px
    );
  --glow: 0 0 3px rgba(200, 200, 255, 0.6);
}

body {
  color: var(--ink);
  font-family: "BIZ UDGothic", "MS Gothic", monospace;
  font-size: 14px;
}

.window {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.title-bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  padding: 2px 6px 2px 10px;
  background: var(--screen-blue);
  color: var(--paper);
  border-bottom: var(--separator);
  font-size: 12px;
  text-shadow: var(--glow);
}

.window::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--crt);
  opacity: 0.15;
}

.window-controls {
  display: flex;
  gap: 3px;
}

.control-btn {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  text-decoration: none;
  text-shadow: none;
}

a.control-btn:hover,
a.control-btn:focus-visible {
  background: var(--dandelion);
  outline: none;
}

.btn-min::before,
.btn-max::before,
.btn-close::before,
.btn-close::after {
  content: "";
  background: currentColor;
}

.btn-min::before {
  width: 50%;
  height: 1px;
}

.btn-max::before {
  width: 50%;
  aspect-ratio: 1;
  background: none;
  border: 1px solid currentColor;
  border-top-width: 2px;
}

.btn-close::before,
.btn-close::after {
  grid-area: 1 / 1;
  width: 60%;
  height: 1px;
}

.btn-close::before {
  transform: rotate(45deg);
}

.btn-close::after {
  transform: rotate(-45deg);
}

.window-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
  background: linear-gradient(to bottom, var(--screen-blue), var(--paper));
  border-right: var(--separator);
}

.side-nav {
  display: flex;
  flex-direction: column;
}

.side-nav a {
  padding: 8px 8px;
  border-bottom: 1px dashed #fff;
  color: var(--paper);
  text-decoration: none;
}

.side-nav a.sub-link {
  padding-left: 22px;
  font-size: 12px;
}

/* Animating grid rows from 1fr to 0fr slides the links open/closed at their natural height. */
.sub-nav {
  display: grid;
  grid-template-rows: 1fr;
}

.sub-nav > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sub-nav.closed {
  grid-template-rows: 0fr;
}

.side-nav.ready .sub-nav {
  transition: grid-template-rows 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .side-nav.ready .sub-nav {
    transition: none;
  }
}

.side-nav a:hover,
.side-nav a:focus-visible,
.side-nav a[aria-current="page"] {
  background: var(--paper);
  color: var(--screen-blue);
  outline: none;
}

.mini-window {
  --ui-grey: #c0c0c0;
  --ui-grey-dark: #808080;
  padding: 3px;
  background: var(--ui-grey);
  border: 1px solid;
  border-color: #fff var(--ink) var(--ink) #fff;
  box-shadow: inset -1px -1px 0 var(--ui-grey-dark), inset 1px 1px 0 #dfdfdf;
}

.mini-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
  padding: 4px 4px 4px 7px;
  background: var(--ui-grey-dark);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.mini-controls {
  display: flex;
  gap: 3px;
}

.mini-controls span {
  box-sizing: border-box;
  width: 16px;
  height: 14px;
  display: grid;
  place-items: center;
  background: var(--ui-grey);
  color: var(--ink);
  border: 1px solid;
  border-color: #fff var(--ink) var(--ink) #fff;
}

.terminal {
  min-height: 72px;
  background: var(--ink);
  border: 1px solid;
  border-color: var(--ui-grey-dark) #fff #fff var(--ui-grey-dark);
  padding: 6px 8px 24px;
  color: var(--sprout);
  font-size: 12px;
  line-height: 1.5;
  text-shadow: 0 0 3px rgba(136, 166, 96, 0.6);
  word-break: break-word;
}

.terminal p {
  margin: 0;
}

.terminal .cursor {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal .cursor {
    animation: none;
  }
}

.image-window {
  flex: none;
  display: flex;
  flex-direction: column;
}

.image-frame {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid;
  border-color: var(--ui-grey-dark) #fff #fff var(--ui-grey-dark);
  line-height: 0;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.home-layout {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.home-left {
  flex-shrink: 0;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-window {
  display: block;
  width: 100%;
  border: 1px dotted var(--ink);
  box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.35);
}

.home-placeholders {
  flex: 1;
  min-width: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-placeholder {
  flex: 1;
  min-height: 100px;
  background: var(--paper);
  border: 1px dotted var(--ink);
  box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.35);
}

.home-placeholder p {
  margin: 0 0 10px;
  padding: 10px 12px 0;
  line-height: 1.5;
  text-align: center;
}

.home-placeholder p a {
  color: var(--screen-blue);
}

.home-placeholder p:last-child {
  margin-bottom: 0;
  padding-bottom: 10px;
}

/* Anchored by top: the layout's bottom moves with the speech bubble. */
#home-deco-gardner {
  position: absolute;
  left: -200px;
  top: 590px;
  width: 400px;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(3px 4px 10px rgba(0, 0, 0, 0.35));
}

.home-placeholder::before {
  content: "";
  display: block;
  height: 22px;
  background: var(--crt), var(--screen-blue);
  background-blend-mode: overlay;
}

.home-placeholder-welcome::before,
.home-placeholder-changelog::before {
  content: none;
}

.home-placeholder-speech {
  position: relative;
  flex: none;
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 400px;
  height: 75px;
  min-height: 0;
  text-align: center;
  border-radius: 24px;
  box-shadow: none;
  filter: drop-shadow(3px 4px 6px rgba(0, 0, 0, 0.35));
}

.home-placeholder-speech::before {
  content: none;
}

/* Tail: a rotated square with two dotted edges, so the outline follows it (a border-triangle can't). */
.home-placeholder-speech::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--paper);
  border-right: 1px dotted var(--ink);
  border-bottom: 1px dotted var(--ink);
  bottom: -13px;
  left: 26%;
  margin-left: -12px;
  transform: rotate(45deg);
}

.home-placeholder-butterflies::before {
  background: url("../images/divider-butterflies.gif") center no-repeat;
  background-size: auto 70%;
  position: relative;
  top: -11px;
  /* Bar straddles the top border and takes no layout space, so the text stays centered. */
  margin-bottom: -22px;
}

.home-placeholder-welcome h2,
.home-placeholder-changelog h2 {
  margin: 0;
  padding: 3px 0;
  background: var(--crt), var(--screen-blue);
  background-blend-mode: overlay;
  color: var(--paper);
  font-family: "Rubik Glitch", "Press Start 2P", cursive;
  font-size: 16px;
  font-weight: normal;
  text-align: center;
}

.home-placeholder-changelog {
  flex: none;
  min-height: 0;
}

.home-placeholder-currently {
  flex: none;
  min-height: 0;
}

.currently {
  margin: 0;
  padding: 18px 12px 10px;
  list-style: none;
  line-height: 1.5;
}

.currently li + li {
  margin-top: 10px;
}

.currently-label {
  display: block;
  color: var(--moss);
  font-size: 12px;
}

.currently a {
  color: var(--screen-blue);
}

/* Fixed at the height of the first three entries; more scroll inside. */
.changelog {
  box-sizing: border-box;
  height: 179px;
  overflow-y: auto;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  line-height: 1.5;
}

.changelog li + li {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--beige);
}

.changelog-date {
  display: block;
  color: var(--moss);
  font-size: 12px;
}

.adoptables,
.hatchery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  background: var(--paper);
  border: 1px solid;
  border-color: var(--ui-grey-dark) #fff #fff var(--ui-grey-dark);
}

.adoptables img,
.hatchery img {
  display: block;
  border: 0;
  image-rendering: pixelated;
}

.button-carousel {
  margin-top: auto;
}

.carousel-window {
  overflow: hidden;
  padding: 6px 0;
  background: var(--paper);
  border: 1px solid;
  border-color: var(--ui-grey-dark) #fff #fff var(--ui-grey-dark);
}

.carousel-track {
  display: flex;
  width: max-content;
  animation: carousel-scroll 25s linear infinite;
}

.carousel-window:hover .carousel-track {
  animation-play-state: paused;
}

.carousel-group {
  display: flex;
  gap: 8px;
  padding-right: 8px;
}

.carousel-group img {
  display: block;
  height: 31px;
  width: auto;
  flex-shrink: 0;
}

@keyframes carousel-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track {
    animation: none;
  }

  .carousel-window {
    overflow-x: auto;
  }
}

.main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tab-bar {
  display: flex;
  flex-shrink: 0;
  overflow-x: auto;
  background: var(--putty);
  border-bottom: var(--separator);
}

.tab-bar a {
  padding: 8px 16px;
  border-right: var(--separator);
  background: var(--beige);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.tab-bar a:hover,
.tab-bar a:focus-visible,
.tab-bar a[aria-current="page"] {
  background: var(--screen-blue);
  color: var(--paper);
  text-shadow: var(--glow);
  outline: none;
}

/* overflow: hidden keeps this flex item from growing to .panel-scroll's full height. */
.content {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow: hidden;
  background: var(--paper) url("../images/grid-tile.png") repeat 0 0 / 240px 240px local;
}

/* border-box: otherwise height: 100% plus padding overflows .content and gets clipped. */
.panel-scroll {
  box-sizing: border-box;
  height: 100%;
  overflow-y: auto;
  /* Reserve the scrollbar's space so content doesn't shift sideways when it appears/disappears. */
  scrollbar-gutter: stable;
  padding: 24px 24px 16px;
}

.content-panel {
  max-width: 900px;
  margin: 0 auto;
  /* Matches .panel-scroll's top padding, so the browser's jump to #section on load doesn't scroll past it. */
  scroll-margin-top: 24px;
}

/* Needed: the :not([hidden]) display rules below would otherwise override [hidden]. */
.content-panel[hidden] {
  display: none;
}

.content-panel:not([hidden]):has(> .under-construction, > .commonplace-board) {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
}

.commonplace-board {
  display: flex;
  align-items: center;
  gap: 24px;
}

.commonplace-board img {
  display: block;
  filter: drop-shadow(3px 4px 10px rgba(0, 0, 0, 0.35));
  transition: transform 0.15s ease;
}

.commonplace-board a:hover img,
.commonplace-board a:focus-visible img {
  transform: scale(1.06);
}

.commonplace-board a:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .commonplace-board img {
    transition: none;
  }
}

.commonplace-pin {
  width: 130px;
}

.commonplace-osprey {
  width: 240px;
}

.under-construction {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: var(--screen-blue);
}

.content p {
  line-height: 1.6;
}

.readme {
  margin-bottom: 12px;
}

.readme-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.readme-row > .mini-window {
  display: flex;
  flex-direction: column;
}

.readme-row .readme {
  flex: 1;
  margin-bottom: 0;
}

.readme-row > .mini-window > :last-child {
  flex: 1;
}

.readme-body {
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  font-size: 13px;
  line-height: 1.6;
}

.readme-body p,
.readme-body ul {
  margin: 0 0 8px;
}

.readme-body > :last-child {
  margin-bottom: 0;
}

.readme-body ul {
  padding-left: 0;
  list-style: none;
}

.readme-body li::before {
  content: "- ";
}

.readme-body a {
  color: var(--screen-blue);
}

.sitemap-tree {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
}

.bird-photo-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.bird-photo-button:focus-visible {
  outline: 2px solid var(--dandelion);
  outline-offset: -2px;
}

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgba(13, 13, 164, 0.55);
}

.lightbox-close {
  box-sizing: border-box;
  width: 16px;
  height: 14px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--ui-grey);
  color: var(--ink);
  border: 1px solid;
  border-color: #fff var(--ink) var(--ink) #fff;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--dandelion);
  outline: none;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 2px 10px;
  background: var(--putty);
  border-top: var(--separator);
  font-size: 13px;
}
