/* Felt: the look of lucabosch.com (its assets/css/site.css) for a site of its own.
   The board, patches, strips of dark felt, buttons, fields, nametags and fonts, all
   served from /felt/ on this site. The same file sits in each of these sites, so a
   change here is copied to the others rather than made in one.

   A page with patches carries the stitch thread once, right after <body>:
   <svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false">
     <filter id="thread" x="-2%" y="-2%" width="104%" height="106%">
       <feGaussianBlur stdDeviation=".7" />
       <feComponentTransfer><feFuncA type="linear" slope="4" intercept="-1.3" /></feComponentTransfer>
       <feDropShadow dx="0" dy="1" stdDeviation=".35" flood-color="#000" flood-opacity=".3" />
     </filter>
   </svg> */

/* Baloo 2 and Space Mono in Google Fonts' subsets: a page only fetches the ones
   its text needs. Other scripts (Cyrillic, Arabic, Thai, CJK…) fall back to the
   system fonts in the stacks below. */
@font-face {
  font-family: 'Baloo 2';
  src: url('baloo2-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Baloo 2';
  src: url('baloo2-latin-ext.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo 2';
  src: url('baloo2-vietnamese.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Baloo 2';
  src: url('baloo2-devanagari.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;
}
@font-face {
  font-family: 'Space Mono';
  src: url('spacemono-400-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Mono';
  src: url('spacemono-400-latin-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Mono';
  src: url('spacemono-400-vietnamese.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Space Mono';
  src: url('spacemono-700-latin.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Mono';
  src: url('spacemono-700-latin-ext.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Mono';
  src: url('spacemono-700-vietnamese.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* ---------------- tokens ---------------- */

:root {
  --font-felt: 'Baloo 2', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  /* the board the patches are pinned to */
  --board:        #f2e4c8;
  --board-deep:   #e6d3ae;
  --ink:          #2b1c08;
  --ink-soft:     #7c6746;
  --rule:         rgba(43, 28, 8, .14);

  /* felt swatches — physical colours, identical in both themes */
  --felt-mustard: #e8a83a;
  --felt-mustard-lo: #c78d23;
  --felt-cream:   #f6f0e0;
  --felt-cream-lo:#ddd0ab;
  --navy:         #22233d;
  --navy-deep:    #0e0e1c;
  --navy-soft:    rgba(34, 35, 61, .42);
  --navy-text:    rgba(34, 35, 61, .72);
  --brown:        #271c11;
  --orange:       #f0854a;
  --pink:         #d8477e;
  --pink-lo:      #a33461;
  --thread:       #faf4e4;
  --thread-soft:  rgba(250, 244, 228, .62);
  --thread-ink:   rgba(34, 35, 61, .4);
  /* text on pale cloth for good and bad news */
  --good:         #2f6b29;
  --bad:          #a8325f;

  /* matted fibres (light ones catch the light, dark ones are the pores
     between them) over soft clouds where the felt is denser. Both tile
     seamlessly; the uneven size ratio hides the repeat.
     Image paths in these properties start at the site root: Chrome resolves
     them against the stylesheet that uses var(), so a relative path would
     break in the sites' own stylesheets. */
  --fiber: url('/felt/felt-fibre.png'), url('/felt/felt-cloud.png');
  --fiber-size: 256px 256px, 700px 700px;
  /* pale cloth shows its fibres far less, so pale surfaces lay a veil of
     their own colour over them (as an extra layer sized auto) */
  --cream-veil: linear-gradient(rgba(246, 240, 224, .5), rgba(246, 240, 224, .5));
  --white-veil: linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .35));
  /* a patch's thickness: the top edge catches the light, the bottom rolls into shade */
  --felt-shade: linear-gradient(rgba(255, 255, 255, .14), transparent 12px, transparent calc(100% - 14px), rgba(0, 0, 0, .12));

  /* the board is the same cloth seen a little closer, so it reads as its
     own sheet rather than a bigger patch. Pale board mutes the fibres under
     its veil; dark board blends them soft-light so they scale to its tone. */
  --fiber-board: url('/felt/felt-fibre.png'), url('/felt/felt-cloud.png');
  --fiber-board-size: 330px 330px, 1060px 1060px;
  --board-veil: rgba(242, 228, 200, .55);
  --board-blend: normal;

  /* 9-slice alpha mask of a scissor-cut edge: a slightly wavering cut with
     fibres poking out past it. Its corners are drawn at a 20px radius and
     the fringe reaches 3px past the cut, both scaled by --edge. */
  --felt-edge: url('/felt/felt-edge.png');
  --edge: 32px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --board:      #1b1610;
    --board-deep: #110d08;
    --ink:        #f0e7d5;
    --ink-soft:   #ac9d80;
    --rule:       rgba(240, 231, 213, .14);
    --board-veil: transparent;
    --board-blend: soft-light;
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--board);
  background-image: linear-gradient(var(--board-veil), var(--board-veil)), var(--fiber-board);
  background-size: auto, var(--fiber-board-size);
  background-blend-mode: var(--board-blend);
  color: var(--ink);
  font-family: var(--font-felt);
  -webkit-font-smoothing: antialiased;
}

/* the board gets a soft vignette so patches read as lit from above */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 1200px 700px at 50% -8%, var(--board-deep), transparent 70%);
}

/* ---------------- felt patch ---------------- */

/* --card-bg, --card-border, --tilt and --edge pick a patch's cloth, thread, angle
   and fringe. Each patch starts from the defaults, so one laid on another doesn't
   take on the cloth it lies on. */
.felt {
  --card-bg: var(--felt-cream);
  --card-border: var(--felt-cream-lo);
  --tilt: none;
  --edge: 32px;
  --fringe: calc(var(--edge) * 3 / 32);
  position: relative;
  isolation: isolate;
  border-radius: 20px;
  color: var(--navy);
  transform: var(--tilt);
  /* felt is thin and lies flat: a tight contact shadow plus a soft ambient
     one. The cut runs along the box edge, so box-shadow traces it closely
     enough; a drop-shadow filter would follow the fringe too, but makes
     Chrome rasterise the patch's images in one go as it scrolls in (jank). */
  box-shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 5px 6px rgba(0, 0, 0, .14);
}

/* the cloth. It lies on its own layer (::before) so its cut edge can fray
   without touching the content, and the patch carries it again underneath:
   on a tilted patch the nine slices of the edge mask leave hairline seams,
   and those have to show cloth rather than the board. */
.felt,
.felt::before {
  background-color: var(--card-bg);
  background-image: var(--felt-shade), var(--fiber);
  background-size: 100% 100%, var(--fiber-size);
}
.felt::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
}
@supports (-webkit-mask-box-image: none) {
  .felt::before {
    inset: calc(var(--fringe) * -1);
    /* fibres lined up with the layer underneath, so a seam blends like with like */
    background-position: 0 0, var(--fringe) var(--fringe), var(--fringe) var(--fringe);
    -webkit-mask-box-image: var(--felt-edge) 128 fill / var(--edge) round;
  }
}

/* topstitch, always set well inside the edge — never hugging it. #thread
   rounds the dashes into stitches lying on the cloth. It lies on the cloth
   (z-index -1, after it) and under the content, so a patch's content needs
   no z-index of its own, and anything with a fill of its own covers it. */
.felt::after {
  content: '';
  position: absolute;
  inset: 11px;
  z-index: -1;
  border-radius: 10px;
  border: 2px dashed var(--card-border);
  filter: url(#thread);
  pointer-events: none;
}

/* pale cloth (cream, the default) mutes its fibres under a veil, as site.css
   does for the pale patches it lays over the board */
.felt.is-pale,
.felt.is-pale::before {
  background-image: var(--felt-shade), var(--cream-veil), var(--fiber);
  background-size: 100% 100%, auto, var(--fiber-size);
}
@supports (-webkit-mask-box-image: none) {
  .felt.is-pale::before {
    background-position: 0 0, 0 0, var(--fringe) var(--fringe), var(--fringe) var(--fringe);
  }
}

/* patches that open something on click get a lift on hover, so the
   whole card reads as pressable rather than just its button/link */
.felt.is-clickable {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.felt.is-clickable:hover {
  transform: var(--tilt) translateY(-6px);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .16), 0 14px 12px rgba(0, 0, 0, .22);
}

/* a scrap of pale cloth stitched onto a patch: readouts, list rows, seats */
.scrap {
  border: 1.5px dashed var(--navy-soft);
  border-radius: 10px;
  background-color: rgba(255, 255, 255, .5);
  background-image: var(--white-veil), var(--fiber);
  background-size: auto, var(--fiber-size);
  color: var(--navy);
}

/* ---------------- strips of dark felt (top bar, footer) ---------------- */

/* As with the patches, the cloth lies on its own layer so the edge facing the
   board can fray (the mask draws only that one edge of the 9-slice), and again
   underneath to fill the slice seams that fractional display scaling leaves.
   Soft-light keeps the fibres from reading as specks on cloth this dark. */
.felt-topbar,
.felt-footer {
  position: relative;
  isolation: isolate;
  color: var(--thread);
}
.felt-topbar { box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .5); }
.felt-topbar,
.felt-topbar::before,
.felt-footer,
.felt-footer::before {
  background-color: var(--brown);
  background-image: var(--fiber);
  background-size: var(--fiber-size);
  background-blend-mode: soft-light;
}
.felt-topbar::before,
.felt-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
}
@supports (-webkit-mask-box-image: none) {
  .felt-topbar::before {
    bottom: calc(var(--edge) * -3 / 32);
    -webkit-mask-box-image: var(--felt-edge) 128 fill / 0 0 var(--edge) 0 round;
  }
  .felt-footer::before {
    top: calc(var(--edge) * -3 / 32);
    /* fibres lined up with the layer underneath, so a seam blends like with like */
    background-position: 0 calc(var(--edge) * 3 / 32);
    -webkit-mask-box-image: var(--felt-edge) 128 fill / var(--edge) 0 0 0 round;
  }
}

/* links on a strip: little pills with a thread outline */
.topnav { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.topnav a {
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--thread);
  font-size: .82rem;
  font-variation-settings: 'wght' 700;
  font-weight: 700;
  text-decoration: none;
  border: 1.5px dashed rgba(250, 244, 228, .3);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.topnav a:hover,
.topnav a:focus-visible {
  background-color: var(--felt-mustard);
  border-color: var(--felt-mustard);
  color: var(--navy);
}

/* ---------------- felt buttons ---------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  border: 0;
  border-radius: 14px;
  background-color: var(--navy);
  background-image: var(--fiber);
  background-size: var(--fiber-size);
  color: var(--orange);
  font-family: var(--font-felt);
  font-size: .86rem;
  font-variation-settings: 'wght' 700;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--navy-deep), 0 7px 12px -5px rgba(0, 0, 0, .45);
  transition: transform .1s ease, box-shadow .1s ease;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 8px;
  border: 1.5px dashed rgba(250, 244, 228, .32);
  pointer-events: none;
}
.btn > * { position: relative; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--navy-deep), 0 10px 15px -5px rgba(0, 0, 0, .45); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--navy-deep); }

.btn-light {
  background-color: var(--felt-cream);
  background-image: var(--cream-veil), var(--fiber);
  background-size: auto, var(--fiber-size);
  color: var(--navy);
  box-shadow: 0 4px 0 var(--felt-cream-lo), 0 7px 12px -5px rgba(0, 0, 0, .35);
}
.btn-light::before { border-color: var(--thread-ink); }
.btn-light:hover { box-shadow: 0 6px 0 var(--felt-cream-lo), 0 10px 15px -5px rgba(0, 0, 0, .35); }
.btn-light:active { box-shadow: 0 2px 0 var(--felt-cream-lo); }

/* the one in use, or the one that's open, in mustard */
.btn-mustard {
  background-color: var(--felt-mustard);
  background-image: var(--fiber);
  background-size: var(--fiber-size);
  color: var(--navy);
  box-shadow: 0 4px 0 var(--felt-mustard-lo), 0 7px 12px -5px rgba(0, 0, 0, .35);
}
.btn-mustard::before { border-color: var(--thread-ink); }
.btn-mustard:hover { box-shadow: 0 6px 0 var(--felt-mustard-lo), 0 10px 15px -5px rgba(0, 0, 0, .35); }
.btn-mustard:active { box-shadow: 0 2px 0 var(--felt-mustard-lo); }

/* deleting something */
.btn-pink {
  background-color: var(--pink);
  color: var(--thread);
  box-shadow: 0 4px 0 var(--pink-lo), 0 7px 12px -5px rgba(0, 0, 0, .45);
}
.btn-pink:hover { box-shadow: 0 6px 0 var(--pink-lo), 0 10px 15px -5px rgba(0, 0, 0, .45); }
.btn-pink:active { box-shadow: 0 2px 0 var(--pink-lo); }

.btn-sm { padding: 8px 14px; font-size: .78rem; border-radius: 12px; }
.btn-sm::before { inset: 5px; border-radius: 7px; }

/* not ready to press yet: faded, and it doesn't move */
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------------- nametags and tags ---------------- */

/* little felt nametags for labelled rows and panel titles */
.label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 5px 11px;
  border-radius: 9px;
  background-color: var(--felt-cream);
  background-image: var(--cream-veil), var(--fiber);
  background-size: auto, var(--fiber-size);
  border: 1.5px dashed var(--felt-cream-lo);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .18), 0 3px 5px -2px rgba(0, 0, 0, .25);
  font-family: var(--font-felt);
  font-size: .7rem;
  font-variation-settings: 'wght' 700;
  font-weight: 700;
  letter-spacing: .09em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--navy);
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, .5);
  background-image: var(--white-veil), var(--fiber);
  background-size: auto, var(--fiber-size);
  border: 1.5px dashed var(--navy-soft);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .14);
  font-family: var(--font-mono);
  font-size: .64rem;
  font-weight: 700;
  color: var(--navy);
}

/* ---------------- form fields ---------------- */

/* a scrap of the same pale cloth as the tags, stitched on and pressed in a
   little where a button stands up */
.field {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px dashed var(--navy-soft);
  border-radius: 10px;
  background-color: rgba(255, 255, 255, .5);
  background-image: var(--white-veil), var(--fiber);
  background-size: auto, var(--fiber-size);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .12);
  color: var(--navy);
  color-scheme: light;
  font-family: var(--font-mono);
  font-size: .8rem;
}
.field::placeholder { color: var(--navy-soft); opacity: 1; }
.field:disabled { opacity: .6; cursor: not-allowed; }
select.field { cursor: pointer; }
.felt input[type="checkbox"],
.felt input[type="radio"],
.felt input[type="range"] { accent-color: var(--navy); }

/* ---------------- dialogs ---------------- */

.dialog-felt {
  --card-bg: var(--felt-cream);
  --card-border: var(--felt-cream-lo);
  padding: 24px 22px;
  border-radius: 20px;
  /* held up off the board, so it casts a longer shadow than a patch */
  box-shadow: 0 2px 2px rgba(0, 0, 0, .2), 0 18px 22px rgba(0, 0, 0, .35);
}
.dialog-felt,
.dialog-felt::before {
  background-image: var(--felt-shade), var(--cream-veil), var(--fiber);
  background-size: 100% 100%, auto, var(--fiber-size);
}
@supports (-webkit-mask-box-image: none) {
  .dialog-felt::before {
    background-position: 0 0, 0 0, var(--fringe) var(--fringe), var(--fringe) var(--fringe);
  }
}
.dialog-felt h3 {
  margin: 0 0 14px;
  font-size: 1.12rem;
  font-variation-settings: 'wght' 800;
  font-weight: 800;
  color: var(--navy);
}
.dialog-felt p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.6;
  color: var(--navy);
}
.dialog-felt p a { color: var(--navy); text-underline-offset: 3px; }

.dialog-close {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--navy);
  color: var(--thread);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 6px -2px rgba(0, 0, 0, .5);
}
.dialog-close:hover { background: var(--pink); }

/* The consent banner (consent.js): a felt dialog held at the bottom of the
   window, with "Decline" and "Accept" as buttons of the same kind. */
#cc-banner {
  position: fixed;
  z-index: 2147483000;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: 28px;
  text-align: start;
}
#cc-banner p a { white-space: nowrap; }
#cc-banner .cc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
#cc-banner .btn { flex: 1 1 120px; justify-content: center; }
@media print { #cc-banner { display: none; } }

/* ---------------- focus + motion ---------------- */

a:focus-visible,
button:focus-visible,
summary:focus-visible,
.field:focus-visible {
  outline: 3px dashed var(--pink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
