/* RJA Custom Craftworks storefront — design system.
 *
 * Direction (soft-skill, 2026-09-20): Soft Structuralism on a warm white ground — the page is paper
 * and light, the components float on ultra-diffused ambient shadow rather than sitting in boxes with
 * grey borders. Product page is an Editorial Split; the shop is an asymmetric bento so eighteen
 * cards do not read as a spreadsheet.
 *
 * Two deliberate deviations from the skill's defaults, both because the brand outranks the default:
 *   - Type stays Alegreya (display) + Albert Sans (UI). They are the RJA brand kit and are already
 *     self-hosted in the configurator bundle. Neither is on the banned list.
 *   - Ground stays warm white rather than OLED black: Ron asked for a mostly white storefront, and
 *     the product's own colour is the only saturation the page is allowed.
 */

:root{
  /* ground + ink */
  --ks-paper:      #ffffff;
  --ks-paper-warm: #fbf9f6;
  --ks-paper-sunk: #f4f0ea;
  --ks-ink:        #171310;
  --ks-ink-2:      #574b41;
  --ks-ink-3:      #8b7e72;

  /* brand */
  --ks-walnut:      #735740;
  --ks-walnut-deep: #402110;
  --ks-brass:       #9e815e;
  --ks-brass-lit:   #d4b87a;

  /* hairlines: tinted from the brand, never neutral grey */
  --ks-line:        rgb(64 33 16 / 0.09);
  --ks-line-soft:   rgb(64 33 16 / 0.05);

  /* ambient shadow vocabulary — warm, large-radius, low-alpha. Never a hard dark drop. */
  --ks-sh-1:    0 1px 2px rgb(64 33 16 / 0.04), 0 10px 26px -18px rgb(64 33 16 / 0.22);
  --ks-sh-2:    0 2px 5px rgb(64 33 16 / 0.05), 0 28px 60px -30px rgb(64 33 16 / 0.30);
  --ks-sh-lift: 0 5px 12px rgb(64 33 16 / 0.07), 0 48px 90px -38px rgb(64 33 16 / 0.38);
  --ks-inner:   inset 0 1px 0 rgb(255 255 255 / 0.9);

  /* squircle scale, concentric by construction */
  --ks-r-shell: 2rem;
  --ks-r-core:  1.5rem;
  --ks-r-pill:  999px;

  --ks-ease:  cubic-bezier(0.32, 0.72, 0, 1);
  --ks-ease-s: cubic-bezier(0.22, 1, 0.36, 1);

  --ks-serif: 'Alegreya', Georgia, serif;
  --ks-sans:  'Albert Sans', system-ui, -apple-system, sans-serif;
}

/* ---------------------------------------------------------------- ground */
.ks, .ks .site-content{ background: var(--ks-paper); }
.ks{ color: var(--ks-ink); font-family: var(--ks-sans); }
.ks .col-full{ max-width: 76rem; }

/* A whisper of grain, fixed and inert, so the white reads as paper and not as a blank div. */
.ks::after{
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- type */
.ks .ks-title{
  font-family: var(--ks-serif); font-weight: 700;
  font-size: clamp(2.1rem, 1.3rem + 3.1vw, 3.9rem);
  line-height: 1.02; letter-spacing: -0.021em; margin: 0 0 0.6rem; color: var(--ks-ink);
  text-wrap: balance;
}
.ks .ks-eyebrow{
  display: inline-block; margin: 0 0 1rem;
  padding: 0.32rem 0.8rem; border-radius: var(--ks-r-pill);
  background: var(--ks-paper-sunk); box-shadow: var(--ks-inner);
  font-size: 0.625rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ks-walnut);
}
.ks .ks-lede{
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.115rem); line-height: 1.58;
  color: var(--ks-ink-2); max-width: 46ch; margin: 0 0 0.9rem;
}
.ks .ks-meta{
  font-size: 0.83rem; letter-spacing: 0.04em; color: var(--ks-ink-3);
  font-variant-numeric: tabular-nums; margin: 0;
}

/* ---------------------------------------------------------------- the double bezel */
.ks .ks-bezel{
  background: linear-gradient(180deg, var(--ks-paper-warm) 0%, var(--ks-paper-sunk) 100%);
  border-radius: var(--ks-r-shell);
  padding: 0.5rem;
  box-shadow: var(--ks-sh-2), var(--ks-inner);
  position: relative; z-index: 2;
}
.ks .ks-bezel-core{
  display: flow-root;   /* contain a floated summary whatever order the theme's CSS lands in */
  background: var(--ks-paper);
  border-radius: var(--ks-r-core);
  box-shadow: 0 0 0 1px var(--ks-line-soft), var(--ks-sh-1);
  padding: clamp(1rem, 2.4vw, 2rem);
  overflow: clip;
}

/* ---------------------------------------------------------------- product hero (editorial split) */
.ks .ks-hero{ padding: clamp(2.5rem, 6vw, 6rem) 0 0; }
.ks .ks-hero-head{ max-width: 54rem; margin: 0 0 clamp(1.6rem, 3.5vw, 2.8rem); }

/* The configurator's own stage/panel split is the editorial split; give it room to breathe. */
.ks .rja-kc-hero,
.ks div.product .summary{ margin: 0; }
.ks .ck .ck-tool{ gap: clamp(1.25rem, 3.2vw, 3rem); }
.ks .ck .ck-stage{
  background: radial-gradient(120% 90% at 50% 12%, #ffffff 0%, var(--ks-paper-warm) 55%, var(--ks-paper-sunk) 100%);
  border: 0; border-radius: var(--ks-r-core);
  box-shadow: inset 0 0 0 1px var(--ks-line-soft);
}

/* ---------------------------------------------------------------- shop: asymmetric bento */
.ks-shop .ks-grid-head{ padding: clamp(2.5rem, 6vw, 5.5rem) 0 clamp(1.5rem, 3vw, 2.5rem); }
/* Storefront ships `.site-main ul.products.columns-3 li.product{width:30.4%;float:left}` at 0,4,1.
 * A plain `.ks-shop ul.products li.product` is 0,3,2 and loses, which left every card floated at a
 * third of its grid cell with a margin-right -- tiny cards adrift in huge gaps. Adding .site-main to
 * the chain outranks it; the width/float/margin resets below are what actually let the grid own the
 * layout. */
body.ks-shop .site-main ul.products{
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: clamp(1.25rem, 2.6vw, 2.25rem) clamp(1rem, 2.2vw, 2rem);
  margin: 0 0 clamp(3rem, 7vw, 6rem); padding: 0; list-style: none;
}
body.ks-shop .site-main ul.products::before,
body.ks-shop .site-main ul.products::after{ display: none; }
body.ks-shop .site-main ul.products li.product{
  /* Storefront's width is 30.43%, and inside a grid that percentage resolves against the CELL, not
   * the row -- every card came out a third of its column with the rest as dead space. `.ks-shop
   * .site-main ...` tied its specificity exactly and lost on load order; adding `body` wins on
   * element count. width:auto is the fix; float is inert on a grid item but reset for clarity. */
  grid-column: span 2;
  width: auto; float: none; margin: 0; padding: 0; clear: none; text-align: left;
}
/* Two wide cards lead each run of seven, so the grid never settles into a spreadsheet. */
body.ks-shop .site-main ul.products li.product:nth-child(7n+1),
body.ks-shop .site-main ul.products li.product:nth-child(7n+2){ grid-column: span 3; }

.ks .ks-card-link{ display: block; text-decoration: none; color: inherit; }
.ks .ks-card-shell{
  position: relative;
  background: linear-gradient(180deg, var(--ks-paper-warm) 0%, var(--ks-paper-sunk) 100%);
  border-radius: var(--ks-r-shell); padding: 0.4rem;
  box-shadow: var(--ks-sh-1), var(--ks-inner);
  transition: transform 700ms var(--ks-ease), box-shadow 700ms var(--ks-ease);
  will-change: transform;
}
.ks .ks-card-core{
  background: var(--ks-paper); border-radius: calc(var(--ks-r-shell) - 0.4rem);
  box-shadow: 0 0 0 1px var(--ks-line-soft);
  aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: clip;
}
.ks .ks-card-img{
  width: 84%; height: 84%; object-fit: contain; display: block;
  transition: transform 900ms var(--ks-ease);
}
.ks .ks-card-tag{
  position: absolute; top: 1rem; left: 1rem;
  padding: 0.26rem 0.68rem; border-radius: var(--ks-r-pill);
  background: rgb(255 255 255 / 0.82); box-shadow: var(--ks-sh-1);
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ks-walnut);
}
.ks .ks-card-link:hover .ks-card-shell{ transform: translateY(-6px); box-shadow: var(--ks-sh-lift), var(--ks-inner); }
.ks .ks-card-link:hover .ks-card-img{ transform: scale(1.045) rotate(-1.1deg); }
.ks .ks-card-link:active .ks-card-shell{ transform: translateY(-2px) scale(0.988); }
.ks .ks-card-link:focus-visible .ks-card-shell{ outline: 2px solid var(--ks-brass); outline-offset: 4px; }

.ks .ks-card-foot{ padding: 1rem 0.35rem 0; }
.ks .ks-card-title{
  font-family: var(--ks-serif); font-weight: 600; font-size: 1.12rem; line-height: 1.22;
  margin: 0 0 0.3rem; color: var(--ks-ink); text-wrap: balance;
}
.ks .ks-card-meta{
  font-size: 0.8rem; color: var(--ks-ink-3); margin: 0 0 0.75rem;
  font-variant-numeric: tabular-nums; display: flex; gap: 0.6rem; align-items: baseline;
}
.ks .ks-card-price{ color: var(--ks-walnut); font-weight: 600; }

/* Pill CTA with the arrow nested in its own circle, flush to the inner padding. */
.ks .ks-card-cta{
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.44rem 0.44rem 0.44rem 1rem; border-radius: var(--ks-r-pill);
  background: var(--ks-paper-sunk); box-shadow: var(--ks-inner);
  font-size: 0.82rem; font-weight: 600; color: var(--ks-ink);
  transition: background-color 500ms var(--ks-ease), color 500ms var(--ks-ease);
}
.ks .ks-card-cta-dot{
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: rgb(255 255 255 / 0.9); color: var(--ks-walnut);
  transition: transform 600ms var(--ks-ease), background-color 500ms var(--ks-ease);
}
.ks .ks-card-link:hover .ks-card-cta{ background: var(--ks-brass-lit); color: var(--ks-walnut-deep); }
.ks .ks-card-link:hover .ks-card-cta-dot{ transform: translate(2px, -2px) scale(1.06); }

/* ---------------------------------------------------------------- entry motion */
@media (prefers-reduced-motion: no-preference){
  .ks [data-ks-reveal]{
    opacity: 0; transform: translateY(2.2rem); filter: blur(6px);
    transition: opacity 900ms var(--ks-ease-s), transform 900ms var(--ks-ease-s), filter 900ms var(--ks-ease-s);
  }
  .ks [data-ks-reveal].is-in{ opacity: 1; transform: none; filter: none; }
}

/* ---------------------------------------------------------------- header / footer */
.ks .site-header{
  background: var(--ks-paper); border-bottom: 1px solid var(--ks-line-soft);
  padding-top: 1.6rem; padding-bottom: 1.2rem;
}
.ks .site-header .site-title a,
.ks .site-branding .beta-site-title a{
  font-family: var(--ks-serif); font-weight: 700; letter-spacing: -0.015em; color: var(--ks-ink);
}
.ks .site-header .site-description{ color: var(--ks-ink-3); font-size: 0.85rem; letter-spacing: 0.02em; }
.ks .storefront-primary-navigation a{
  font-size: 0.9rem; font-weight: 500; color: var(--ks-ink-2);
  transition: color 400ms var(--ks-ease);
}
.ks .storefront-primary-navigation a:hover{ color: var(--ks-ink); }
.ks .site-footer{
  background: var(--ks-paper-warm); border-top: 1px solid var(--ks-line-soft);
  color: var(--ks-ink-3); padding-top: clamp(2.5rem, 5vw, 4rem);
}
.ks .woocommerce-breadcrumb{ font-size: 0.8rem; color: var(--ks-ink-3); letter-spacing: 0.02em; }
.ks .woocommerce-breadcrumb a{ color: var(--ks-ink-2); }

.ks ::selection{ background: rgb(212 184 122 / 0.34); color: var(--ks-ink); }

/* ---------------------------------------------------------------- mobile collapse */
@media (max-width: 768px){
  body.ks-shop .site-main ul.products{ grid-template-columns: 1fr; gap: 1.5rem; }
  body.ks-shop .site-main ul.products li.product,
  body.ks-shop .site-main ul.products li.product:nth-child(7n+1),
  body.ks-shop .site-main ul.products li.product:nth-child(7n+2){ grid-column: span 1; }
  .ks .ks-bezel{ border-radius: 1.4rem; padding: 0.35rem; }
  .ks .ks-bezel-core{ border-radius: 1.1rem; padding: 0.9rem; }
  .ks .ks-hero{ padding-top: 1.75rem; }
}

/* ---------------------------------------------------------------- shop header + controls
 * Storefront's page title, result count and ordering select were left raw — a grey sans H1 and a
 * default OS dropdown sitting above an otherwise composed grid, which is exactly the "template with
 * nice fonts" tell. They get the same type and pill vocabulary as everything else.
 */
body.ks-shop .site-main .woocommerce-products-header,
body.ks-shop .site-main > .page-title{ margin: 0; }
body.ks-shop .page-title,
body.ks-shop .woocommerce-products-header__title{
  font-family: var(--ks-serif); font-weight: 700; color: var(--ks-ink);
  font-size: clamp(2.1rem, 1.3rem + 3.1vw, 3.9rem); line-height: 1.02; letter-spacing: -0.021em;
  margin: 0 0 0.5rem;
}
body.ks-shop .site-main{ padding-top: clamp(1.5rem, 4vw, 3rem); }
body.ks-shop .woocommerce-result-count{
  color: var(--ks-ink-3); font-size: 0.85rem; margin: 0; float: none; line-height: 2.4;
}
body.ks-shop .woocommerce-ordering{ float: none; margin: 0; }
body.ks-shop .ks-toolbar{
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem;
  margin: 0 0 clamp(1.75rem, 4vw, 3rem);
}
body.ks-shop .woocommerce-ordering select{
  appearance: none; -webkit-appearance: none;
  padding: 0.55rem 2.4rem 0.55rem 1rem; border: 0; border-radius: var(--ks-r-pill);
  background-color: var(--ks-paper-sunk); color: var(--ks-ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23574b41' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
  box-shadow: var(--ks-inner); font-family: var(--ks-sans); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: background-color 400ms var(--ks-ease);
}
body.ks-shop .woocommerce-ordering select:hover{ background-color: #ece6dd; }
body.ks-shop .woocommerce-ordering select:focus-visible{ outline: 2px solid var(--ks-brass); outline-offset: 2px; }

/* The hero was opening on a band of nothing: Storefront's own top padding stacked on ks-hero's. */
.ks .ks-hero{ padding-top: clamp(1rem, 2.5vw, 2rem); }
.ks.single-product .site-main{ padding-top: clamp(0.5rem, 2vw, 1.5rem); }
.ks .woocommerce-breadcrumb{ margin: 0 0 clamp(1rem, 2.5vw, 2rem); }

/* Pagination, when 18 becomes 40. */
.ks .woocommerce-pagination ul.page-numbers{ border: 0; display: flex; gap: 0.4rem; justify-content: center; }
.ks .woocommerce-pagination ul.page-numbers li{ border: 0; }
.ks .woocommerce-pagination .page-numbers{
  border-radius: var(--ks-r-pill); padding: 0.4rem 0.9rem; color: var(--ks-ink-2);
  transition: background-color 400ms var(--ks-ease), color 400ms var(--ks-ease);
}
.ks .woocommerce-pagination .page-numbers.current{ background: var(--ks-brass-lit); color: var(--ks-walnut-deep); font-weight: 600; }
.ks .woocommerce-pagination a.page-numbers:hover{ background: var(--ks-paper-sunk); color: var(--ks-ink); }

/* ---------------------------------------------------------------- vertical rhythm at the top
 * The page opened on a dead band: Storefront's breadcrumb wrapper carries its own padding AND a
 * ~4.2em margin, which stacked with .site-main's padding to push the first heading 160px down the
 * page for no reason. Body-prefixed so it outranks the theme rather than ties with it.
 */
body.ks .storefront-breadcrumb{ padding: clamp(0.75rem, 2vw, 1.25rem) 0 0; margin: 0; }
body.ks .woocommerce-breadcrumb{ margin: 0 0 clamp(0.75rem, 2vw, 1.25rem); }
body.ks .site-main{ padding-top: clamp(0.5rem, 1.6vw, 1.25rem); }
body.ks.single-product .site-main{ padding-top: 0; }

/* One composed control row: count on the left, sorting pill on the right. */
body.ks-shop .ks-toolbar{ justify-content: space-between; }
body.ks-shop .ks-toolbar .woocommerce-result-count{ order: 1; }
body.ks-shop .ks-toolbar .woocommerce-ordering{ order: 2; margin-left: auto; }

/* Both children were coming out full-width and wrapping onto separate rows. */
/* Storefront gives the ordering form and the count their own full-width block, so they wrapped
 * onto separate rows inside the flex row. Body-prefixed to outrank it. */
body.ks-shop .ks-toolbar > *,
body.ks-shop .ks-toolbar .woocommerce-ordering,
body.ks-shop .ks-toolbar .woocommerce-result-count{ flex: 0 0 auto; width: auto; max-width: none; display: block; }
body.ks-shop .site-main ul.products{ margin-top: 0; }

/* Storefront wraps the count and the ordering select in its own `.storefront-sorting` div, so the
 * flex row above had exactly one child and the two stacked inside it. Flex the real container. */
body.ks-shop .storefront-sorting{
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 1.5rem; margin: 0;
}
body.ks-shop .storefront-sorting > *{ flex: 0 0 auto; width: auto; margin: 0; }
body.ks-shop .storefront-sorting .woocommerce-result-count{ order: 1; line-height: 1.4; }
body.ks-shop .storefront-sorting .woocommerce-ordering{ order: 2; }

@media (max-width: 640px){
  /* The pill select ran off the right edge at 390px. Give it the row to itself. */
  body.ks-shop .storefront-sorting{ gap: 0.6rem; }
  body.ks-shop .storefront-sorting .woocommerce-ordering{ width: 100%; }
  body.ks-shop .woocommerce-ordering select{ width: 100%; }
}
