/* Street Level: a journal of everyday city life.
   Palette: terracotta + slate. One theme, one accent, one radius system. */

@font-face {
  font-family: 'Literata';
  src: url('assets/literata.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Work Sans';
  src: url('assets/work-sans.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('assets/ibm-plex-mono.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1b1f23;
  --ink-soft: #3a4046;
  --slate: #4d545c;
  --paper: #eef0ec;
  --paper-raised: #ffffff;
  --hairline: #d7dad3;
  --accent: #b23a1e;
  --accent-dark: #8f2e17;
  --accent-light: #e2734f;
  --accent-wash: #f3e2dc;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --font-serif: 'Literata', Georgia, 'Times New Roman', serif;
  --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --content-width: 1220px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

.icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  fill: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 100;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- Masthead ---------- */

.masthead {
  background: var(--ink);
  color: var(--paper);
  padding: 2.25rem 1.5rem 2rem;
}

.masthead__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.masthead__kicker {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
}

.masthead__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  letter-spacing: -0.01em;
  line-height: 1;
}

.masthead__intro {
  margin: 0;
  max-width: 30ch;
  font-size: 1.02rem;
  color: #c9cdd0;
  line-height: 1.45;
}

/* ---------- Controls ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--hairline);
}

.controls__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem 1.25rem;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control--search {
  flex: 1 1 260px;
  min-width: 0;
}

.control--filter {
  flex: 0 1 200px;
  min-width: 160px;
}

.control label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.control input,
.control select {
  font: inherit;
  font-size: 0.98rem;
  padding: 0.62rem 0.8rem;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  width: 100%;
}

.control input::placeholder {
  color: #8b9096;
}

.control input:focus-visible,
.control select:focus-visible {
  border-color: var(--accent);
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.05rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--hairline);
  background: var(--paper-raised);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}

.toggle-pill .icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.toggle-pill:hover {
  border-color: var(--accent);
}

.toggle-pill:active {
  transform: scale(0.98);
}

.toggle-pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Results ---------- */

.results {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

.results-count {
  margin: 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--slate);
  text-transform: uppercase;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  animation: fade-in 0.4s var(--ease);
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 2rem 1.75rem;
  }

  .card:nth-child(6n+1) {
    grid-column: span 4;
  }

  .card:nth-child(6n+2) {
    grid-column: span 2;
  }

  .card {
    grid-column: span 3;
  }

  .card:nth-child(6n+1) .card__media {
    aspect-ratio: 16 / 10;
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--hairline);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  padding: 1.15rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.tag {
  align-self: flex-start;
  margin: 0;
  padding: 0.24rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--accent-wash);
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.card__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.28rem;
  line-height: 1.25;
  color: var(--ink);
}

.card:nth-child(6n+1) .card__title {
  font-size: 1.6rem;
}

.card__summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.5;
}

.card__meta {
  margin: 0.15rem 0 0;
  display: flex;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--slate);
}

.card__meta span + span {
  padding-left: 0.7rem;
  border-left: 1px solid var(--hairline);
}

.card__open {
  position: static;
  margin-top: 0.5rem;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-dark);
  cursor: pointer;
}

.card__open::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card__open .arrow {
  transition: transform 0.15s var(--ease);
}

.card:hover .card__open .arrow,
.card:focus-within .card__open .arrow {
  transform: translateX(3px);
}

.card:hover,
.card:focus-within {
  border-color: var(--accent);
}

.saved-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
}

.saved-badge .icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

.empty-state__title {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.4rem;
}

.empty-state__body {
  margin: 0 0 1.25rem;
  color: var(--slate);
}

.btn {
  font: inherit;
  font-weight: 700;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: transform 0.1s var(--ease), background 0.15s var(--ease);
}

.btn:hover {
  background: var(--ink-soft);
}

.btn:active {
  transform: scale(0.98);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
}

.btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  color: var(--slate);
  font-size: 0.85rem;
  line-height: 1.6;
}

.site-footer p {
  margin: 0 0 0.35rem;
}

.site-footer__credit {
  color: #8b9096;
}

/* ---------- Detail dialog ---------- */

.detail {
  position: relative;
  border: none;
  padding: 0;
  border-radius: var(--radius);
  width: min(720px, calc(100vw - 2rem));
  max-height: min(88vh, 900px);
  margin: auto;
  background: var(--paper-raised);
  color: var(--ink);
  overflow: hidden;
}

.detail[open] {
  animation: detail-in 0.22s var(--ease);
}

.detail::backdrop {
  background: rgba(27, 31, 35, 0.55);
  animation: fade-in 0.22s var(--ease);
}

.detail__inner {
  overflow-y: auto;
  max-height: min(88vh, 900px);
  padding: 0 2rem 2.25rem;
}

.detail__media {
  margin: 0 -2rem 1.4rem;
  aspect-ratio: 16 / 9;
  background: var(--hairline);
  overflow: hidden;
}

.detail__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(27, 31, 35, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.detail__close .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.detail__close:hover {
  background: var(--ink);
}

.detail__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.detail__title {
  margin: 0.5rem 0 0.6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.18;
}

.detail__meta {
  margin: 0 0 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--slate);
}

.detail__meta span + span {
  padding-left: 0.7rem;
  border-left: 1px solid var(--hairline);
}

.detail__body {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 65ch;
}

.detail__body p {
  margin: 0 0 1.1em;
}

.save-btn {
  margin-top: 1.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--accent);
  background: var(--paper-raised);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}

.save-btn .icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.save-btn:hover {
  background: var(--accent-wash);
}

.save-btn:active {
  transform: scale(0.98);
}

.save-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes detail-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 767px) {
  .controls__inner {
    align-items: stretch;
  }

  .control--search,
  .control--filter {
    flex: 1 1 100%;
  }

  .toggle-pill {
    justify-content: center;
  }

  .detail {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .detail__inner {
    max-height: 100dvh;
  }
}
