:root {
  --color-ink: #000000;
  --color-paper: #ffffff;

  --font-storenorskejalight: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif;

  --text-body: 24px;
  --leading-body: 1.2;
  --tracking-body: -0.02em;
  --text-display: clamp(120px, 28vw, 490px);
  --leading-display: 1;
  --tracking-display: -0.02em;

  --font-weight-regular: 200;

  --spacing-5: 5px;
  --spacing-8: 8px;
  --spacing-12: 12px;
  --spacing-24: 24px;
  --spacing-30: 30px;

  --section-gap: 24px;
  --element-gap: 24px;

  --radius-dots: 9999px;
  --radius-rows: 0px;
}

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

html {
  scroll-behavior: smooth;
  /* Keep Chrome edge-swipe back available */
  overscroll-behavior-x: auto;
  overscroll-behavior-y: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-storenorskejalight);
  font-size: var(--text-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  font-kerning: normal;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  /* Vertical page scroll only — horizontal edge swipes belong to Chrome back */
  touch-action: pan-y;
}

button,
input {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

strong {
  font-weight: var(--font-weight-regular);
}

.page {
  position: relative;
  min-height: 100vh;
}

.content {
  position: relative;
  z-index: 1;
  padding: 24px 0 72px;
}

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 5px 24px 8px;
  border-bottom: 1px solid var(--color-ink);
  background: var(--color-paper);
  position: relative;
  z-index: 2;
}

.topbar__brand {
  font-size: clamp(36px, 7vw, 56px);
  font-weight: var(--font-weight-regular);
  line-height: 1.05;
  letter-spacing: var(--tracking-body);
}

.topbar__meta,
.filter,
.back,
.agent-copy {
  font-size: var(--text-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
}

.agent-copy {
  border-bottom: 1px solid var(--color-ink);
  padding: 0 0 2px;
  white-space: nowrap;
}

.agent-copy:hover,
.agent-copy:focus-visible {
  outline: none;
  opacity: 0.7;
}

.agent-copy.is-copied {
  opacity: 1;
}

.topbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: baseline;
}

.filter {
  min-width: min(100%, 280px);
  border-bottom: 1px solid var(--color-ink);
  padding: 0 0 2px;
  outline: none;
}

.filter::placeholder {
  color: var(--color-ink);
  opacity: 0.35;
}

.back[hidden] {
  display: none;
}

/* Index */
.index {
  width: 100%;
}

.index__header,
.index__row {
  display: grid;
  grid-template-columns:
    56px
    minmax(72px, 0.55fr)
    minmax(160px, 2fr)
    minmax(100px, 1fr)
    minmax(0, 1.3fr)
    30px;
  gap: 24px;
  align-items: start;
  width: 100%;
  padding: 5px 24px 8px;
  border-bottom: 1px solid var(--color-ink);
  text-align: left;
  background: var(--color-paper);
}

.index__section {
  padding: 24px 24px 8px;
  border-bottom: 1px solid var(--color-ink);
  background: var(--color-paper);
}

.index__section-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: var(--font-weight-regular);
  line-height: 1.1;
  letter-spacing: var(--tracking-body);
}

.index__header {
  position: sticky;
  top: 0;
  background: var(--color-paper);
  z-index: 2;
}

.index__row {
  transition: opacity 0.35s ease;
  position: relative;
  z-index: 1;
}

.index__row:hover,
.index__row:focus-visible {
  cursor: pointer;
  outline: none;
}

.index__row.is-hidden {
  display: none;
}

.cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cell__title {
  margin: 0;
}

.cell--rating {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cell--thumb {
  width: 56px;
  padding-top: 2px;
}

.thumb {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--color-ink);
  background: var(--color-paper);
}

.thumb--pending {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-sizing: border-box;
  font-size: 9px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: center;
  opacity: 0.55;
}

.detail__gallery {
  margin: 24px 0 0;
  padding: 0;
  max-width: 720px;
}

.detail__photo {
  display: block;
  width: 100%;
  max-height: min(70vh, 640px);
  object-fit: cover;
  border: 1px solid var(--color-ink);
  background: var(--color-paper);
}

.detail__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail__thumb {
  display: block;
  padding: 0;
  width: 64px;
  height: 64px;
  border: 1px solid var(--color-ink);
  opacity: 0.55;
  cursor: pointer;
}

.detail__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail__thumb.is-active,
.detail__thumb:hover,
.detail__thumb:focus-visible {
  opacity: 1;
  outline: none;
}

.detail__rating {
  margin: 24px 0 0;
  font-size: var(--text-body);
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--tracking-body);
  line-height: var(--leading-body);
}

.detail__rating + .detail__title {
  margin-top: 8px;
}

.dot {
  width: 6px;
  height: 6px;
  margin: 11px 0 0 auto;
  border-radius: var(--radius-dots);
  background: var(--color-ink);
}

.empty {
  padding: 24px;
  border-bottom: 1px solid var(--color-ink);
}

/* Detail */
.detail {
  padding: 0 24px;
  background: var(--color-paper);
  position: relative;
  z-index: 1;
}

.detail[hidden] {
  display: none;
}

.detail__title {
  margin: 24px 0;
  font-size: clamp(40px, 8vw, 96px);
  font-weight: var(--font-weight-regular);
  line-height: 1;
  letter-spacing: -0.02em;
}

.detail__block {
  padding: 5px 0 8px;
  border-bottom: 1px solid var(--color-ink);
}

.detail__label {
  margin: 0 0 12px;
}

.detail__text {
  margin: 0;
  white-space: pre-line;
}

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

.detail__list li {
  padding: 5px 0 8px;
  border-bottom: 1px solid var(--color-ink);
}

.detail__list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail__steps {
  margin: 0;
  padding-left: 1.2em;
}

.detail__steps li + li {
  margin-top: 8px;
}

/* Tables in detail/index sections */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-ink);
  touch-action: pan-x pan-y;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 5px 24px 8px 0;
  border-bottom: 1px solid var(--color-ink);
  font-weight: var(--font-weight-regular);
}

th:first-child,
td:first-child {
  padding-left: 24px;
}

th:last-child,
td:last-child {
  padding-right: 24px;
}

.footer-note {
  margin: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-ink);
}

.footer-note__trust {
  max-width: 42em;
}

.footer-note a,
.footer-note strong {
  font-weight: var(--font-weight-regular);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Motion — presence without breaking flat system */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.7s ease forwards;
}

.reveal-delay-1 { animation-delay: 0.08s; }
.reveal-delay-2 { animation-delay: 0.16s; }
.reveal-delay-3 { animation-delay: 0.24s; }

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 900px) {
  :root {
    --text-body: 18px;
  }

  .index__header {
    display: none;
  }

  .index__row {
    grid-template-columns: 56px 1fr 30px;
    grid-template-areas:
      "thumb rating dot"
      "thumb title dot"
      "thumb meta meta"
      "thumb macros macros";
    gap: 0 16px;
  }

  .index__row .cell:nth-child(1) { grid-area: thumb; }
  .index__row .cell:nth-child(2) { grid-area: rating; opacity: 0.7; }
  .index__row .cell:nth-child(3) { grid-area: title; }
  .index__row .cell:nth-child(4) { grid-area: meta; opacity: 0.7; }
  .index__row .cell:nth-child(5) { grid-area: macros; opacity: 0.7; }
  .index__row .cell:nth-child(6) { grid-area: dot; }

  .cell--thumb {
    padding-top: 4px;
  }

  .detail__gallery {
    max-width: none;
  }

  .detail__photo {
    max-height: 55vh;
  }

  .index__section {
    padding-inline: 16px;
  }

  .topbar {
    padding-inline: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__actions {
    width: 100%;
    gap: 12px;
  }

  .filter {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }

  .index__row,
  .detail,
  .empty,
  .footer-note,
  th:first-child,
  td:first-child {
    padding-left: 16px;
  }

  th:last-child,
  td:last-child,
  .index__row,
  .footer-note {
    padding-right: 16px;
  }

  .detail {
    padding-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
