/* Kedai Digital: one page, phone first.
   Colour comes from the products (each has its own); everything else is kept quiet on purpose. */

@font-face {
  font-family: 'Mona Sans';
  src: url('../fonts/mona-sans-latin-wght.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #0c3b3a;
  --muted: #536b6a;
  --line: #dce5e4;
  --accent: #0f766e;
  --font: 'Mona Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: clamp(1rem, 4vw, 2rem);
  --measure: 72rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: -4rem;
  z-index: 10;
  padding: 0.625rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: 0.5rem;
}
.skip:focus {
  inset-block-start: 1rem;
}

.wrap {
  inline-size: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
}

/* ---------- Top bar ---------- */

.top {
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-block-size: 2.75rem;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* ---------- Intro ---------- */

.intro {
  padding-block: 1.25rem 2rem;
}

.intro h1 {
  max-inline-size: 14em;
  font-size: clamp(1.875rem, 1.2rem + 3.4vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.intro p {
  max-inline-size: 36em;
  margin-block-start: 0.75rem;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- Shelf ---------- */

.shelf {
  container: shelf / inline-size;
  padding-block-end: 3.5rem;
}

.tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-block-end: 1.5rem;
}

.search input {
  inline-size: 100%;
  block-size: 2.75rem;
  padding-inline: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  font-size: 1rem; /* 16px, so iOS does not zoom into the box */
  appearance: none;
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

/* One swipeable row on phones, running out to the screen edge. */
.chips {
  display: flex;
  gap: 0.5rem;
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  scroll-padding-inline: var(--gutter);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-block-size: 2.75rem;
  padding-inline: 1.125rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  scroll-snap-align: start;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
@media (hover: hover) {
  .chip:not([aria-pressed='true']):hover {
    border-color: var(--ink);
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 0.875rem;
}

.item {
  container: item / inline-size;
}
.item.is-featured {
  grid-column: 1 / -1;
}

/* ---------- Product ---------- */

.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 0.75rem;
  border-radius: 1rem;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  container-type: inline-size;
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 1rem;
  background: #eef4f3;
  background: color-mix(in oklab, var(--tone) 12%, white);
  overflow: clip;
  transition: transform 0.15s;
}

/* Taken out of the flow so a large picture can never widen its card. */
.stage img {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  padding: 11%;
  object-fit: contain;
  filter: drop-shadow(0 0.5rem 0.875rem color-mix(in oklab, var(--tone) 38%, transparent));
  transition: transform 0.25s;
}

/* No picture: an app-icon style tile with the first letters of the name. */
.mono {
  display: grid;
  place-items: center;
  inline-size: 42%;
  aspect-ratio: 1;
  border-radius: 24%;
  background: var(--tone);
  color: #fff;
  font-size: 16cqi;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.badge {
  position: absolute;
  inset: 0.625rem auto auto 0.625rem;
  padding: 0.25rem 0.625rem;
  background: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
  min-inline-size: 0;
}

.name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: clip;
  font-size: 1rem;
  font-weight: 640;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.tagline {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: clip;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-start: 0.125rem;
  font-size: 0.9375rem;
}

.price {
  font-weight: 650;
}

.kind {
  min-inline-size: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cta {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-block-size: 3rem;
  margin-block-start: 0.75rem;
  padding-inline: 1.5rem;
  background: var(--ink);
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
}

/* Narrow cards (two columns on a phone): name and price only. The details live on the product page. */
@container item (inline-size < 13rem) {
  .tagline {
    display: none;
  }
}

/* Featured product: full width, at the top of the shelf. */
.is-featured .stage {
  aspect-ratio: 4 / 3;
}
.is-featured .mono {
  inline-size: 30%;
}
.is-featured .body {
  gap: 0.5rem;
}
.is-featured .name {
  display: block;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.is-featured .tagline {
  display: block;
  max-inline-size: 38ch;
  font-size: 1rem;
  line-height: 1.5;
}
.is-featured .meta {
  justify-content: start;
  gap: 0.75rem;
  margin-block-start: 0.25rem;
  font-size: 1.125rem;
}

@container item (inline-size >= 38rem) {
  .is-featured .product {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: center;
    gap: 3rem;
  }
  .is-featured .stage {
    aspect-ratio: 5 / 4;
  }
  .is-featured .name {
    font-size: 2.5rem;
  }
}

@container shelf (inline-size >= 40rem) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem 1.25rem;
  }
  .chips {
    flex-wrap: wrap;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }
  .tools {
    grid-template-columns: minmax(0, 20rem) 1fr;
    align-items: start;
  }
  .search[hidden] + .chips {
    grid-column: 1 / -1;
  }
}

@container shelf (inline-size >= 62rem) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (hover: hover) {
  .product:hover .name {
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.2em;
  }
  .product:hover .stage img {
    transform: scale(1.03);
  }
}
.product:active .stage {
  transform: scale(0.985);
}

/* A product with no link does not react to a press. */
.is-soon:active .stage {
  transform: none;
}

/* ---------- Messages (empty, error) ---------- */

.note {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
  padding-block: 1.5rem;
  color: var(--muted);
}

.note__btn {
  min-block-size: 2.75rem;
  padding-inline: 1.25rem;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

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

.foot {
  padding-block: 1.75rem 2.5rem;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
.foot a {
  text-underline-offset: 0.2em;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
