/*
 * Sesam publisher site: layout and components. Brand values come from two copies made by scripts/site/check.ts:
 * tokens.css (semantic palette, type scale, @font-face, generated from brand/sesam/design-system/tokens.json) and
 * brand.css (the pack's raw scales: Iris, neutrals, font stacks, easing). This file reads variables only.
 */
@import url("brand.css");
@import url("tokens.css");

:root {
  /* Text-safe Iris for links and labels: Iris 700 on light grounds, Iris 400 on Aubergine (guidelines, Contrast). */
  --sesam-link: var(--iris-700);
  --sesam-ground-dark: var(--sesam-aubergine);
}
@media (prefers-color-scheme: dark) {
  :root { --sesam-link: var(--iris-400); }
}

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

html {
  font-family: var(--font-text);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--sesam-background);
  color: var(--sesam-text);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--sesam-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -6rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--sesam-primary);
  color: var(--sesam-on-primary);
  border-radius: var(--sesam-radius-control);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.wrap {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}
@media (min-width: 40em) { .wrap { width: min(100% - 3rem, 72rem); } }

/* Plex Mono labels: eyebrows and pills. */
.eyebrow, .pill {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Header: light navigation over the dark hero ──────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--sesam-background) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--sesam-border) 70%, transparent);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--sesam-touch-target);
  text-decoration: none;
}
.wordmark img { width: 1.1875rem; height: 1.75rem; }
.wordmark-text, .footer-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}
.wordmark-text { font-size: 1.625rem; }
.site-nav ul { display: flex; gap: 0.25rem; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--sesam-touch-target);
  padding: 0 0.75rem;
  border-radius: var(--sesam-radius-control);
  color: var(--sesam-text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-forward), background var(--duration-fast) var(--ease-forward);
}
.site-nav a:hover { color: var(--sesam-text); background: var(--sesam-surface-subtle); }
@media (max-width: 30em) {
  .site-nav ul { gap: 0; }
  .site-nav a { padding-inline: 0.5rem; font-size: 0.9rem; }
  .wordmark-text { font-size: 1.375rem; }
}
@media (max-width: 22.5em) {
  .wordmark-text { display: none; }
}

/* ── Hero: Aubergine panel in both themes, one ribbon, type in the quiet corner ── */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--sesam-ground-dark);
  color: var(--sesam-offwhite);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: min(52rem, calc(100svh - 4rem));
  padding-block: 0 clamp(3rem, 7vw, 5.5rem);
}
/* Grain, not gloss: the pack's monochrome noise at 18%, over the whole panel (ribbon included) so it has no seam. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.18'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23g)'/%3E%3C/svg%3E");
}
.ribbon {
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  width: 100%;
  height: 100%;
}
/* Desktop: the band crosses the upper half, entering off the left edge, so the bottom-left corner stays quiet. */
.ribbon-band { transform: translate(0, -105px); }
@media (max-width: 47.99em) {
  /* Portrait: the ribbon keeps the upper part of the panel, the copy sits below it. */
  .hero { min-height: 0; padding-top: clamp(15rem, 62vw, 24rem); }
  .ribbon { height: clamp(18rem, 78vw, 28rem); }
  .ribbon-band { transform: translate(-40px, -40px); }
}
.hero .eyebrow { color: var(--sesam-lilac); }
.hero h1 {
  font-size: clamp(2.5rem, 1.5rem + 4.2vw, 3.8125rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 23ch;
}
.hero h1 span { display: block; color: var(--iris-400); }
.hero .lede {
  margin-top: 1.5rem;
  max-width: 50ch;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.125rem);
  color: var(--sesam-lilac);
  text-wrap: pretty;
}
.hero .motto {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--sesam-offwhite);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  margin-top: 2.25rem;
}
.hero .link-arrow { color: var(--iris-400); }

/* Entrance: the ribbon draws once, the copy moves forward along x (one curve, three durations). */
.ribbon-band use {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: ribbon-draw var(--duration-slow) var(--ease-forward) both;
}
.hero-copy > * { animation: forward var(--duration-slow) var(--ease-forward) both; }
.hero-copy > :nth-child(2) { animation-delay: 60ms; }
.hero-copy > :nth-child(3) { animation-delay: 120ms; }
.hero-copy > :nth-child(4) { animation-delay: 180ms; }
.hero-copy > :nth-child(5) { animation-delay: 240ms; }
@keyframes ribbon-draw { from { stroke-dashoffset: 1; } }
@keyframes forward { from { opacity: 0; transform: translateX(-16px); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ribbon-band use { animation: none; }
  .hero-copy > * { animation: fade var(--sesam-motion-reduced) linear both; animation-delay: 0ms !important; }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--sesam-touch-target);
  padding: 0 1.5rem;
  border-radius: var(--sesam-radius-control);
  background: var(--sesam-primary);
  color: var(--sesam-on-primary);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-forward), transform var(--duration-fast) var(--ease-forward);
}
.button:hover { background: var(--sesam-primary-pressed); }
.button:active { transform: translateY(1px); }
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--sesam-touch-target);
  font-weight: 600;
  color: var(--sesam-link);
}
.link-arrow span { transition: transform var(--duration-fast) var(--ease-forward); }
.link-arrow:hover span { transform: translateX(3px); }

/* ── Sections ─────────────────────────────────────────────────────────── */
.section { padding-block: clamp(4.5rem, 10vw, 8rem); }
.section + .section { padding-top: 0; }
.eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--sesam-link);
  font-size: 0.75rem;
}
.section-title {
  font-size: clamp(1.875rem, 1.4rem + 1.9vw, 2.4375rem);
  letter-spacing: -0.025em;
  line-height: 1.08;
  max-width: 22ch;
  text-wrap: balance;
}
.section-title .line { display: block; }
.section-lede {
  margin-top: 1rem;
  max-width: 60ch;
  color: var(--sesam-text-secondary);
}

/* ── Applications ─────────────────────────────────────────────────────── */
.app-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.app-grid { max-width: 44rem; }
.app-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: var(--sesam-radius-card);
  background: var(--sesam-surface);
  border: 1px solid var(--sesam-border);
}
@media (max-width: 30em) { .app-card { grid-template-columns: 1fr; } }
.app-card img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: var(--radius-icon);
}
.app-card h3 { font-size: 1.5625rem; letter-spacing: -0.02em; line-height: 1.15; }
.app-card .app-tagline { margin-top: 0.25rem; color: var(--sesam-text); font-weight: 600; }
.app-card p { margin-top: 0.4rem; color: var(--sesam-text-secondary); font-size: 0.98rem; }
.app-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.9rem;
  font-size: 0.875rem;
  color: var(--sesam-text-secondary);
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--sesam-lilac);
  color: var(--sesam-aubergine);
  font-size: 0.6875rem;
}

/* ── Approche ─────────────────────────────────────────────────────────── */
.pillars {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
@media (min-width: 40em) { .pillars { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64em) { .pillars { grid-template-columns: repeat(4, 1fr); } }
.pillar {
  padding: 1.5rem;
  border-radius: var(--sesam-radius-card);
  background: var(--sesam-surface);
  border: 1px solid var(--sesam-border);
}
.pillar .glyph {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1.25rem;
  border-radius: var(--sesam-radius-control);
  background: var(--sesam-lilac);
  color: var(--iris-700);
}
.pillar .glyph svg { width: 1.4rem; height: 1.4rem; }
.pillar h3 { font-size: 1.1875rem; letter-spacing: -0.015em; line-height: 1.2; }
.pillar p { margin-top: 0.5rem; color: var(--sesam-text-secondary); font-size: 0.98rem; }

/* ── À propos ─────────────────────────────────────────────────────────── */
.about .wrap {
  display: grid;
  gap: 2rem;
}
@media (min-width: 60em) { .about .wrap { grid-template-columns: 5fr 7fr; gap: 4rem; } }
.about-text p { color: var(--sesam-text-secondary); }
.about-text p + p { margin-top: 1rem; }
.about-text strong { color: var(--sesam-text); font-weight: 600; }
.signature {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sesam-border);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1875rem;
  letter-spacing: -0.01em;
}
.about-text .signature { color: var(--sesam-text); }

/* ── Contact ──────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
@media (min-width: 48em) { .contact-grid { grid-template-columns: repeat(2, 1fr); max-width: 52rem; } }
.contact-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-radius: var(--sesam-radius-card);
  background: var(--sesam-surface);
  border: 1px solid var(--sesam-border);
}
.contact-card h3 { font-size: 1.1875rem; letter-spacing: -0.015em; }
.contact-card p { margin-top: 0.5rem; flex: 1; color: var(--sesam-text-secondary); font-size: 0.98rem; }
.contact-card a { margin-top: 1rem; align-self: flex-start; overflow-wrap: anywhere; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--sesam-border);
  padding-block: 2.5rem 3rem;
  font-size: 0.9rem;
  color: var(--sesam-text-secondary);
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.footer-wordmark { flex-basis: 100%; font-size: 1.75rem; color: var(--sesam-text); }
.footer-row ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.footer-row a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.legal {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  border-radius: var(--sesam-radius-control);
  background: var(--sesam-surface-subtle);
}
.legal summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--sesam-text);
  min-height: 2rem;
  display: flex;
  align-items: center;
}
.legal p { margin-top: 0.75rem; max-width: 75ch; }

/* ── 404 ──────────────────────────────────────────────────────────────── */
.notfound {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 1rem;
}
.notfound .eyebrow { margin-bottom: 0; }
