:root {
  --bg: #f7f8f9;
  --surface: #ffffff;
  --text: #1b1d21;
  --muted: #5c6570;
  --line: #d8dde3;
  --accent: #3d5a73;
  --accent-hover: #2c4458;
  --danger: #8b2e2e;
  --radius: 2px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --max: 42rem;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, #eef1f4 0%, var(--bg) 28%, var(--bg) 100%);
}

.page {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  margin-bottom: 2rem;
}

.brand {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.tmdb-attribution {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  max-width: 36rem;
}

.search {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.search input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.search button,
.back {
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.search button:hover,
.back:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.back {
  display: inline-block;
  margin-bottom: 1.25rem;
  background: transparent;
  color: var(--accent);
}

.back:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-hover);
}

.status {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status.is-error {
  color: var(--danger);
}

.results,
.detail {
  margin-top: 2.5rem;
}

.section {
  margin-top: 2rem;
}

.section:first-child {
  margin-top: 0;
}

.section-title {
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.15rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.row:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 2px;
}

.thumb,
.thumb-placeholder {
  flex-shrink: 0;
  width: 46px;
  height: 69px;
  object-fit: cover;
  border-radius: var(--radius);
  background: #e4e8ec;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.row-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.row-title {
  font-weight: 500;
  line-height: 1.3;
}

.row-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.detail-header {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.detail-poster,
.detail-poster-placeholder {
  flex-shrink: 0;
  width: 92px;
  height: 138px;
  object-fit: cover;
  border-radius: var(--radius);
  background: #e4e8ec;
}

.detail-poster-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.7rem;
}

.detail-info h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.detail-info .row-meta {
  margin-top: 0.35rem;
}

.overview {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.empty {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.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;
}

@media (max-width: 480px) {
  .search {
    flex-direction: column;
  }

  .detail-header {
    flex-direction: column;
  }
}
