/* ==========================================================================
   Aira's Handmade — demo by Rekarih Studio
   To re-skin for a client, change the tokens in section 1.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Brand colours */
  --linen: #F4F1EA;
  --ink: #1F2A44;
  --madder: #B5382A;
  --madder-light: #F0907E;

  /* Semantic colours (flipped by .on-ink / .on-madder) */
  --bg: var(--linen);
  --fg: var(--ink);
  --fg-soft: rgba(31, 42, 68, .72);
  --accent: var(--madder);
  --rule: rgba(31, 42, 68, .18);

  /* Type: two families, five sizes, two weights */
  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --t-xs: .8125rem;
  --t-sm: 1rem;
  --t-md: 1.25rem;
  --t-lg: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --t-xl: clamp(2.5rem, 1.3rem + 4.6vw, 4.25rem);
  --w-regular: 400;
  --w-bold: 600;

  /* Layout */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 76rem;
  --section: clamp(4rem, 9vw, 7.5rem);
  --rail-x: calc(var(--gutter) / 2 - 1px);
  --stitch: 10px;
  --stitch-gap: 7px;
}

.on-ink {
  --bg: var(--ink);
  --fg: var(--linen);
  --fg-soft: rgba(244, 241, 234, .74);
  --accent: var(--madder-light);
  --rule: rgba(244, 241, 234, .24);
}

.on-madder {
  --bg: var(--madder);
  --fg: var(--linen);
  --fg-soft: rgba(244, 241, 234, .88);
  --accent: var(--ink);
  --btn-hover-fg: var(--linen);
}

.on-ink,
.on-madder {
  background: var(--bg);
  color: var(--fg);
}

/* 2. Base ------------------------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: var(--w-regular) var(--t-sm) / 1.55 var(--font-body);
}

h1, h2, h3, p, figure, blockquote, ul { margin: 0; }
ul { padding: 0; list-style: none; }
svg { display: block; }
[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: var(--w-bold);
  letter-spacing: -.02em;
  text-wrap: balance;
}
h1 { font-size: var(--t-xl); line-height: 1.02; }
h2 { font-size: var(--t-lg); line-height: 1.12; }
h3 { font-size: var(--t-md); line-height: 1.25; letter-spacing: -.01em; }

.lead { font-size: var(--t-md); line-height: 1.45; }
.small { font-size: var(--t-xs); }
.soft { color: var(--fg-soft); }
.strong { font-weight: var(--w-bold); }

/* The one link style. .plain drops the underline until hover (nav, lists, titles). */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
}
a:hover { color: var(--accent); }
.plain a,
a.plain { text-decoration: none; }
.plain a:hover,
a.plain:hover { text-decoration: underline; }

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

/* The one button style. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .7rem 1.25rem;
  border: 0;
  border-radius: 2px;
  background: var(--fg);
  color: var(--bg);
  font: var(--w-bold) var(--t-sm) / 1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s;
}
.btn:hover {
  background: var(--accent);
  color: var(--btn-hover-fg, var(--bg));
}

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

.section { padding-block: var(--section); }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 20;
}
.skip:focus { top: .5rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 3. Demo strip + header ---------------------------------------------------- */
.strip {
  padding: .55rem var(--gutter);
  text-align: center;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.header.is-stuck { border-bottom-color: var(--rule); }

.header__bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font: var(--w-bold) var(--t-md) / 1 var(--font-head);
  letter-spacing: -.01em;
}
.logo:hover { text-decoration: none; }
.logo svg { width: 2rem; height: 2rem; }
.logo span { font-weight: var(--w-regular); color: var(--fg-soft); }

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-left: auto;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.icon-btn:hover { color: var(--accent); }
.icon-btn svg { width: 1.375rem; height: 1.375rem; }
.nav-toggle { display: none; }

@media (max-width: 47.99rem) {
  .header__bar { gap: .25rem; }
  .header__actions { margin-left: auto; display: flex; }
  .nav-toggle { display: inline-grid; }
  .nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: .25rem var(--gutter) 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .75rem 0; }
}

/* 4. Hero ------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) 2.5rem;
}

.hero__grid {
  display: grid;
  gap: 2rem clamp(2rem, 4vw, 4rem);
  align-items: center;
}
@media (min-width: 56rem) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}

.hero__text h1 { max-width: 16ch; }
.hero__text p { max-width: 36ch; margin-block: 1.25rem 1.75rem; }

.hero__goods,
.makers__art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* The thread: a running stitch that sews itself along the foot of the hero… */
.hero__stitch {
  position: absolute;
  left: var(--rail-x);
  right: var(--rail-x);
  bottom: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 var(--stitch), transparent var(--stitch) calc(var(--stitch) + var(--stitch-gap)));
  animation: sew 1.8s .3s ease-in-out both;
}
@keyframes sew {
  from { clip-path: inset(0 0 0 100%); }
  to { clip-path: inset(0 0 0 0); }
}

/* …then turns the corner and follows the reader down the page edge. */
.stitched { position: relative; }
.rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rail-x);
  width: 2px;
  pointer-events: none;
}
.rail__thread {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, var(--accent) 0 var(--stitch), transparent var(--stitch) calc(var(--stitch) + var(--stitch-gap)));
  clip-path: inset(0 0 calc(100% - var(--drawn, 0px)) 0);
}
.rail__needle {
  position: absolute;
  top: var(--drawn, 0px);
  left: -1px;
  width: 4px;
  height: 30px;
  background: var(--fg);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
}
.rail__needle::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 3px;
  width: 2px;
  height: 6px;
  background: var(--bg);
}

/* 5. Catalogue --------------------------------------------------------------- */
.catalogue { padding-top: clamp(3rem, 6vw, 5rem); }

.catalogue__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-block: 1rem 2rem;
  border-bottom: 1px solid var(--rule);
}
.filter {
  min-height: 2.75rem;
  margin-bottom: -1px;
  padding: .5rem 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--fg-soft);
  font: inherit;
  cursor: pointer;
}
.filter:hover { color: var(--fg); }
.filter[aria-pressed="true"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: clamp(1.5rem, 3vw, 2.5rem) clamp(.75rem, 2vw, 1.5rem);
}
@media (min-width: 48rem) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 68rem) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.card--wide { grid-column: span 2; }

.card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: #ebe5dc;
}
.card--wide .card__media { aspect-ratio: 1200 / 430; }
.card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .75rem;
  padding-top: .75rem;
}
.card__cat { flex: 0 0 100%; }
.card__name { flex: 1 1 auto; }
.card__name a::after { /* whole card is the link target */
  content: "";
  position: absolute;
  inset: 0;
}
.card:hover .card__name a { text-decoration: underline; }
.card__desc { flex: 0 0 100%; order: 1; margin-top: .25rem; }
@media (max-width: 47.99rem) {
  .card__desc { /* two lines at most in the narrow two-column grid */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }
}

/* 6. Makers + quote --------------------------------------------------------- */
.makers__grid {
  display: grid;
  gap: 2rem clamp(2rem, 6vw, 5rem);
  align-items: center;
}
@media (min-width: 56rem) {
  .makers__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
.makers__text p { max-width: 44ch; margin-block: 1.25rem; }

.quote {
  padding-block: 0 var(--section);
}
.quote blockquote {
  max-width: 24ch;
  font: var(--w-regular) var(--t-lg) / 1.2 var(--font-head);
  letter-spacing: -.02em;
  text-wrap: balance;
}
.quote figcaption { margin-top: 1.25rem; }

/* 7. Footer + studio credit -------------------------------------------------- */
.footer { padding-block: clamp(3rem, 6vw, 4.5rem) 1.5rem; }

.footer__grid {
  display: grid;
  gap: 2.5rem 2rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.footer__brand,
.footer__letters { grid-column: 1 / -1; }
@media (min-width: 56rem) {
  .footer__grid { grid-template-columns: 1.4fr .7fr .7fr 1.4fr; }
  .footer__brand,
  .footer__letters { grid-column: auto; }
}
.footer__brand p { max-width: 32ch; margin-top: 1rem; }
.footer__grid li + li { margin-top: .5rem; }
.footer__grid .strong { margin-bottom: .75rem; }

.footer__letters label { display: block; }
.field {
  display: flex;
  gap: .75rem;
  margin-block: .25rem .5rem;
}
.field input {
  flex: 1;
  min-width: 0;
  padding: .6rem 0;
  border: 0;
  border-bottom: 1px solid var(--fg);
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
}
.field input::placeholder { color: var(--fg-soft); }

.footer__legal {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.credit { padding-block: clamp(2.5rem, 5vw, 4rem); }
.credit__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}
.credit p { margin-top: .5rem; }

/* 8. Motion preferences ------------------------------------------------------ */
::view-transition-group(*) { animation-duration: .4s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
  .rail__thread { clip-path: none; }
  .rail__needle { display: none; }
}
