:root {
  /* The Ritual Studio app's palette (Theme.xaml), shared with /studio/ */
  --bg: #101010;          /* page */
  --surface: #171717;     /* toolbars, panels */
  --surface-2: #1C1C1C;   /* inspector, popups */
  --surface-3: #252525;   /* hover, secondary button */
  --input: #141414;       /* wells, lists */
  --line: #2A2A2A;        /* region dividers */
  --line-strong: #3A3A3A; /* control borders */
  --ink: #F5F5F5;         /* text */
  --muted: #999999;       /* secondary text, 6.8:1 on --bg */
  --caption: #8C8C8C;     /* small-caps labels */
  /* One accent. Fills carrying white text use the darker blue (4.6:1); blue text uses the lighter one. */
  --accent: #0B74DB;
  --accent-hover: #0A68C6;
  --accent-ink: #FFFFFF;
  --accent-text: #5CB0FF;
  --accent-soft: #0E1D2E;
  --accent-selected: #132B47;
  --warning: #E8A33D;
  --danger: #E5484D;
  /* The old per-category pastels all become the one accent, the way the app colours selection */
  --lilac: var(--accent-text); --rose: var(--accent-text); --sage: var(--accent-text); --slate: var(--accent-text);
  --lilac-deep: var(--surface); --rose-deep: var(--surface); --sage-deep: var(--surface); --slate-deep: var(--surface);
  --radius: 2px;
  --display: "Bahnschrift", "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --text: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, sans-serif;
  --code: "Cascadia Mono", "JetBrains Mono", Consolas, monospace; /* taste-skill-ignore: numbers, prices and file names, as in the app */
  --margin: clamp(16px, 2.2vw, 32px);
  --gap: clamp(96px, 11vw, 160px);
  --ease: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);

  --step-small: .875rem;
  --step-body: clamp(1rem, .97rem + .15vw, 1.0625rem);
  --step-lead: clamp(1.125rem, 1.05rem + .4vw, 1.375rem);
  --step-head: clamp(2.25rem, 1.5rem + 2.6vw, 3.5rem);
  color-scheme: dark;
  accent-color: var(--accent);
  caret-color: var(--accent-text);
  scrollbar-color: var(--line-strong) var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: from-font; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Display type: condensed, uppercase, tight */
.hero-title, .tools-body h2, .faq h1 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: -0.01em; line-height: .9; text-wrap: balance;
}

main {
  position: relative;
  z-index: 2;
  background: var(--bg);
  padding-bottom: var(--gap);
}

/* Buttons: square, flat, one shape everywhere */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  font: 500 var(--step-body)/1 var(--text);
  text-decoration: none; border: 0; border-radius: 0; cursor: pointer; white-space: nowrap;
  transition: transform .16s var(--ease), background-color .15s ease, color .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn[aria-disabled="true"]:active { transform: none; }
.btn-accent[aria-disabled="true"]:hover { background: var(--accent); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #dcb4c2; }
.btn-dark { background: var(--surface-2); color: var(--ink); }
.btn-dark:hover { background: #26242e; }
.btn-quiet { background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; padding: 0 12px; }
.btn-quiet:hover { color: var(--ink); text-decoration-thickness: 2px; }

/* Top bar */
.bar {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 24px var(--margin);
}
.mark { display: block; width: max-content; padding: 4px 0; }
.mark img { height: 36px; width: auto; }
.bar-links { display: flex; gap: 32px; }
.bar-links a { text-decoration: none; font-size: var(--step-body); position: relative; padding: 10px 0; }
.bar-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .2s var(--ease);
}
.bar-links a:hover::after, .bar-links a:focus-visible::after { transform: scaleX(1); }
.bar .btn { justify-self: end; }

/* Hero: the logo on the dot grid */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 112px var(--margin) 72px;
  text-align: center;
  background: #050506 url(images/grid-tile.png) repeat;
  background-size: 160px;
}
.hero-logo {
  width: min(62vw, 960px); height: auto;
  animation: logo-in 1.1s var(--ease) both;
}
@keyframes logo-in { from { opacity: 0; transform: scale(.96); } }
.hero-title {
  margin-top: clamp(20px, 3vw, 40px);
  font-size: clamp(2.5rem, 1.4rem + 3.6vw, 4.75rem);
  max-width: 16ch;
}
.hero-lead { font-size: var(--step-lead); line-height: 1.35; max-width: 40ch; margin-top: 20px; color: var(--ink); }
.hero-meta {
  list-style: none; padding: 0; margin: 24px 0 0;
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  font-size: var(--step-body);
}
.star {
  width: 14px; height: 14px; background: var(--accent);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.hero .btn { margin-top: 32px; }

.cfg-file {
  margin: 0; padding: 28px; min-height: 260px;
  background: var(--bg); color: var(--ink);
  font: 15px/1.7 var(--code); overflow-x: auto; white-space: pre;
}
.cfg-file .c { color: var(--muted); }
.cfg-file .k { color: var(--accent); }

/* Featured: Ritual Studio. A big real screenshot that opens the product page, and the details beside it. */
.tools {
  margin-top: var(--gap);
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  background: var(--surface);
}
.plate {
  position: relative; display: block; aspect-ratio: 16 / 9; margin: 40px; align-self: center;
  overflow: hidden; background: #000;
}
.plate-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
@media (hover: hover) and (pointer: fine) { .plate:hover .plate-shot { transform: scale(1.02); } }
.tools-body h2 a { color: inherit; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .tools-body h2 a:hover { text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .12em; } }

.tools-side {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px var(--margin) 56px 24px;
}
.tabs { display: flex; gap: 28px; flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer;
  font: 400 var(--step-body)/1.2 var(--text); color: var(--muted);
  position: relative;
}
.tabs button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 3px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .2s var(--ease);
}
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 500; }
.tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.tabs button:hover { color: var(--ink); }
.tools-body { margin: 48px 0; }
.tools-body h2 { font-size: var(--step-head); }
.tools-name { font-size: var(--step-lead); margin-top: 28px; font-weight: 500; color: var(--accent); }
.tools-desc { max-width: 38ch; margin-top: 12px; }
.cells { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.cell {
  min-height: 72px; display: flex; align-items: center; justify-content: center; padding: 0 16px;
  font: 500 var(--step-body)/1.2 var(--text); text-decoration: none; border: 0; border-radius: 0; cursor: pointer;
  transition: background-color .15s ease, transform .18s var(--ease);
}
.cell:active { transform: scale(.98); }
.cell-ink { background: var(--accent); color: var(--accent-ink); }
.cell-ink:hover { background: #dcb4c2; }
.cell-tone { background: var(--surface-2); color: var(--ink); }
.cell-tone:hover { background: #26242e; }

/* FAQ */
.faq {
  padding: var(--gap) var(--margin) 0;
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px;
}
.faq-head { grid-column: 1 / 5; }
.faq h1 { font-size: var(--step-head); }
.faq-lead { margin-top: 20px; max-width: 26ch; font-size: var(--step-lead); line-height: 1.35; }
.faq-text { grid-column: 5 / 13; columns: 2; column-gap: 56px; }
.faq-text p { max-width: 62ch; break-inside: avoid; margin: 0 0 22px; line-height: 1.55; color: var(--muted); }
.faq-text strong { font-weight: 500; color: var(--ink); }

/* Footer: revealed under the page */
.foot {
  position: sticky; bottom: 0; z-index: 1;
  min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr;
  background: var(--surface); color: var(--ink);
  padding: 40px var(--margin) 20px;
}
.foot-cols { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 32px; }
.foot-cols ul { list-style: none; margin: 0; padding: 0; grid-column: span 2; font-size: var(--step-body); line-height: 1.6; }
.foot-cols ul li:first-child { font-weight: 500; color: var(--accent); margin-bottom: 4px; }
.foot-cols a { text-decoration: none; position: relative; }
.foot-cols a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .2s var(--ease); }
.foot-cols a:hover::after, .foot-cols a:focus-visible::after { transform: scaleX(1); }
.foot-mark { align-self: end; padding-top: 48px; }
.wordmark { width: 100%; height: auto; }
.legal { font-size: var(--step-small); margin-top: 20px; color: var(--muted); }

/* Entrances: only hidden once the script has marked the page */
.js .rise { opacity: 0; transform: translateY(20px); transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: calc(min(var(--d, 0), 4) * 50ms); }
.js .rise.in { opacity: 1; transform: none; }

/* Tablet */
@media (max-width: 1100px) {
  .bar-links { gap: 20px; }
  .faq-head { grid-column: 1 / -1; margin-bottom: 40px; }
  .faq-lead { max-width: 40ch; }
  .faq-text { grid-column: 1 / -1; }
  .foot-cols ul { grid-column: span 4; }
}

/* Narrow tablet: the header keeps logo, cart and sign-in; car tools stack */
@media (max-width: 960px) {
  .bar-links { display: none; }
  .bar { grid-template-columns: auto 1fr; }
  .tools { grid-template-columns: 1fr; min-height: 0; }
  .plate { margin: var(--margin) var(--margin) 0; }
  .tools-side { padding: 40px var(--margin) 48px; }
  .tools-body { margin: 36px 0; }
}

/* Phone */
@media (max-width: 720px) {
  .bar { grid-template-columns: auto 1fr; padding: 16px; }
  .bar-links { display: none; }
  .mark img { height: 30px; }
  .bar .btn { min-height: 44px; padding: 0 14px; font-size: 16px; }
  .hero { padding: 96px 16px 56px; background-size: 120px; }
  .hero-logo { width: 100%; }
  .hero-meta { gap: 6px 12px; }
  .tools { grid-template-columns: 1fr; min-height: 0; }
  .plate { margin: 16px; }
  .tools-side { padding: 8px 16px 32px; }
  .tabs { gap: 18px; }
  .tools-body { margin: 32px 0; }
  .cells { grid-template-columns: 1fr; }
  .cell { min-height: 60px; }
  .faq-text { columns: 1; }
  .foot-cols ul { grid-column: span 6; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Gentler, not none: fades and colour changes stay, anything that moves goes */
  *, *::before, *::after { animation: none !important; transition-property: opacity, color, background-color !important; transition-duration: .15s !important; transition-delay: 0s !important; }
  .js .rise { opacity: 1; transform: none; }
  .card-pic img, .thumb-pic img, .g-img { transform: none !important; }
}

/* Notice for actions that aren't connected yet (site.js). It floats, so it may carry a shadow. */
.notice {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; /* above the cart drawer (60, 61) */
  width: min(520px, calc(100vw - 32px));
  padding: 16px 20px;
  background: var(--surface-2); color: var(--ink);
  font-size: var(--step-body); line-height: 1.4;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55); /* taste-skill-ignore: floating notice */
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity .15s ease-out, transform 0s .15s;
}
.notice.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; transition: opacity .25s var(--ease), transform .25s var(--ease); }
@media (max-width: 720px) {
  .notice { bottom: auto; top: 16px; transform: translate(-50%, -16px); }
  .notice.on { transform: translate(-50%, 0); }
}

/* Pages without a hero (FAQ): the header sits in the flow */
.page .bar { position: relative; inset: auto; }
.page .faq { padding-top: clamp(48px, 7vw, 112px); min-height: 60svh; }
.bar-links a[aria-current="page"]::after { transform: scaleX(1); }

/* Header actions: Cart and Sign in, right-aligned */
.bar-actions { display: flex; gap: 12px; align-items: center; justify-self: end; }

/* Signed in: the Discord avatar and name, with a small menu */
.account { position: relative; }
.account-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px 0 10px;
  background: var(--surface-2); color: var(--ink); border: 0; cursor: pointer;
  font: 500 var(--step-body)/1 var(--text);
  transition: background-color .15s ease, transform .16s var(--ease);
}
.account-btn:hover { background: #26242e; }
.account-btn:active { transform: scale(.97); }
.account-pic { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); flex: none; }
.account-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: max-content; min-width: 240px; max-width: 320px;
  padding: 14px; background: var(--surface-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55); /* taste-skill-ignore: a menu floats */
  transform-origin: top right;
  opacity: 0; transform: scale(.97); visibility: hidden; pointer-events: none;
  transition: opacity .15s ease-out, transform .15s var(--ease), visibility 0s linear .15s;
}
.account.open .account-menu { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition: opacity .15s ease-out, transform .15s var(--ease), visibility 0s; }
.account-who { font-size: var(--step-small); color: var(--muted); line-height: 1.4; }
.account-who strong { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.account-item {
  display: block; width: 100%; margin-top: 12px; min-height: 44px; padding: 0 12px; text-align: left;
  background: var(--surface); color: var(--ink); border: 0; cursor: pointer; font: 500 var(--step-body)/1 var(--text);
  transition: background-color .15s ease;
}
.account-item:hover { background: var(--bg); }
@media (max-width: 720px) {
  .account-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .account-btn { min-height: 44px; padding: 0 8px; }
}

/* ---------- Home page: the header is a translucent layer the page scrolls under ---------- */
html { scroll-padding-top: 96px; }
.home .bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  padding-top: 14px; padding-bottom: 14px;
  background: rgba(10, 10, 12, .58);
  -webkit-backdrop-filter: blur(20px) saturate(160%); /* taste-skill-ignore: the one translucent header, over the home page */
  backdrop-filter: blur(20px) saturate(160%); /* taste-skill-ignore: as above */
  transition: background-color .3s ease;
}
/* Over the plain hero grid it can be lighter; once content scrolls under it, heavier for separation */
.home .bar[data-over="hero"] { background: rgba(10, 10, 12, .28); }
@media (prefers-reduced-transparency: reduce) {
  .bar, .home .bar[data-over="hero"] { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .bar, .home .bar[data-over="hero"] { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 2px solid var(--ink); }
}

/* ---------- Typography: tracking by size ---------- */
.hero-title, .tools-body h2, .store-title { letter-spacing: -0.02em; }
.hero-title { font-optical-sizing: auto; }
.store-note, .card-meta, .cl-meta, .drawer-count { letter-spacing: .01em; }

/* ---------- Response: feedback on pointer-down, quickly ---------- */
.btn:active, .add:active, .cell:active, .cart-btn:active, .drawer-close:active, .store-tab:active {
  transform: scale(.97); transition-duration: .1s;
}

/* ---------- The header's Discord controls as tints of the header material, not solid grey blocks ----------
   One translucent layer (the header) carries the blur; the controls on it are light tints with a bright
   top edge, the way light catches the edge of a material. The account menu floats, so it gets its own. */
.bar .btn-dark,
.bar .account-btn {
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); /* taste-skill-ignore: the lit top edge of a material, not a drop shadow */
  color: var(--ink);
  transition: background-color .15s ease, transform .1s var(--ease);
}
.bar .btn-dark:active, .bar .account-btn:active { background: rgba(255, 255, 255, .05); }
@media (hover: hover) and (pointer: fine) {
  .bar .btn-dark:hover, .bar .account-btn:hover { background: rgba(255, 255, 255, .14); }
}
.bar .cart-btn[data-filled="false"] .cart-count { background: rgba(255, 255, 255, .1); color: var(--ink); }
.bar .account-pic { box-shadow: 0 0 0 2px rgba(255, 255, 255, .16); /* taste-skill-ignore: a ring around the avatar */ }

.bar .account-menu {
  background: rgba(27, 26, 33, .72);
  -webkit-backdrop-filter: blur(28px) saturate(170%); /* taste-skill-ignore: a floating menu is a material */
  backdrop-filter: blur(28px) saturate(170%); /* taste-skill-ignore: as above */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 18px 48px rgba(0, 0, 0, .55); /* taste-skill-ignore: it floats */
}
.bar .account-item { background: rgba(255, 255, 255, .07); }
@media (hover: hover) and (pointer: fine) { .bar .account-item:hover { background: rgba(255, 255, 255, .13); } }

@media (prefers-reduced-transparency: reduce) {
  .bar .btn-dark, .bar .account-btn, .bar .cart-btn[data-filled="false"] .cart-count { background: var(--surface-2); box-shadow: none; /* taste-skill-ignore: removes the edge */ }
  .bar .account-menu { background: var(--surface-2); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bar .account-item { background: var(--surface); }
}
@media (prefers-contrast: more) {
  .bar .btn-dark, .bar .account-btn { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--ink); /* taste-skill-ignore: a solid edge for more contrast */ }
  .bar .account-menu { background: var(--surface-2); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
