/* [thiss_library] (inc/shortcode.php): the gate and the card grid in the new THISS website's style (Website v3
   assets/site.css: tokens, DM Sans text, Jost uppercase labels, 16px cards, pill buttons, .chips .grid .card
   .card-media.is-tall.is-contain .badge .btn-ink .btn-line .kicker .sub-field). Everything is scoped under .thiss-lib
   with --tl- variables and sets its own type, colours and spacing, so it looks the same inside any theme or Elementor. */
.thiss-lib {
  --tl-bg: #fdfcfb;
  --tl-ink: #1c1b1a;
  --tl-muted: #6b6560;
  --tl-line: #e8e3de;
  --tl-surface: #f3f0ed;
  --tl-panel: #f6eeea;
  --tl-accent: #c4977a;
  --tl-accent-soft: #d3b49c;
  --tl-card: #fff;
  --tl-error: #8a3b24;
  --tl-radius: 16px;
  --tl-ease: cubic-bezier(.16, 1, .3, 1);
  --tl-f-ui: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --tl-f-label: "Jost", "Futura", "Century Gothic", "Helvetica Neue", Arial, sans-serif;
  color: var(--tl-ink);
  font: 400 16px/1.6 var(--tl-f-ui);
  letter-spacing: normal;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
/* the new site's own dark mode, when it sets one */
:root[data-theme="dark"] .thiss-lib {
  --tl-bg: #121110; --tl-ink: #f1ede9; --tl-muted: #aaa29b; --tl-line: #2d2a27; --tl-surface: #1c1a19; --tl-panel: #221e1b;
  --tl-accent: #dcb79c; --tl-accent-soft: #8a6a55; --tl-card: #1c1a19; --tl-error: #f0a58c;
}
.thiss-lib *, .thiss-lib *::before, .thiss-lib *::after { box-sizing: border-box; }
.thiss-lib [hidden] { display: none !important; }
.thiss-lib :focus-visible { outline: 2px solid var(--tl-ink); outline-offset: 3px; border-radius: 4px; }
.thiss-lib .tl-icon { width: 16px; height: 16px; flex: none; display: block; fill: currentColor; }
.thiss-lib p { margin: 0; }

/* pill buttons */
.thiss-lib .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; height: 48px; margin: 0; padding: 0 1.5em;
  border: 1px solid transparent; border-radius: 999px; box-shadow: none;
  font: 500 .95rem/1 var(--tl-f-ui); letter-spacing: normal; text-transform: none; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .35s var(--tl-ease), background-color .3s, color .3s, border-color .3s;
}
.thiss-lib .btn:active { transform: scale(.98); }
.thiss-lib .btn .tl-icon { transition: transform .35s var(--tl-ease); }
.thiss-lib .btn:hover .tl-icon { transform: translateY(2px); }
.thiss-lib .btn-ink, .thiss-lib .btn-ink:visited { background: var(--tl-ink); color: var(--tl-bg); }
.thiss-lib .btn-ink:hover, .thiss-lib .btn-ink:focus { background: var(--tl-accent); color: var(--tl-ink); }
.thiss-lib .btn-line, .thiss-lib .btn-line:visited { background: transparent; color: var(--tl-ink); border-color: color-mix(in srgb, var(--tl-ink) 30%, transparent); }
.thiss-lib .btn-line:hover, .thiss-lib .btn-line:focus { background: transparent; color: var(--tl-ink); border-color: var(--tl-ink); }

/* ------------------------------------------------------------------ the gate */
.thiss-lib .tl-gate {
  display: grid; justify-items: center; gap: 18px; max-width: 680px; margin: 0 auto; padding: clamp(40px, 7vw, 80px) clamp(20px, 5vw, 56px);
  background: var(--tl-panel); border-radius: var(--tl-radius); text-align: center;
}
.thiss-lib .tl-title {
  margin: 0; padding: 0; color: var(--tl-ink); font: 500 clamp(1.9rem, 3.4vw, 2.8rem)/1.08 var(--tl-f-ui);
  letter-spacing: -.03em; text-transform: none; text-wrap: balance;
}
.thiss-lib .tl-text { display: grid; gap: .6em; max-width: 46ch; color: var(--tl-muted); font-weight: 300; font-size: clamp(1rem, 1.25vw, 1.08rem); }
.thiss-lib .tl-embed { width: 100%; max-width: 520px; }
.thiss-lib .tl-embed iframe { width: 100%; border: 0; }
/* two views, one at a time (inc/shortcode.php render_gate): Join, or the password box */
.thiss-lib .tl-view { display: grid; justify-items: center; gap: 18px; width: 100%; }
.thiss-lib .tl-gate[data-view="join"] .tl-view-pass, .thiss-lib .tl-gate[data-view="pass"] .tl-view-join { display: none; }
.thiss-lib .tl-switch { margin: 8px 0 0; }
.thiss-lib .tl-switch button {
  height: auto; min-height: 0; margin: 0; padding: 4px 2px; border: 0; border-radius: 4px; box-shadow: none; background: none; color: var(--tl-ink);
  font: 500 .9rem/1.4 var(--tl-f-ui); letter-spacing: normal; text-transform: none; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.thiss-lib .tl-switch button:hover, .thiss-lib .tl-switch button:focus { background: none; color: var(--tl-accent); }
.thiss-lib .tl-unlock { display: grid; gap: 10px; width: 100%; max-width: 440px; margin-top: 6px; text-align: left; }
.thiss-lib .tl-unlock label { display: block; margin: 0; padding: 0; color: var(--tl-ink); font: 500 .9rem/1.4 var(--tl-f-ui); letter-spacing: normal; text-transform: none; }
.thiss-lib .sub-field {
  display: flex; align-items: center; margin: 0; padding: 5px 5px 5px 20px; background: #fff; border: 1px solid color-mix(in srgb, #1c1b1a 18%, transparent); border-radius: 999px;
}
/* focus: the field's own edge goes from thin to bold (like the blog form and a search bar), no ring around it */
.thiss-lib .sub-field { transition: border-color .2s, box-shadow .2s; }
.thiss-lib .sub-field:focus-within { border-color: #151413; box-shadow: inset 0 0 0 1px #151413; }
.thiss-lib .sub-field input,
.thiss-lib .sub-field input[type="password"] {
  flex: 1; min-width: 0; width: auto; height: 40px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; outline: 0; box-shadow: none;
  background: transparent; color: #151413; font: 400 1rem/1 var(--tl-f-ui); letter-spacing: normal;
}
.thiss-lib .sub-field input[aria-invalid="true"] { color: #151413; }
.thiss-lib .sub-field button {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; min-width: 0; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: 999px; box-shadow: none; background: #151413; color: #fff; cursor: pointer; transition: background-color .3s;
}
.thiss-lib .sub-field button:hover, .thiss-lib .sub-field button:focus { background: var(--tl-accent); color: #151413; }
.thiss-lib .sub-field button .tl-icon { width: 18px; height: 18px; }
.thiss-lib .tl-msg { min-height: 1.4em; color: var(--tl-error); font-size: .88rem; font-weight: 500; }

/* ------------------------------------------------------------------ the library: chips and cards */
.thiss-lib .tl-staff { margin: 0 0 20px; padding: 12px 16px; background: var(--tl-panel); border-radius: 12px; color: var(--tl-muted); font-size: .88rem; }
.thiss-lib .tl-staff a { color: var(--tl-ink); text-decoration: underline; text-underline-offset: 3px; }
.thiss-lib .tl-empty { margin: 0; padding: 32px 0; color: var(--tl-muted); text-align: center; }

.thiss-lib .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; }
.thiss-lib .chips button {
  height: 38px; min-height: 0; margin: 0; padding: 0 16px; border: 1px solid color-mix(in srgb, var(--tl-ink) 22%, transparent); border-radius: 999px; box-shadow: none;
  background: transparent; color: var(--tl-ink); font: 400 .88rem/1 var(--tl-f-ui); letter-spacing: normal; text-transform: none; cursor: pointer;
  transition: background-color .25s, color .25s, border-color .25s;
}
.thiss-lib .chips button:hover, .thiss-lib .chips button:focus { background: transparent; color: var(--tl-ink); border-color: var(--tl-ink); }
.thiss-lib .chips button[aria-pressed="true"] { background: var(--tl-ink); color: var(--tl-bg); border-color: var(--tl-ink); }

.thiss-lib .grid { display: grid; gap: 28px 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); margin: 0; padding: 0; }
.thiss-lib .card { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.thiss-lib .card[hidden] { display: none; }
.thiss-lib .card-media { position: relative; display: block; overflow: hidden; border-radius: var(--tl-radius); background: var(--tl-surface); aspect-ratio: 5 / 4; }
.thiss-lib .card-media.is-tall { aspect-ratio: 4 / 5; }
.thiss-lib .card-media img {
  display: block; width: 100%; height: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none;
  object-fit: cover; transition: transform .8s var(--tl-ease);
}
.thiss-lib .card-media.is-contain img { object-fit: contain; padding: 8%; }
.thiss-lib .card:hover .card-media img { transform: scale(1.04); }
.thiss-lib .tl-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--tl-accent); font: 500 .8rem/1 var(--tl-f-label); letter-spacing: .3em; text-transform: uppercase; }
.thiss-lib .card small { display: block; color: var(--tl-muted); font: 400 .68rem/1.3 var(--tl-f-label); letter-spacing: .14em; text-transform: uppercase; }
.thiss-lib .card h3 { margin: 0; padding: 0; color: var(--tl-ink); font: 500 1.05rem/1.3 var(--tl-f-ui); letter-spacing: -.01em; text-transform: none; }
.thiss-lib .card p { margin: 0; color: var(--tl-muted); font-size: .92rem; font-weight: 400; line-height: 1.55; }
/* Download (or Open) sits over the picture's bottom-right corner and show on hover (always on touch
   screens, which can't hover). The theme's hover lift moves to the wrapper so the buttons rise with the picture. */
.thiss-lib .tl-media { position: relative; border-radius: var(--tl-radius); transition: transform .25s; }
.thiss-lib .tl-media .card-media:hover { transform: none; box-shadow: none; }
.thiss-lib .tl-media:hover { transform: translateY(-2px); }
.thiss-lib .tl-media:hover .card-media { box-shadow: 0 16px 36px -22px rgba(0, 0, 0, .35); }
.thiss-lib .tl-actions { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.thiss-lib .card .tl-get { box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .35); }
.thiss-lib .card .tl-get, .thiss-lib .card .tl-get:visited { height: 40px; padding: 0 18px; background: var(--tl-card); color: var(--tl-ink); border-color: var(--tl-line); font-size: .88rem; pointer-events: auto; }
.thiss-lib .card .tl-get:hover, .thiss-lib .card .tl-get:focus { background: var(--tl-card); color: var(--tl-ink); border-color: var(--tl-ink); }
@media (hover: hover) {
  .thiss-lib .tl-actions { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .35s var(--tl-ease); }
  .thiss-lib .tl-media:hover .tl-actions, .thiss-lib .tl-media:focus-within .tl-actions { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
  .thiss-lib .tl-gate { border-radius: 12px; }
  .thiss-lib .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 24px 12px; }
  .thiss-lib .tl-actions { right: 8px; bottom: 8px; }
  .thiss-lib .card .tl-get { height: 36px; padding: 0 14px; font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  .thiss-lib .btn, .thiss-lib .btn .tl-icon, .thiss-lib .card-media img, .thiss-lib .tl-media, .thiss-lib .tl-actions { transition: none; }
  .thiss-lib .tl-media:hover { transform: none; }
  .thiss-lib .card:hover .card-media img { transform: none; }
}

/* the website's own sign-up form inside the gate (same pill field as the site footer, light colors) */
.thiss-lib .tl-join { display: grid; gap: 8px; max-width: 440px; margin: 24px auto 0; text-align: left; }
.thiss-lib .tl-join label { color: var(--tl-ink); font: 500 .86rem/1.3 var(--tl-f-ui); }
.thiss-lib .tl-join .sub-note { margin: 2px 0 0; color: var(--tl-muted); font-size: .8rem; }
.thiss-lib .tl-join .sub-msg { min-height: 1.3em; margin: 0; color: var(--tl-ink); font-size: .86rem; }
.thiss-lib .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.thiss-lib .screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* The THISS theme's library page for members: the library section opens the page (no join hero above it), so it takes
   the blog masthead's top gap (.ed-mast) instead of the section gap (.sec, up to 128px). Kept here, not in the theme,
   so it ships without a theme upload. Visitors see the hero first, so this doesn't match for them. */
main > #inside:first-child { padding-top: clamp(40px, 5vw, 76px); }

/* The THISS theme's library page for visitors: an even rhythm around "What's inside". The gap above it was the full
   section gap (128px) while the gate touched the topic chips below; now a shorter gap above and room below the gate. */
main > section[aria-labelledby="howLib"], main > #inside:not(:first-child) { padding-top: clamp(56px, 6vw, 88px); } /* "How it works" under the hero too */
.thiss-lib.is-locked { margin-bottom: clamp(32px, 4vw, 48px); }

/* The THISS theme's library page for visitors: the preview grid (#libGrid) is a teaser of its first 8 freebies, then a
   "Plus N more" join prompt (assets/library.js); its topic chips go too, as 8 cards need no filter. */
#libGrid > .card:nth-child(n+9) { display: none; }
.chips[data-filter="libGrid"] { display: none; }
.tl-more { display: grid; justify-items: center; gap: 16px; margin-top: clamp(36px, 4vw, 56px); text-align: center; }
.tl-more p { margin: 0; color: var(--muted, #6b6560); font-size: clamp(1rem, 1.25vw, 1.08rem); }

/* Scroll reveal (assets/library.js): the gate, the cards and the join prompt fade up gently as they come into view, the
   same as the theme's [data-m="up"] blocks (the stickers page cards). JavaScript adds .tl-rise only to things still below the screen, so nothing
   already in view blinks, and without JavaScript everything simply shows. */
@media (prefers-reduced-motion: no-preference) {
  .tl-rise { opacity: 0; transform: translateY(34px); transition: opacity .9s cubic-bezier(.16, 1, .3, 1) var(--tl-d, 0s), transform 1.1s cubic-bezier(.16, 1, .3, 1) var(--tl-d, 0s); }
  .tl-rise.is-in { opacity: 1; transform: none; }
}
