* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: #ffffff;
  color: #000000;
  font-family: 'Courier New', ui-monospace, monospace;
  line-height: 1.5;
}

/* ---- Hero (today / single day page): the pixelated image, large and centered ---- */

.hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Scaled to fill most of the viewport on its longer axis, never
   cropped or stretched -- object-fit: cover previously forced the
   square image to fill the whole (usually non-square) screen, which
   cropped it and made it look zoomed in. image-rendering: pixelated
   keeps the blocks crisp whether the image is scaled up or down. */
.hero-image {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.brand-label {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  background: #ffffff;
  border: 2px solid #000000;
  padding: 0.6rem 0.9rem;
}

.brand-text {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 1.5rem;
  color: #000000;
  text-decoration: none;
  letter-spacing: 0.05em;
}

.hero-actions {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Mirrors .hero-actions -- same bottom offset, opposite side. */
.hero-actions-left {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.pixel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: fit-content;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.65rem;
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.pixel-btn:hover,
.pixel-btn:focus-visible {
  background: #000000;
  color: #ffffff;
}

.share-icon {
  width: 0.9em;
  height: 0.9em;
  flex-shrink: 0;
  shape-rendering: crispEdges;
}

.pixel-btn:hover .share-icon rect,
.pixel-btn:focus-visible .share-icon rect {
  fill: #ffffff;
}

.empty-state {
  padding: 2rem;
  font-family: 'Courier New', ui-monospace, monospace;
}

/* ---- "Why this image?" modal ---- */

.why-modal {
  position: fixed;
  margin: auto;
  max-width: 520px;
  width: min(90vw, 520px);
  max-height: 80vh;
  overflow-y: auto;
  border: 3px solid #000000;
  padding: 1.5rem;
  background: #ffffff;
  color: #000000;
}

.why-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.why-modal h2 {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.9rem;
  margin: 0 1.5rem 1rem 0;
}

.why-modal h3 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem;
}

.emotion-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.8rem;
  text-transform: capitalize;
  color: #444444;
}

.emotion-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border: 1px solid #000000;
  flex-shrink: 0;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: #000000;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* showModal() auto-focuses this button (it's the dialog's first
   interactive element); keep a visible indicator for keyboard users
   without the browser's default blue ring showing on mouse/touch. */
.modal-close:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

.explanation {
  margin: 0;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.fallback-note {
  font-size: 0.85rem;
  font-style: italic;
  color: #444444;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.headlines-list {
  padding-left: 1.2rem;
  margin: 0;
}

.headlines-list li {
  margin-bottom: 0.5rem;
}

.headlines-list a {
  color: #000000;
}

.share-preview {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1rem;
  border: 2px solid #000000;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.share-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

/* ---- Archive page ---- */

.archive-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.archive-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.brand-label-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 1.1rem;
  color: #000000;
  text-decoration: none;
  border: 2px solid #000000;
  padding: 0.4rem 0.6rem;
}

.archive-header h1 {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 1rem;
  margin: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: #000000;
  font-size: 0.75rem;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  border: 1px solid #000000;
}

@media (max-width: 480px) {
  .brand-text { font-size: 1.1rem; }
  .pixel-btn { font-size: 0.55rem; padding: 0.5rem 0.6rem; }
}
