/* Kings Peak Coffee Roasters: design system. Pink ground, plum ink, cyan plates, cut upper-right corners. */

/* Tokens: palette, type, rhythm, cuts, timing. */
:root {
  --pink: #F8D5E7;
  --pink-deep: #EDBCD6;
  --plum: #21162A;
  --cyan: #00D9F3;
  --ink-dim: rgba(33, 22, 42, .6);
  --ff-display: 'Space Mono', ui-monospace, Menlo, Consolas, monospace;
  --ff-text: 'M PLUS Rounded 1c', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --t-small: .875rem;
  --t-body: 1.0625rem;
  --t-lead: clamp(1.125rem, 1rem + .5vw, 1.3125rem);
  --t-h3: clamp(1.2rem, 1.05rem + .5vw, 1.45rem);
  --t-h2: clamp(1.6rem, 1.2rem + 1.5vw, 2.5rem);
  --t-h1: clamp(2.3rem, 1.4rem + 3.6vw, 4.5rem);
  --line: 1.65rem;
  --cut-s: .75rem;
  --cut-l: 1.5rem;
  --gap: clamp(1rem, 2.4vw, 2rem);
  --pad: clamp(1rem, 4.5vw, 3.75rem);
  --rail: 12rem;
  --bar: 4rem;
  --fast: 180ms;
  --shift: 200ms;
}

/* Base: the whole reading surface is pink, including gutters. */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--pink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--pink);
  color: var(--plum);
  font: 400 var(--t-body)/var(--line) var(--ff-text);
  padding-bottom: calc(var(--bar) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 var(--line); }
ul { margin: 0; padding: 0; list-style: none; }
address { font-style: normal; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Headings: Space Mono Bold, square to the grid, sentence case. Classes: .h1 .h2 .h3 to borrow a size. */
h1, h2, h3, .h1, .h2, .h3 {
  font-family: var(--ff-display);
  font-weight: 700;
  margin: 0 0 calc(var(--line) * .75);
  letter-spacing: -.01em;
  text-wrap: balance;
}
h1, .h1 { font-size: var(--t-h1); line-height: 1.08; }
h2, .h2 { font-size: var(--t-h2); line-height: 1.15; }
h3, .h3 { font-size: var(--t-h3); line-height: 1.25; }

/* Running text helpers: .lead for the short opening paragraph, .prose for a measured column, .small for notes. */
.lead { font-size: var(--t-lead); line-height: 1.55; max-width: 32em; }
.prose { max-width: 36em; }
.prose > * + h2, .prose > * + h3 { margin-top: calc(var(--line) * 1.5); }
.small { font-size: var(--t-small); line-height: 1.5; }
.name { font-family: var(--ff-display); font-weight: 700; }

/* Links: plum, underlined; colour shifts in 180 ms to a cyan ground with plum text. */
a { color: var(--plum); text-decoration-thickness: .09em; text-underline-offset: .2em; transition: background-color var(--fast), color var(--fast); }
a:hover { background-color: var(--cyan); text-decoration-color: var(--plum); }

/* Focus: thick plum outline on the unclipped element itself. */
:focus-visible { outline: .1875rem solid var(--plum); outline-offset: .1875rem; }

/* Skip link. */
.skip { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .75rem 1rem; background: var(--cyan); color: var(--plum); }
.skip:focus { top: 1rem; }

/* Cut-corner masks: .cut-s (12 px, controls) and .cut-l (24 px, plates and images). Never on an element that needs a focus outline. */
.cut-s { clip-path: polygon(0 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% 100%, 0 100%); }
.cut-l { clip-path: polygon(0 0, calc(100% - var(--cut-l)) 0, 100% var(--cut-l), 100% 100%, 0 100%); }

/* Navigation, phone: fixed bottom bar, home link then the site.nav links, on solid plum. */
.rail {
  position: fixed;
  z-index: 50;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 1.15fr 4fr;
  background: var(--plum);
  color: var(--pink);
  padding-bottom: env(safe-area-inset-bottom);
}
.rail a { color: var(--pink); text-decoration: none; position: relative; isolation: isolate; }
.rail a:hover { background: none; }
.rail a:hover span, .rail__nav a:hover { text-decoration: underline; text-underline-offset: .2em; }
.rail :focus-visible { outline-color: var(--pink); outline-offset: -.25rem; }
.rail__brand {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: var(--bar); padding: .25rem; font-size: .75rem; line-height: 1.1; text-align: center;
}
.mark { width: 1.5rem; height: 1.5rem; }
.rail__name { display: none; }
.rail__short { font-family: var(--ff-display); font-weight: 700; }
.rail__nav ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); height: 100%; }
.rail__nav a {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: var(--bar); height: 100%; padding: .25rem .2rem; font-size: .8125rem; line-height: 1.15;
}
/* Current page: a cyan block with a cut corner behind the label. */
.rail a[aria-current="page"] { color: var(--plum); }
.rail a[aria-current="page"]::before {
  content: ""; position: absolute; inset: .3rem .15rem; z-index: -1; background: var(--cyan);
  clip-path: polygon(0 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% 100%, 0 100%);
}
.rail__brand[aria-current="page"] .mark path:first-child { stroke: var(--plum); }

/* Navigation, desk: the same header becomes a fixed plum rail down the left edge. */
@media (min-width: 56em) {
  body { padding-left: var(--rail); padding-bottom: 0; }
  .rail {
    top: 0; right: auto; bottom: 0; width: var(--rail);
    display: flex; flex-direction: column; gap: calc(var(--line) * 1.5);
    padding: 1.5rem 0 1.5rem;
  }
  .rail__brand { align-items: flex-start; text-align: left; gap: .75rem; padding: 0 1.25rem; font-size: 1.0625rem; line-height: 1.2; }
  .mark { width: 2.25rem; height: 2.25rem; }
  .rail__name { display: flex; flex-direction: column; font-family: var(--ff-display); font-weight: 700; }
  .rail__short { display: none; }
  .rail__nav ul { display: flex; flex-direction: column; }
  .rail__nav a { justify-content: flex-start; text-align: left; min-height: 2.75rem; padding: .5rem 1.25rem; font-size: 1.0625rem; }
  .rail__nav a[aria-current="page"]::before { inset: .2rem .75rem .2rem 0; }
  .rail__brand[aria-current="page"]::before { inset: -.5rem .5rem -.5rem 0; }
}

/* Page frame: .wrap pads a section to the grid; .section spaces sections apart. */
.wrap { padding-inline: var(--pad); }
.section { padding-block: calc(var(--line) * 2.5); }

/* Spread: the 12-column magazine grid. Children use .span-4/.span-5/.span-6 and .start-N on desk; single column on a phone. */
.spread { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--gap); align-items: start; }
@media (min-width: 56em) {
  .spread { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .span-4 { grid-column-end: span 4; }
  .span-5 { grid-column-end: span 5; }
  .span-6 { grid-column-end: span 6; }
  .span-8 { grid-column-end: span 8; }
  .start-1 { grid-column-start: 1; }
  .start-6 { grid-column-start: 6; }
  .start-7 { grid-column-start: 7; }
}

/* Page opening: .opening > .opening__head (h1, six columns) + .opening__lead (lead and button, four columns, two left empty). */
.opening { padding-top: calc(var(--line) * 2); padding-bottom: calc(var(--line) * 1.5); row-gap: calc(var(--line) * .5); }
.opening__lead .btn { margin-top: calc(var(--line) * .25); }
@media (min-width: 56em) {
  .opening__head { grid-column: 1 / span 6; }
  .opening__lead { grid-column: 7 / span 4; padding-top: .6rem; }
}

/* Three reading columns for later spreads: .trio; put .trio__wide on a photo to inset it across two. */
.trio { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--line) var(--gap); align-items: start; }
@media (min-width: 56em) {
  .trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trio__wide { grid-column: span 2; }
}

/* Two-line initial for the opening paragraph of an article: <p class="initial">. */
.initial::first-letter {
  float: left; font-family: var(--ff-display); font-weight: 700;
  font-size: calc(var(--line) * 2.05); line-height: calc(var(--line) * 2);
  margin: .1rem .5rem 0 0;
}

/* Pull quote: <blockquote class="pull">, set in Space Mono; pages place it across a gutter on their own grid. */
.pull { margin: var(--line) 0; font-family: var(--ff-display); font-weight: 700; font-size: var(--t-h3); line-height: 1.35; }
.pull p { margin: 0; }

/* Rule: a short thick plum bar with a cut corner, never a hairline. <hr class="rule">. */
.rule {
  border: 0; height: .5rem; width: 4.5rem; margin: calc(var(--line) * 1.5) 0; background: var(--plum);
  clip-path: polygon(0 0, calc(100% - .5rem) 0, 100% .5rem, 100% 100%, 0 100%);
}

/* Figure: <figure class="shot"><img class="shot__img cut-l"><figcaption>. Photos fill their frame with object-fit. */
.shot { margin: 0; }
.shot__img { width: 100%; object-fit: cover; background: var(--pink-deep); }
.shot__img--tall { aspect-ratio: 4 / 5; }
.shot__img--wide { aspect-ratio: 3 / 2; }
.shot figcaption { margin-top: .6rem; font-size: var(--t-small); line-height: 1.45; }

/* Plate: the cyan cut-corner caption. <span class="plate">. .plate--outline is the plum-outline version; .plate--big for headline size. */
.plate {
  position: relative; isolation: isolate; display: inline-block;
  padding: .3rem 1.1rem .35rem .65rem; color: var(--plum);
  font: 400 var(--t-small)/1.4 var(--ff-text); text-decoration: none;
}
.plate::before, .plate--outline::after {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--cyan);
  clip-path: polygon(0 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% 100%, 0 100%);
  transition: background-color var(--fast);
}
.plate--outline::before { background: var(--plum); }
.plate--outline::after { inset: .125rem; background: var(--pink); }
.plate--big { padding: .9rem 2.25rem 1rem 1.1rem; font: 700 var(--t-h2)/1.15 var(--ff-display); }
.plate--big::before, .plate--big.plate--outline::after { clip-path: polygon(0 0, calc(100% - var(--cut-l)) 0, 100% var(--cut-l), 100% 100%, 0 100%); }

/* The caption pair, the site's device: <div class="pair"> with two children; the second always sits one text line lower. */
.pair { display: grid; grid-template-columns: 4fr 5fr; gap: var(--gap); align-items: start; }
.pair > :nth-child(2) { margin-top: var(--line); }
.pair--even { grid-template-columns: 1fr 1fr; }
.pair .plate { margin-top: .6rem; }
@media (max-width: 30em) { .pair { gap: .75rem; } .pair .plate { padding-right: .9rem; } }

/* Pair filter: put data-show-group on a wrapper, buttons with data-show="peak|origin", entries with data-kind; site.js sets data-showing. */
[data-kind] { transition: color var(--fast); }
[data-showing="peak"] [data-kind="origin"], [data-showing="origin"] [data-kind="peak"] { color: var(--ink-dim); }
[data-showing="peak"] [data-kind="origin"] a, [data-showing="origin"] [data-kind="peak"] a { color: inherit; }

/* Button: cyan cut-corner fill on a pseudo-element so the focus outline stays whole; shifts two pixels on hover and focus. <a class="btn">. */
.btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: .5rem;
  min-height: 2.75rem; padding: .55rem 1.6rem .55rem 1rem; border: 0; background: none;
  color: var(--plum); font: 400 1rem/1.3 var(--ff-text); text-decoration: none;
  transition: transform var(--shift) ease-out;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--cyan);
  clip-path: polygon(0 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% 100%, 0 100%);
  transition: background-color var(--fast);
}
.btn:hover { background: none; transform: translateY(-.125rem); }
.btn:focus-visible { transform: translateY(-.125rem); }
.btn[aria-pressed="true"] { color: var(--pink); }
.btn[aria-pressed="true"]::before { background: var(--plum); }
.btn--plum { color: var(--pink); }
.btn--plum::before { background: var(--plum); }
.btns { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Reveal: the only scroll effect allowed here is colour. Plates inside .reveal wait in deep pink and fill cyan (180 ms) once in view. */
html.js .reveal:not(.is-seen) .plate:not(.plate--outline)::before { background: var(--pink-deep); }

/* Spec list: <dl class="specs"> with dt/dd pairs, used on product and café pages. */
.specs { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .35rem var(--gap); margin: 0 0 var(--line); }
.specs dt { font-weight: 400; }
.specs dd { margin: 0; font-family: var(--ff-display); font-weight: 700; }

/* Footer: one full-width counter photograph with a single cyan cut-corner panel over its left third. */
.foot { display: grid; margin-top: calc(var(--line) * 2); }
.foot > * { grid-area: 1 / 1; }
.foot__photo { width: 100%; height: 100%; min-height: 34rem; object-fit: cover; }
.foot__panel {
  align-self: center; justify-self: start; margin: 1.5rem .75rem; width: calc(100% - 1.5rem);
  padding: 1.5rem 2rem 1.5rem 1.25rem; background: var(--cyan); color: var(--plum);
  font-size: var(--t-small); line-height: 1.55;
  clip-path: polygon(0 0, calc(100% - var(--cut-l)) 0, 100% var(--cut-l), 100% 100%, 0 100%);
}
.foot__panel p { margin-bottom: .9rem; }
.foot__panel a:hover { background: var(--plum); color: var(--cyan); }
.foot__name { font: 700 1.35rem/1.2 var(--ff-display); }
.foot__address { margin-bottom: .9rem; }
.foot__address a { display: inline-block; padding-block: .3rem; overflow-wrap: anywhere; }
.foot__go { font-weight: 400; font-size: 1rem; }
.foot__links { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-bottom: .9rem; }
.foot__links a { display: inline-block; padding-block: .55rem; }
.foot__small { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0; }
.foot__cookie { min-height: 2.75rem; padding: 0 .9rem; border: .125rem solid var(--plum); background: transparent; }
.foot__cookie:hover { background: var(--plum); color: var(--cyan); }
@media (min-width: 56em) {
  .foot__panel { width: min(33%, 26rem); min-width: 22rem; margin: 2.5rem var(--pad); }
  .foot__photo { min-height: 36rem; }
}

/* Consent banner: small plum slip; bottom of the screen above the bar on a phone, bottom-right on desk. Never covers the page. */
#consent {
  position: fixed; z-index: 70; left: .75rem; right: .75rem;
  bottom: calc(var(--bar) + env(safe-area-inset-bottom) + .75rem);
  display: grid; gap: .75rem; padding: 1rem 1.5rem 1rem 1rem; max-width: 26rem;
  background: var(--plum); color: var(--pink); font-size: var(--t-small); line-height: 1.5;
  clip-path: polygon(0 0, calc(100% - var(--cut-l)) 0, 100% var(--cut-l), 100% 100%, 0 100%);
}
#consent[hidden] { display: none; }
#consent a { color: var(--pink); }
#consent a:hover { color: var(--plum); }
#consent :focus-visible { outline-color: var(--pink); }
.consent__text { margin: 0; }
.consent__actions { display: flex; gap: .75rem; }
.consent__actions .btn { flex: 1; justify-content: center; }
@media (min-width: 56em) { #consent { left: auto; right: 1.5rem; bottom: 1.5rem; } }

/* Offer slip: a cyan cut-corner tag pinned at the top (top-right on desk), dropping in over 200 ms. */
#promo {
  position: fixed; z-index: 60; top: .75rem; left: .75rem; right: .75rem; margin-left: auto; max-width: 25rem;
  display: flex; align-items: center; gap: .75rem; padding: .85rem 1.75rem .85rem 1rem;
  background: var(--cyan); color: var(--plum); font-size: var(--t-small); line-height: 1.45;
  clip-path: polygon(0 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% 100%, 0 100%);
  transform: translateY(-140%); opacity: 0;
  transition: transform var(--shift) ease-out, opacity var(--shift) ease-out;
}
#promo[hidden] { display: none; }
#promo.is-in { transform: none; opacity: 1; }
.promo__text { margin: 0; }
.promo__text a:hover { background: var(--plum); color: var(--cyan); }
#promo [data-promo-close] {
  flex: none; width: 2.75rem; height: 2.75rem; border: .125rem solid var(--plum); background: transparent;
  font-family: var(--ff-display); font-weight: 700;
}
#promo [data-promo-close]:hover { background: var(--plum); color: var(--cyan); }
@media (min-width: 56em) { #promo { right: 1.5rem; top: 1.5rem; left: calc(var(--rail) + 1.5rem); } }

/* Visually hidden text for screen readers: .vh. */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Reduced motion: no shifts, no flights; colour changes stay instant. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .btn:hover, .btn:focus-visible { transform: none; }
  #promo { transform: none; }
}

/* A page never scrolls sideways. */
html, body { overflow-x: clip; }
/* Past a full-HD window the whole page grows with the window - type, gaps and pictures
   together - so a very wide screen (or a page zoomed far out) shows the same composition,
   not a small column of text lost in an enormous picture. */
@media (min-width: 1921px) { html { font-size: calc(100vw / 120); } }
/* What can be pressed in the chrome lies above the page: a huge headline's line box reaching
   into the navigation must not swallow the clicks meant for the links. */
header a, header button, nav a, nav button { position: relative; z-index: 2; }
