@font-face {
  font-family: "Obcoro Pixel";
  src: url("/assets/fusion-pixel-12px-monospaced-zh_tw.ttf.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #030909;
  --panel: #040B09F7;
  --ink: #70F995;
  --bright: #9AFFB1;
  --muted: #599D72;
  --description: #78AA8B;
  --line: #2A6940;
  --control-line: #385744;
  --control-fill: #0a1510;
  --hover: #12271b;
  --pressed: #1b3626;
}

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

body {
  --gutter: clamp(1.125rem, 4vw, 3rem);
  --top-gap: 3rem;
  display: flex;
  flex-direction: column;
  max-width: 66rem;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(var(--top-gap) + env(safe-area-inset-top, 0px))
           calc(var(--gutter) + env(safe-area-inset-right, 0px))
           calc(1.5rem + env(safe-area-inset-bottom, 0px))
           calc(var(--gutter) + env(safe-area-inset-left, 0px));
  background: var(--background);
  color: var(--ink);
  font: 400 16px/1.5 "Obcoro Pixel", monospace;
  font-synthesis: none;
}

main {
  min-width: 0;
}

.masthead {
  display: grid;
  grid-template-columns: auto auto minmax(1rem, 1fr);
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  margin-bottom: 2rem;
}

.eyebrow {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.14em;
}

.masthead h1 {
  margin: 0;
  color: var(--bright);
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.065em;
}

.masthead::after {
  content: "";
  align-self: center;
  height: 0.5rem;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.masthead p {
  margin: 0;
  color: var(--muted);
  font-size: 1.125rem;
}

a {
  color: var(--ink);
  border: 1px solid var(--control-line);
  background: var(--control-fill);
  text-decoration: none;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}

@media (hover: hover) {
  a:hover {
    border-color: var(--muted);
    background: var(--hover);
    color: var(--bright);
  }
}

a:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--bright);
  outline-offset: 3px;
  background: var(--hover);
  color: var(--bright);
}

a:active {
  border-color: var(--ink);
  background: var(--pressed);
  color: var(--bright);
  transition-duration: 0s;
}

footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 2.25rem;
  color: var(--muted);
  font-size: 1rem;
}

footer::after {
  content: "";
  grid-column: 2;
  grid-row: 1;
  border-top: 1px solid var(--line);
}

footer .footer-actions,
footer .ob-display-dock,
footer > .ob-back {
  grid-column: 3;
  grid-row: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
}


@media (max-width: 40rem) {
  body {
    --top-gap: 1.75rem;
  }

  .masthead {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.375rem 1rem;
    margin-bottom: 1.25rem;
  }

  .masthead::after {
    grid-column: 2;
    grid-row: 2;
  }

  .masthead h1 {
    font-size: 2.25rem;
  }

  .masthead p {
    grid-column: 1 / -1;
    font-size: 1rem;
  }

  footer {
    grid-template-columns: auto 1fr;
    margin-top: 1.5rem;
  }

  footer .ob-display-dock,
  footer > a {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: space-between;
  }
}

.catalog {
  /* The inset fill leaves a continuous 1px edge across both cut corners. */
  position: relative;
  isolation: isolate;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px),
                     calc(100% - 7px) 100%, 0 100%, 0 7px);
  background: var(--line);
  --inset: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3125rem;
  margin: 0;
  padding: 0.4375rem;
  list-style: none;
}

.catalog::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  clip-path: inherit;
  background: var(--panel);
  pointer-events: none;
}

.catalog > li {
  min-width: 0;
}

@media (min-width: 44.001rem) {
  .catalog > li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

.entry {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.25rem;
  height: 100%;
  min-height: 5.25rem;
  padding: 0.625rem calc(var(--inset) - 0.4375rem);
}

.entry-name {
  font-size: 1.5rem;
  line-height: 1.25;
}

.entry-intro {
  color: var(--description);
  font-size: 1.125rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.entry:focus-visible {
  outline-offset: -3px;
}

.entry:active .entry-intro {
  color: var(--bright);
}

@media (max-width: 44rem) {
  .catalog {
    --inset: 1.25rem;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .entry {
    min-height: 4.75rem;
    padding-block: 0.5rem;
  }

  .entry-intro {
    font-size: 1rem;
    text-wrap: pretty;
  }
}

@media (prefers-reduced-motion: reduce) {
  a {
    transition: none;
  }
}
