/* Asili Coffee, direction t-a "Porcelain": the page's own CSS.
   The palette's supporting colours from the user's docs/palette-and-type.md (sections 3 and 5), the labelled
   placeholder frames that stand in for photographs until Asili's own arrive (the user's instruction), the
   FR / NL / EN switcher, and the few page rules the recipes allow (a visual's size, a tablet or phone count). */

:root {
  --asili-cobalt: #3a39b8;
  --asili-cobalt-deep: #2b2793;
  --asili-white: #ffffff;
  --asili-mist: #e4e9fd;
  --asili-line: #d7dae6;
  --asili-line-strong: #7a7f96;
  --asili-on-cobalt-muted: #c6cff6;
  /* headings are cobalt on the light grounds; on cobalt and on ink they take the ground's own light ink */
  --heading: var(--asili-cobalt);
  /* the placeholder frame: a flat mist field, a cobalt hairline, a white tag with a cobalt label and a small picture glyph */
  --ph-field: var(--asili-mist);
  --ph-line: #b4bdf2;
  --ph-tag: var(--asili-white);
  --ph-ink: var(--asili-cobalt);
  --ph-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56' fill='none' stroke='%23b4bdf2' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Crect x='5' y='9' width='46' height='38' rx='7'/%3E%3Ccircle cx='19' cy='22' r='4.5'/%3E%3Cpath d='m7 42 13-13 9 9 8-8 12 12'/%3E%3C/svg%3E");
  --ph-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'%3E%3Crect x='1.5' y='2.5' width='13' height='11' rx='2'/%3E%3Ccircle cx='5.5' cy='6.5' r='1.25'/%3E%3Cpath d='m2 12 3.6-3.6 2.4 2.4 2.4-2.4L14 12'/%3E%3C/svg%3E");
}

::selection { background: var(--asili-cobalt); color: var(--asili-white); }

/* Young Serif has one weight and no italic: never a faked bold or slant */
h1, h2, h3, h4 { font-synthesis: none; }
h1, h2 { color: var(--heading); }
.ground-brand, .ground-inverse { --heading: var(--ink); }

/* the client's logo in the bar, cobalt; in the dark footer, white */
.nav__logo { color: var(--asili-cobalt); }
.nav__logo svg { width: auto; }
.footer__logo { color: var(--asili-white); }
.footer__logo svg { height: 48px; }
@media (max-width: 639px) { .footer__logo svg { height: 32px; } }

/* ---------------------------------------------------------------- placeholder frames */
/* the field carries a faint picture mark in its middle (flat, in the hairline's colour), so an empty slot reads as a picture
   to come, never as a blank box */
.ph { position: relative; overflow: hidden; background: var(--ph-field); color: var(--ph-ink); border: 1px solid var(--ph-line); }
.ph::before { content: ""; position: absolute; inset: 0; width: auto; height: auto; padding: 0; background: var(--ph-mark) var(--ph-mark-at, center) / var(--ph-mark-size, 56px) no-repeat; pointer-events: none; }
.ph__tag {
  position: absolute; left: var(--s-4); bottom: var(--s-4); z-index: 1;
  display: inline-flex; align-items: flex-start; gap: var(--s-2); max-width: calc(100% - 2 * var(--s-4));
  padding: 6px var(--s-3) 6px 10px; border-radius: var(--r-sm); border: 1px solid var(--ph-line); background: var(--ph-tag);
  font: 500 var(--t-label)/1.4 var(--font-text); letter-spacing: 0; color: var(--ph-ink); text-align: left;
}
.ph__tag::before {
  content: ""; flex: none; width: 16px; height: 16px; margin-top: 1px; background: currentColor;
  -webkit-mask: var(--ph-glyph) center / contain no-repeat; mask: var(--ph-glyph) center / contain no-repeat;
}
@media (min-width: 1024px) { .ph__tag { left: var(--s-5); bottom: var(--s-5); max-width: calc(100% - 2 * var(--s-5)); } }
/* a frame holding a placeholder: the field fills it, the tag keeps its corner (system.css centres a frame's children) */
.frame.ph { border: 1px solid var(--ph-line); }
.frame.ph > .ph__tag { position: absolute; }
.tile__media.ph { border-radius: var(--r-lg); }

/* ---------------------------------------------------------------- the hero: the photograph's slot */
/* under the layer, the page ground (the kit's dark stands in for a photograph that has not loaded) */
.hero--photo { background: var(--bg); }
/* a hairline frame inset in the field, under the header, and the tag on the photograph's side at the wrap's right line */
.hero--photo::after {
  content: ""; position: absolute; z-index: 0; inset: calc(var(--nav) + var(--s-5)) var(--s-5) var(--s-5);
  border: 1px solid var(--ph-line); border-radius: var(--r-lg); pointer-events: none;
}
.hero-text > .ph__tag--hero { position: absolute; z-index: 1; }
@media (min-width: 1024px) { .hero-text > .ph__tag--hero { left: auto; right: 0; bottom: 0; } }
@media (max-width: 1023px) {
  .hero--photo::after { inset: calc(var(--nav) + var(--s-3)) var(--s-3) auto; height: calc(var(--photo) - 2 * var(--s-3)); border-radius: var(--r-md); }
  .hero-text > .ph__tag--hero { left: 0; bottom: calc(100% + var(--hgap) + var(--s-5)); }
}
/* a phone: the tag keeps to the left half of the wrap, on two lines */
@media (max-width: 639px) { .hero-text > .ph__tag--hero { max-width: calc(50% - var(--s-1)); } }
/* the box on a small laptop (1024-1279): seven columns and 32px inside, so the wide one-weight Young Serif h1 keeps to
   three lines at the size the heading scale needs */
@media (min-width: 1024px) and (max-width: 1279px) {
  .hero--photo .hero__text { width: calc((100% - 11 * var(--gutter)) / 12 * 7 + 6 * var(--gutter)); }
  .hero--photo:not([data-box="none"]) .hero__text { padding: var(--s-6); }
}
/* a phone: the h1 a step smaller, so the hero's words and both buttons end inside the first screen */
@media (max-width: 639px) { :root { --ly-scale: 0.8; } }

/* ---------------------------------------------------------------- the coffees: three cards, their fields */
#coffees .tile, #beans .tile { --tile-ratio: 3 / 2; }
.fields { display: grid; margin: 0; }
.fields > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s-4); padding-block: var(--s-2); border-bottom: 1px solid var(--line); }
.fields dt { color: var(--ink); }
.fields dd { margin: 0; color: var(--muted); text-align: right; }
.fields dd.is-known { color: var(--ink); }
/* a tablet keeps the three cards in one row, so the line-up stays one screen; the pair of forms stands taller */
@media (min-width: 640px) and (max-width: 1023px) {
  #coffees .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #coffees .grid > .tile { grid-column: auto; }
  #coffees .tile, #beans .tile { --tile-ratio: 4 / 5; }
  .fields > div { grid-template-columns: minmax(0, 1fr); }
  .fields dd { text-align: left; }
}
/* a phone: one card a row on a wide crop (two screens); the pair of forms two-up */
@media (max-width: 639px) {
  #coffees .grid > .tile { grid-column: 1 / -1; }
  #coffees .tile { --tile-ratio: 16 / 9; }
  #beans .grid > .tile { grid-column: auto / span 6; }
  #beans .tile { --tile-ratio: 1 / 1; }
  #beans .ph__tag { left: var(--s-2); bottom: var(--s-2); max-width: calc(100% - 2 * var(--s-2)); padding: 4px var(--s-2); }
  #beans .ph__tag::before { display: none; }
  #beans .ph { --ph-mark-at: center 26%; --ph-mark-size: 40px; }
}

/* ---------------------------------------------------------------- the subscription: pinned-chapters' picture slots
   (the moment's stylesheet loads after this file, so these rules carry the section's id) */
#subscription .mo-pc__visual.ph { aspect-ratio: 4 / 3; }
@media (min-width: 640px) { #subscription:not(.is-live) .mo-pc__visual.ph { max-height: 30svh; } }
#subscription.is-live .mo-pc__visual.ph { border: 0; aspect-ratio: auto; }
/* live, the shared frame stands as tall as the screen's content box, so the held screen reads as one section */
#subscription.is-live .mo-pc__visuals { aspect-ratio: 4 / 5; max-height: calc(100svh - var(--padt) - var(--padb)); border-color: var(--ph-line); }
/* 1024-1279: system.css lets a section's .wrap grow to the section (flex: 1 0 auto), which would stretch the held
   stage to both screens; the stage keeps its one screen */
@media (min-width: 1024px) and (max-width: 1279px) { #subscription.is-live > .mo-pc__grid { flex: none; } }
/* at rest on a tablet the steps stack, each over its picture, and the section is its two screens */
@media (min-width: 640px) and (max-width: 1023px) {
  main > #subscription:not(.is-live) { min-height: 200vh; min-height: 200svh; }
  #subscription:not(.is-live) .mo-pc__step { grid-template-columns: minmax(0, 1fr); }
  #subscription:not(.is-live) .mo-pc__step > .mo-pc__visual { grid-column: 1; grid-row: auto; margin-top: var(--s-4); }
  #subscription:not(.is-live) .mo-pc__visual.ph { aspect-ratio: 16 / 9; max-height: none; }
}
/* at rest on a phone: two screens, each step over a 4:3 picture */
@media (max-width: 639px) {
  main > #subscription:not(.is-live) { min-height: 200vh; min-height: 200lvh; }
}

/* ---------------------------------------------------------------- the brand band: the logo's own composition */
#origin { --muted: var(--asili-on-cobalt-muted); }
#origin p { line-height: 1.6; letter-spacing: 0.01em; }
.origin__mark { display: block; width: 100%; height: auto; color: var(--asili-white); }
@media (max-width: 1023px) {
  .origin__mark { margin-top: var(--s-6); }
  /* stacked, the band grows with what it holds (a short phone never lays the frame over the next section), and the
     frame keeps a wide crop rather than filling the screen, so the band ends with the same air as the others */
  #origin .wrap > .grid.fill { flex: 0 0 auto; }
  #origin .grid.fill > .frame--fill { flex: none; height: auto; min-height: 0; aspect-ratio: 2 / 1; }
}

/* ---------------------------------------------------------------- the questions: the head keeps to the top of its column;
   on a desktop the rows take a little more air, so the list fills its screen like its neighbours */
#faq .section-head { align-self: start; align-content: start; }
@media (min-width: 1280px) { #faq .faq > .faq__item { padding-block: var(--s-6); } #faq .faq > .faq__item:first-child { padding-top: 0; } }
/* a phone: the rows a step closer, so the five questions and their answers stay one screen */
@media (max-width: 639px) { #faq .faq > .faq__item { padding-block: var(--s-3); } #faq .faq > .faq__item:first-child { padding-top: 0; } }

/* ---------------------------------------------------------------- the footer: on a tablet the three columns end on the right line */
@media (min-width: 640px) and (max-width: 1023px) { .closing__links .footer__col { grid-column: auto / span 4; } }

/* ---------------------------------------------------------------- the language switcher (i18n.js) */
.lang { display: flex; align-items: center; }
.lang .lang__btn {
  height: 44px; min-width: 44px; justify-content: center; padding: 0 var(--s-2);
  border: 0; background: none; cursor: pointer; font-size: 15px; color: var(--muted);
}
.lang .lang__btn::before { left: var(--s-2); right: var(--s-2); bottom: 6px; }
.lang .lang__btn:hover { color: var(--ink); }
.lang .lang__btn[aria-pressed="true"] { color: var(--asili-cobalt); }
.lang .lang__btn[aria-pressed="true"]::after { content: ""; position: absolute; left: var(--s-2); right: var(--s-2); bottom: 6px; height: 2px; border-radius: 2px; background: currentColor; }
/* a tablet keeps it in the bar beside the main button; a phone shows it in the sheet, over the button */
@media (min-width: 640px) and (max-width: 1023px) { .nav:not(.is-open) .nav__actions > .lang { display: flex; } }
@media (max-width: 1023px) { .nav.is-open .nav__actions > .lang { justify-content: center; gap: var(--s-4); } }
