@font-face {
  font-family: "Fraunces";
  src: url("assets/fraunces.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Familjen Grotesk";
  src: url("assets/familjen.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Familjen Grotesk";
  src: url("assets/familjen-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Base */
  --paper: #f2f3ef;
  --paper-raise: #fcfcfa;
  --ink: #15171b;
  --ink-soft: #575d66;
  --rule: rgba(21, 23, 27, 0.14);
  --rule-strong: rgba(21, 23, 27, 0.34);

  /* Palette drawn from the Forma photographs */
  --brand: #0c5a63;
  --brand-deep: #073f46;
  --on-brand: #f4f6f1;
  --poppy: #ef9d10;

  --cat-ceramics: #5e7fa3;
  --cat-painting: #a6305c;
  --cat-floristry: #d99305;
  --cat-baking: #8a4a2b;

  --focus: var(--brand);

  --shell: min(1280px, 100% - clamp(40px, 9vw, 144px));
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Familjen Grotesk", -apple-system, "Segoe UI", Helvetica, Arial,
    sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

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

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

.masthead {
  --focus: var(--poppy);
}

.detail {
  --focus: var(--brand);
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--poppy);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 6px 6px;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

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

.masthead {
  background: var(--brand);
  color: var(--on-brand);
}

.masthead__inner {
  width: var(--shell);
  margin: 0 auto;
  padding-top: clamp(20px, 3vw, 34px);
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: clamp(28px, 5vw, 66px);
}

.wordmark {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.55rem;
  letter-spacing: 0.015em;
  font-variation-settings: "SOFT" 40, "WONK" 0;
}

.wordmark--small {
  font-size: 1.25rem;
  color: var(--brand);
}

.topline__note {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(246, 246, 238, 0.78);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(24px, 4vw, 72px);
  align-items: end;
  padding-bottom: clamp(30px, 5vw, 60px);
}

.hero__copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(2.5rem, 6.1vw, 5.1rem);
  line-height: 0.97;
  letter-spacing: -0.022em;
  font-variation-settings: "SOFT" 30, "WONK" 0;
}

.hero__deck {
  margin: clamp(18px, 2.4vw, 30px) 0 0;
  max-width: 46ch;
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  line-height: 1.5;
  color: rgba(246, 246, 238, 0.85);
}

.hero__img {
  margin: 0;
  overflow: hidden;
}

.hero__img img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Masthead load sequence */
@media (prefers-reduced-motion: no-preference) {
  .hero__copy h1,
  .hero__deck,
  .hero__img {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .hero__deck {
    animation-delay: 0.1s;
  }
  .hero__img {
    animation-delay: 0.16s;
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ---------- Toolbar ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.toolbar__inner {
  width: var(--shell);
  margin: 0 auto;
  display: flex;
  align-items: end;
  gap: clamp(14px, 2vw, 28px);
  padding: 14px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field--search {
  flex: 1 1 auto;
  min-width: 0;
}

.field__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--paper-raise);
  border: 1.5px solid var(--rule-strong);
  border-radius: 4px;
}

.field__control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12, 90, 99, 0.18);
}

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

.field__icon {
  width: 18px;
  height: 18px;
  margin-left: 12px;
  flex: none;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.field input,
.field select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

.field input {
  padding-left: 10px;
}

.field input::placeholder {
  color: #8a9099;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
}

.field--category {
  flex: 0 0 auto;
}

.field__control--select {
  min-width: 184px;
}

.field__chevron {
  position: absolute;
  right: 13px;
  width: 12px;
  height: 8px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.saved-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 43px;
  padding: 0 15px;
  background: var(--paper-raise);
  border: 1.5px solid var(--rule-strong);
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
}

.saved-toggle:hover {
  border-color: var(--brand);
}

.saved-toggle__icon {
  width: 14px;
  height: 17px;
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.saved-toggle__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(12, 90, 99, 0.12);
  color: var(--brand-deep);
  font-size: 0.8rem;
  font-weight: 700;
}

.saved-toggle[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.saved-toggle[aria-pressed="true"] .saved-toggle__icon {
  fill: var(--on-brand);
  stroke: var(--on-brand);
}

.saved-toggle[aria-pressed="true"] .saved-toggle__count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--on-brand);
}

.result-count {
  flex: none;
  margin: 0 0 11px auto;
  font-size: 0.88rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- Register list ---------- */

.programme__inner {
  width: var(--shell);
  margin: 0 auto;
}

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

.item {
  display: grid;
  grid-template-columns: 74px 128px minmax(0, 1fr) 138px 88px;
  grid-template-areas: "date thumb main facts price";
  align-items: center;
  column-gap: clamp(18px, 2.4vw, 34px);
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}

.register > li:last-child {
  border-bottom: 1px solid var(--rule);
}

.item__date {
  grid-area: date;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.item__date .d-day {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.item__date .d-wd,
.item__date .d-mon {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.item__date .d-wd {
  margin-bottom: 4px;
}

.item__date .d-mon {
  margin-top: 4px;
}

.item__thumb {
  grid-area: thumb;
  width: 128px;
  height: 92px;
  overflow: hidden;
  background: #dfe1dc;
}

.item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.item:hover .item__thumb img {
  transform: scale(1.045);
}

.item__main {
  grid-area: main;
  min-width: 0;
}

.cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.cat__dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--dot, var(--ink-soft));
  flex: none;
}

.item__title {
  margin: 6px 0 4px;
  font-family: var(--serif);
  font-weight: 470;
  font-size: clamp(1.4rem, 2.1vw, 1.85rem);
  line-height: 1.04;
  letter-spacing: -0.012em;
}

.item__open {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  transition: text-decoration-color 0.18s ease, color 0.18s ease;
}

.item__open:hover {
  text-decoration-color: var(--brand);
  color: var(--brand-deep);
}

.item__desc {
  margin: 0;
  max-width: 58ch;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.item__by {
  margin: 7px 0 0;
  font-size: 0.88rem;
  font-weight: 500;
}

.item__by b {
  font-weight: 600;
}

.item__facts {
  grid-area: facts;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.item__facts .fact--date {
  display: none;
  color: var(--ink);
  font-weight: 600;
}

.item__price {
  grid-area: price;
  justify-self: end;
  text-align: right;
}

.item__price .p-amt {
  display: block;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 520;
  line-height: 1;
}

.item__price .p-unit {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.item__flag {
  display: none;
  margin-top: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
}

.item.is-saved .item__flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.item.is-saved .item__flag::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--brand);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}

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

.empty-state {
  padding: clamp(40px, 8vw, 96px) 0 clamp(60px, 10vw, 130px);
  max-width: 46ch;
}

.empty-state__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.1;
}

.empty-state__body {
  margin: 12px 0 22px;
  color: var(--ink-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 4px;
  font-weight: 600;
  border: 1.5px solid transparent;
}

.button--ghost {
  background: var(--paper-raise);
  border-color: var(--rule-strong);
  color: var(--ink);
}

.button--ghost:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.site-footer__inner {
  width: var(--shell);
  margin: 0 auto;
  padding: 30px 0 46px;
  display: flex;
  align-items: flex-start;
  gap: 22px;
  flex-wrap: wrap;
}

.site-footer__inner p {
  margin: 0;
  max-width: 62ch;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------- Detail panel ---------- */

.detail {
  width: min(640px, 100%);
  max-width: 640px;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--paper-raise);
  color: var(--ink);
  overflow: hidden;
}

.detail::backdrop {
  background: rgba(10, 18, 48, 0.5);
}

.detail__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.detail__bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(18px, 3vw, 30px);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-raise);
}

.detail__cat {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.icon-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
}

.icon-button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.detail__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail__hero img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #dfe1dc;
}

.detail__content {
  padding: clamp(22px, 3.4vw, 36px) clamp(18px, 3.6vw, 38px) 46px;
}

.detail__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 420;
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  line-height: 1.02;
  letter-spacing: -0.018em;
}

.detail__text {
  margin: 16px 0 0;
  max-width: 58ch;
  font-size: 1.05rem;
  line-height: 1.62;
  color: #3d434b;
}

.facts {
  margin: 28px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
}

.fact-row dt {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.fact-row dd {
  margin: 3px 0 0;
  font-size: 1.02rem;
  font-weight: 500;
}

.save {
  margin-top: 30px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 22px;
  border-radius: 4px;
  border: 1.5px solid var(--brand);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  font-size: 1rem;
}

.save:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.save__icon {
  width: 15px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.save[aria-pressed="true"] {
  background: transparent;
  color: var(--brand-deep);
}

.save[aria-pressed="true"] .save__icon {
  fill: var(--brand);
}

@media (prefers-reduced-motion: no-preference) {
  .detail[open] {
    animation: panel-in 0.32s cubic-bezier(0.22, 0.7, 0.24, 1);
  }
  .detail[open]::backdrop {
    animation: fade-in 0.32s ease;
  }
  @keyframes panel-in {
    from {
      transform: translateX(36px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  @keyframes fade-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero__img img {
    aspect-ratio: 16 / 9;
  }

  .toolbar__inner {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .field--search {
    flex-basis: 100%;
  }

  .field--category {
    flex: 1 1 auto;
  }

  .field__control--select {
    min-width: 0;
  }

  .result-count {
    flex-basis: 100%;
    margin: 2px 0 0;
  }
}

@media (max-width: 720px) {
  .masthead__inner {
    padding-top: 18px;
  }

  .topline {
    padding-bottom: 26px;
  }

  .topline__note {
    font-size: 0.82rem;
  }

  .toolbar {
    position: static;
  }

  .item {
    grid-template-columns: 100px minmax(0, 1fr);
    grid-template-areas:
      "thumb main"
      "facts facts"
      "price price";
    align-items: start;
    row-gap: 14px;
    padding: 22px 0;
  }

  .item__date {
    display: none;
  }

  .item__thumb {
    width: 100px;
    height: 100px;
  }

  .item__facts {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding-top: 12px;
    border-top: 1px solid var(--rule);
  }

  .item__facts .fact--date {
    display: inline;
  }

  .item__price {
    justify-self: start;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .item__price .p-unit {
    margin-top: 0;
  }

  .detail {
    width: 100%;
    max-width: 100%;
  }

  .facts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .facts {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .saved-toggle {
    padding: 0 12px;
  }
}
