/**
 * Signy website
 *
 * Iris CSS styles the elements. This file only adds the site chrome, the
 * documentation layout and the example blocks. Colors and sizes come from
 * Iris variables, so both themes work without extra rules.
 */

/* Olive Script: Oleo Script by Soytutype with a dotted capital I (SIL Open
   Font License 1.1). Source in assets/olive-script. */
@font-face {
  font-family: "Olive Script";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/olive-script.woff2") format("woff2");
}

:root {
  --site-band: var(--i-footer-color-background);
  --site-border: var(--i-color-subtle-border);
}

html {
  scroll-padding-top: calc(var(--i-navbar-height) + 1rem);
}

/* ==================================================
   Header
   ================================================== */

/* The bar is the Iris .navbar. Only the wordmark and theme icons are ours. */
.wordmark {
  font-family: "Olive Script", cursive;
  font-size: 1.15em;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.wordmark + .brand-accent {
  margin-inline-start: 0.125rem;
  font-weight: 500;
  color: light-dark(var(--i-color-brand-dark), var(--i-color-brand-light));
}

/* Shows the icon of the theme you switch to */
.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

/* ==================================================
   Home
   ================================================== */

.home-hero {
  padding-block: 2rem 3.5rem;
  text-align: center;
}

.home-hero h1 {
  margin-block: 1rem 0.25rem;
  font-size: clamp(3rem, 2rem + 5vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.home-hero .wordmark {
  font-size: 1em;
}

.home-hero-css {
  font-weight: 400;
  color: var(--i-color-subtle);
}

.home-tagline {
  margin-bottom: 1rem;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  font-weight: 600;
  color: var(--i-h2-color-text);
}

.home-description {
  max-width: 34rem;
  margin-inline: auto;
  margin-bottom: 2rem;
  font-size: 1.125rem;
  color: var(--i-color-subtle);
}

/* Centered under the hero buttons, but the code reads left to right */
.home-install {
  max-width: 44rem;
  margin: 2rem auto 0;
  text-align: start;
}

.home-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 2.5rem;
  padding: 0;
  margin-top: 2rem;
  font-size: 0.9375rem;
  color: var(--i-color-subtle);
  list-style: none;
}

.home-facts li {
  margin: 0;
}

.home-features {
  padding-bottom: 4rem;
}

.home-features .grid {
  --i-grid-column-min-width: 11rem;
}

@media (width >= 64rem) {
  .home-features .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  height: 100%;
  padding: 1.25rem;
  border: var(--i-border-width) solid var(--site-border);
  border-radius: var(--i-border-radius-large);
  color: var(--i-color-subtle);
  text-decoration: none;
  background-color: var(--i-card-color-background);
}

.feature-card:hover {
  border-color: var(--i-color-brand);
}

.feature-card strong {
  font-size: 1.0625rem;
  color: var(--i-h3-color-text);
}

.feature-emoji,
.home-section-emoji {
  font-size: 1.75rem;
  line-height: 1;
}

/* Official flag colors, the same in both themes. Flags never mirror, so physical properties */
.feature-flags {
  display: flex;
  gap: 0.5rem;
}

.flag {
  position: relative;
  display: flex;
  width: 2.625rem;
  height: 1.75rem;
  border: var(--i-border-width) solid var(--site-border);
  border-radius: 0.1875rem;
  overflow: hidden;
}

.flag-italy > span {
  flex: 1;
}

.flag-italy > span:nth-child(1) {
  background-color: #009246;
}

.flag-italy > span:nth-child(2) {
  background-color: #fff;
}

.flag-italy > span:nth-child(3) {
  background-color: #ce2b37;
}

.flag-eu {
  background-color: #039;
}

/* 12 stars on a circle, each placed by its --i */
.flag-eu > span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.3rem;
  height: 0.3rem;
  background-color: #fc0;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  transform: translate(-50%, -50%) rotate(calc(var(--i) * 30deg)) translateY(-0.55rem) rotate(calc(var(--i) * -30deg));
}

.home-section {
  padding-block: 4.5rem;
  border-top: var(--i-border-width) solid var(--site-border);
}

.home-section.alt {
  background-color: var(--site-band);
}

.home-section .switcher {
  align-items: center;
  gap: 3rem;
}

.home-section-emoji {
  margin-bottom: 0.75rem;
}

.home-section h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  letter-spacing: -0.02em;
}

.lead {
  font-size: 1.1875rem;
  color: var(--i-color-subtle);
}

.home-section .example {
  margin-top: 2rem;
}

.checklist {
  padding: 0;
  list-style: none;
}

.checklist > li {
  position: relative;
  padding-inline-start: 2rem;
  margin-bottom: 0.75rem;
}

.checklist > li::before {
  position: absolute;
  top: 0.15em;
  inset-inline-start: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--i-border-radius-pill);
  background-color: var(--i-color-primary);
  mask: var(--_icon) center / 0.875rem no-repeat;
  content: "";
}

.home-cta {
  padding-block: 4.5rem;
  border-top: var(--i-border-width) solid var(--site-border);
  text-align: center;
}

.home-cta p {
  font-size: 1.125rem;
  color: var(--i-color-subtle);
}

/* ==================================================
   Page header and plain pages
   ================================================== */

.page-header {
  padding-block: 2.5rem 3rem;
  border-bottom: var(--i-border-width) solid var(--site-border);
  background-color: var(--site-band);
}

.page-header h1 {
  margin-block: 1rem 0.5rem;
  font-size: clamp(2.25rem, 1.75rem + 2vw, 3rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin-bottom: 0;
  font-size: 1.25rem;
  color: var(--i-color-subtle);
}

.page-body {
  padding-block: 3rem 4rem;
}

.page-body > section + *,
.page-body > * + section {
  margin-top: 3rem;
}

.about-lists {
  --i-grid-column-min-width: 18rem;
  align-items: start;
}

.about-lists h3 {
  margin: 0;
}

.about-icon {
  padding: 0.3rem;
  border-radius: var(--i-border-radius);
  color: #fff;
}

.about-icon.love {
  background-color: var(--i-color-pink-500);
}

.about-icon.result {
  background-color: var(--i-color-amber-600);
}

.about-name {
  align-items: start;
  gap: 2rem;
}

.about-name figure {
  max-width: 20rem;
  margin: 0;
}

.about-name figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--i-color-subtle);
}

.about-name figcaption .credit {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

.about-lists li + li {
  margin-top: 0.5rem;
}

.creator {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.creator h3 {
  margin-bottom: 0.5rem;
}

.creator-role {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--i-color-subtle);
}

/* ==================================================
   Documentation layout
   ================================================== */

.docs {
  padding-block: 2rem 4rem;
}

/* Stacks the menu above the content below 1024px, where the container is
   700px wide */
.docs > .with-sidebar {
  --i-sidebar-content-min-width: 60%;
  gap: 3rem;
}

/* The menu is an Iris CSS .sidenav with the site's brand bar */
.docs-menu {
  --i-sidenav-color-border: var(--site-border);
  --i-sidenav-current-color-border: var(--i-color-brand);
  --i-sidenav-link-hover-color-text: var(--i-h1-color-text);
  --i-sidenav-sticky-offset: 1.5rem;
}

.docs-menu > details > summary {
  font-size: var(--i-sidenav-font-size);
  font-weight: 600;
}

.docs-menu-home {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.docs-menu-home a {
  font-weight: 600;
}

.docs-header {
  padding-bottom: 1.5rem;
  border-bottom: var(--i-border-width) solid var(--site-border);
  margin-block: 0.75rem 2rem;
}

.docs-header h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.75rem);
  letter-spacing: -0.02em;
}

.docs-body > h2 {
  margin-top: 3rem;
}

.docs-definitions dt {
  margin-top: 1rem;
  font-weight: 700;
  color: var(--i-h3-color-text);
}

.docs-definitions dd {
  margin-inline-start: 0;
}

/* Documentation index
   -------------------------------------------------- */

/* Two columns at most: eight cards then fill four even rows */
.docs-categories {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(16rem, calc(50% - 0.625rem)), 1fr)
  );
  gap: 1.25rem;
}

/* The icon sits beside the title, so the text and links get the full width */
.docs-category {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.875rem;
  align-content: start;
  padding: 1.25rem;
  border: var(--i-border-width) solid var(--site-border);
  border-radius: var(--i-border-radius-large);
  margin: 0;
  background-color: var(--i-card-color-background);
}

.docs-category > div {
  display: contents;
}

.docs-category h2 {
  margin: 0;
  font-size: 1.25rem;
}

.docs-category :is(p, ul) {
  grid-column: 1 / -1;
}

.docs-category p {
  margin-block: 0.75rem;
  font-size: 0.9375rem;
  color: var(--i-color-subtle);
}

.docs-category ul {
  padding: 0;
  margin: 0;
  font-size: 0.9375rem;
  list-style: none;
}

/* Long lists flow into as many columns as fit. Elements gets two, which
   matches the height of the card beside it. */
.docs-category ul:has(> li:nth-child(7)) {
  column-gap: 1.5rem;
  columns: 9rem;
}

.docs-category.wide {
  grid-column: 1 / -1;
}

/* Padding, not margin, so every column starts at the same height */
.docs-category li {
  padding-block: 0.125rem;
  margin: 0;
  break-inside: avoid;
}

/* Pager
   -------------------------------------------------- */

.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 2rem;
  border-top: var(--i-border-width) solid var(--site-border);
  margin-top: 4rem;
}

.docs-pager a {
  display: block;
  padding: 1rem 1.25rem;
  border: var(--i-border-width) solid var(--site-border);
  border-radius: var(--i-border-radius-large);
  font-weight: 600;
  text-decoration: none;
}

.docs-pager a:hover {
  border-color: var(--i-color-brand);
}

.docs-pager .next {
  grid-column: 2;
  text-align: end;
}

.docs-pager small {
  display: block;
  font-weight: 400;
  color: var(--i-color-subtle);
}

/* ==================================================
   Category icons
   ================================================== */

.docs-icon {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--i-border-radius);
  background-color: var(--_tile);
}

.docs-icon::before {
  width: 1rem;
  height: 1rem;
  background-color: #fff;
  mask: var(--_icon) center / contain no-repeat;
  content: "";
}

.docs-icon.large {
  width: 3rem;
  height: 3rem;
  border-radius: var(--i-border-radius-large);
}

.docs-icon.large::before {
  width: 1.5rem;
  height: 1.5rem;
}

/* Lucide icons (ISC license, https://lucide.dev) */
.docs-icon.overview {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09'/%3E%3Cpath d='M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z'/%3E%3Cpath d='M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05'/%3E%3C/g%3E%3C/svg%3E");
  --_tile: var(--i-color-violet-500);
}

.docs-icon.reactivity {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z'/%3E%3C/svg%3E");
  --_tile: var(--i-color-amber-500);
}

.docs-icon.components {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0zm-13.239 0a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0zm6.619 6.619a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0zm0-13.238a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z'/%3E%3C/svg%3E");
  --_tile: var(--i-color-orange-500);
}

.docs-icon.templates {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m16 18l6-6l-6-6M8 6l-6 6l6 6'/%3E%3C/svg%3E");
  --_tile: var(--i-color-sky-500);
}

.docs-icon.router {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='6' cy='19' r='3'/%3E%3Cpath d='M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15'/%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3C/g%3E%3C/svg%3E");
  --_tile: var(--i-color-emerald-500);
}

.docs-icon.application {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='7' height='9' x='3' y='3' rx='1'/%3E%3Crect width='7' height='5' x='14' y='3' rx='1'/%3E%3Crect width='7' height='9' x='14' y='12' rx='1'/%3E%3Crect width='7' height='5' x='3' y='16' rx='1'/%3E%3C/g%3E%3C/svg%3E");
  --_tile: var(--i-color-indigo-500);
}

.docs-icon.form {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 20h-1a2 2 0 0 1-2-2a2 2 0 0 1-2 2H6m7-12h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7m-8 0H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1m1-4h1a2 2 0 0 1 2 2a2 2 0 0 1 2-2h1M9 6v12'/%3E%3C/svg%3E");
  --_tile: var(--i-color-pink-500);
}

.docs-icon.async {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 22h14M5 2h14m-2 20v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2'/%3E%3C/svg%3E");
  --_tile: var(--i-color-teal-500);
}

.docs-icon.benchmarks {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m12 14l4-4M3.34 19a10 10 0 1 1 17.32 0'/%3E%3C/svg%3E");
  --_tile: var(--i-color-red-500);
}

.docs-icon.examples {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='20' height='16' x='2' y='4' rx='2'/%3E%3Cpath d='M10 4v4M2 8h20M6 4v4'/%3E%3C/g%3E%3C/svg%3E");
  --_tile: var(--i-color-rose-500);
}

.checklist > li::before {
  --_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}

/* ==================================================
   Examples and code
   ================================================== */

.example {
  border: var(--i-border-width) solid var(--site-border);
  border-radius: var(--i-border-radius-large);
  margin-bottom: 1.5rem;
}

.example-label {
  padding: 0.5rem 1.25rem;
  border-bottom: var(--i-border-width) solid var(--site-border);
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--i-color-subtle);
}

.example-preview {
  padding: 1.5rem 1.25rem;
  background-color: var(--i-color-background);
  border-start-start-radius: inherit;
  border-start-end-radius: inherit;
}

/* Buttons and links in a preview sit in a wrapping row */
.example-preview:has(
  > :is(
      button,
      a,
      [type="submit"],
      [type="reset"],
      [type="button"]
    )
) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.example-preview
  > :is(
    button,
    a,
    [type="submit"],
    [type="reset"],
    [type="button"]
  ) {
  width: auto;
  margin: 0;
}

/* Popovers and dialogs keep their auto margins, which center them */
.example-preview > :last-child:not([popover], dialog) {
  margin-bottom: 0;
}

.example .code-block {
  border-top: var(--i-border-width) solid var(--site-border);
}

.example pre {
  border-radius: 0 0 var(--i-border-radius-large) var(--i-border-radius-large);
  margin: 0;
}

.code-block {
  position: relative;
}

.copy-code {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: auto;
  margin: 0;
  opacity: 0;
}

.code-block:is(:hover, :focus-within) .copy-code {
  opacity: 1;
}

/* Live frame of a whole example page */
.docs-demo {
  width: 100%;
  height: 40rem;
  aspect-ratio: auto;
  border: var(--i-border-width) solid var(--site-border);
  border-radius: var(--i-border-radius-large);
}

/* Syntax colors. Iris code blocks are dark in both themes
   -------------------------------------------------- */

.token.tag {
  color: var(--i-color-pink-300);
}

.token.attribute {
  color: var(--i-color-amber-300);
}

.token.value {
  color: var(--i-color-emerald-300);
}

.token.punctuation {
  color: var(--i-color-slate-400);
}

.token.comment {
  font-style: italic;
  color: var(--i-color-slate-300);
}

.token.keyword {
  color: var(--i-color-violet-300);
}

.token.string {
  color: var(--i-color-emerald-300);
}

.token.number {
  color: var(--i-color-orange-300);
}

.token.class-name {
  color: var(--i-color-sky-300);
}

/* ==================================================
   Examples index
   ================================================== */

.examples-grid {
  --i-grid-column-min-width: 16rem;
}

.examples-category {
  margin-top: 2.5rem;
}

.examples-category h2 {
  margin-bottom: 0.5rem;
}

.examples-category > p {
  color: var(--i-color-subtle);
}
