/* Comic Neue stands in on systems without Comic Sans (Linux, Android). */
@font-face {
  font-family: "Comic Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/comic-neue-400.woff2") format("woff2");
}

@font-face {
  font-family: "Comic Neue";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/comic-neue-700.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f4f1e8;
  --sheet: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --face: #e4e1d8;
  --light: #ffffff;
  --shade: #6b6b6b;
  --stamp: #e10600;
  --font: "Comic Sans MS", "Comic Sans", "Comic Neue", "Chalkboard SE", cursive;
}

* {
  box-sizing: border-box;
}

/* Always leave room for the scrollbar, so short pages like the wall line up
   with long ones like the home page instead of shifting sideways. */
html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(17, 17, 17, 0.09) 1px, transparent 1px);
  background-size: 14px 14px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
}

::selection {
  background: var(--stamp);
  color: #fff;
}

:focus-visible {
  outline: 3px dotted var(--ink);
  outline-offset: 3px;
}

/* Links in text: red with a red underline, black on hover, and the same
   once visited. Nav links drop the underline; the wavy red line only ever
   marks the current page. */
a,
a:visited {
  color: var(--stamp);
  text-decoration: underline 2px var(--stamp);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  background: #ffff99;
  color: var(--ink);
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

/* Plain font, chosen with the switch at the top of the page. */
:root[data-font="plain"] {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* The switch is "Aa" drawn in the font it will change to. Its name
   for screen readers stays "Plain font", pressed or not. */
.font-toggle {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 32px;
  padding: 0 6px;
  border: 2px solid var(--ink);
  background: var(--sheet);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.font-toggle[aria-pressed="true"] {
  font-family: "Comic Sans MS", "Comic Sans", "Comic Neue", "Chalkboard SE", cursive;
}

.font-toggle:hover {
  background: var(--note, #ffff99);
}

/* Masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 0 4px 18px;
}

.logo,
.logo:visited {
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  text-decoration: none;
}

.logo:hover {
  color: var(--stamp);
}

.masthead-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.nav-links {
  display: flex;
  gap: 6px 18px;
  font-size: 18px;
}

.nav-links a,
.nav-links a:visited {
  color: var(--ink);
  font-weight: 400;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--stamp);
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline wavy var(--stamp);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* Window */

.window,
.viewer {
  border: 2px solid var(--ink);
  background: var(--sheet);
  box-shadow: 2px 2px 0 var(--ink);
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px 8px 16px;
  background: var(--ink);
  color: #fff;
}

h1,
h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.tally {
  font-size: 15px;
}

.window-body {
  padding: 20px 20px 28px;
}

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.intro p {
  max-width: 60ch;
  margin: 0;
}

.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.wall-rules {
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: var(--note, #ffff99);
  font-size: 15px;
}

.note:empty {
  display: none;
}

/* Buttons: a raised face that presses in. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border: 2px solid;
  border-color: var(--light) var(--shade) var(--shade) var(--light);
  border-radius: 0;
  outline-color: var(--ink);
  background: var(--face);
  box-shadow: 0 0 0 1px var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: #edeae2;
}

.btn:active {
  border-color: var(--shade) var(--light) var(--light) var(--shade);
  background: #d8d5cc;
  padding-top: 2px;
}

.btn:disabled {
  color: #8a8a8a;
  cursor: default;
}

a.btn,
a.btn:visited {
  color: var(--ink);
  text-decoration: none;
}

.btn-primary,
a.btn-primary,
a.btn-primary:visited {
  border-color: #7d7d7d #000 #000 #7d7d7d;
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #333;
  color: #fff;
}

.btn-primary:active {
  border-color: #000 #7d7d7d #7d7d7d #000;
  background: #000;
}

.btn-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 14px;
}

/* Wall */

.wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 24px;
  margin-top: 24px;
}

.wall > .tile:first-child {
  grid-column: 1 / -1;
}

.tile {
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}

.tile:focus-visible {
  outline: none;
}

.tile:focus-visible .tile-frame {
  outline: 3px dotted var(--ink);
  outline-offset: 4px;
}

.tile-frame {
  display: block;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.tile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
}

.tile time {
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-top: 0;
  background: var(--sheet);
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) and (pointer: fine) {
  .tile:hover time {
    background: #ffff99;
    color: var(--ink);
  }
}

.tile-skeleton {
  aspect-ratio: 16 / 10;
  border: 2px dashed var(--shade);
  background: var(--paper);
  cursor: default;
}

.wall > .tile-skeleton:first-child {
  grid-column: auto;
}

.wall-message {
  grid-column: 1 / -1;
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 20px;
  border: 2px dashed var(--shade);
  background: var(--paper);
}

.wall-message p {
  margin: 0;
  max-width: 52ch;
}

::view-transition-group(*) {
  animation-duration: 320ms;
  animation-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
}

/* Footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 32px;
  padding: 14px 4px 0;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 15px;
}

.footer p {
  margin: 0;
}

/* Viewer */

.viewer {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--ink);
  overflow: auto;
}

.viewer::backdrop {
  background: rgba(17, 17, 17, 0.72);
}

.viewer-frame {
  margin: 0;
  padding: 16px 16px 0;
}

.viewer-frame img {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 200px);
  object-fit: contain;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.viewer-frame figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 10px;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover:not(:disabled) {
  color: var(--stamp);
}

.link-btn:disabled {
  cursor: default;
  text-decoration: none;
}

.link-btn[hidden] {
  display: none;
}

.report-done {
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.report-done[hidden],
.report-box[hidden] {
  display: none;
}

.report-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: var(--note, #ffff99);
}

.report-box p {
  margin: 0 0 8px;
  font-size: 16px;
}

.report-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.viewer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 16px;
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*) {
    animation: none;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 16px 12px 28px;
  }

  .window,
  .viewer {
    box-shadow: 2px 2px 0 var(--ink);
  }

  .window-body {
    padding: 14px 14px 20px;
  }

  .wall {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .hint {
    display: none;
  }

  .viewer {
    width: calc(100vw - 16px);
  }
}

.chrome-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

/* The stamp itself is the logo: same ring, bar and words as the mark on a page. */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  transform: rotate(-8deg);
}

/* Add to Chrome: in the header, and as a band at the bottom of the page. */
.btn-store.btn-small .chrome-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.install-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 28px;
  padding: 18px 20px;
  border: 2px solid var(--ink);
  background: var(--note, #ffff99);
  box-shadow: 2px 2px 0 var(--ink);
}

.install-band p {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

/* Phones can't add Chrome extensions, so say where it works. */
.install-band .mobile-note {
  display: none;
  flex-basis: 100%;
  font-size: 16px;
  font-weight: 400;
}

@media (hover: none) and (pointer: coarse) {
  .install-band .mobile-note {
    display: block;
  }
}

@media (max-width: 720px) {
  .install-band {
    box-shadow: 2px 2px 0 var(--ink);
  }

  .masthead-tools .btn-store {
    display: none;
  }
}
