/* ============================================================
   Async Solution — Brand Guidelines Site
   Built entirely on the brand's own tokens (assets/color/tokens.css)
   ============================================================ */

/* Variable font for browsers that support it (most modern browsers) */
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 300 700;
  font-display: swap;
}
/* Static weight fallbacks for renderers without variable font support
   (older WebKit/wkhtmltopdf, some PDF/email renderers, legacy browsers) */
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-Light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --async-green-dark:   #0E8642;
  --async-green-light:  #55AD47;
  --async-charcoal:     #3D3C3A;
  --async-ink:          #231F20;
  --async-white:        #FFFFFF;
  --async-gradient-brand: linear-gradient(90deg, #55AD47 0%, #0E8642 100%);

  --gray-50:  #FAFAF9;
  --gray-100: #F2F2F2;
  --gray-200: #E0E0E0;
  --gray-300: #CAC9C9;
  --gray-400: #9E9C9D;
  --gray-500: #777475;
  --gray-600: #585556;
  --gray-700: #3D3C3A;
  --gray-800: #2C292A;
  --gray-900: #231F20;

  --status-success: #0E8642;
  --status-warning: #A85F0C;
  --status-error:   #C0392B;
  --status-info:    #2F6FBB;

  --sidebar-width: 272px;
  --content-max: 760px;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: 'Space Grotesk', -apple-system, 'Segoe UI', Arial, sans-serif;
  color: var(--async-ink);
  background: var(--async-white);
  font-size: 16px;
  line-height: 1.6;
}

a { color: var(--async-green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--async-green-dark);
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--gray-100);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

pre {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--async-ink);
  color: var(--gray-100);
  padding: 16px 18px;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; color: inherit; }

/* ---------- Layout shell ---------- */

.shell {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 20px 40px 28px;
  border-right: 1px solid var(--gray-200);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.sidebar-brand img { width: 30px; height: 30px; }
.sidebar-brand span {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sidebar nav ul {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
}
.sidebar nav h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  font-weight: 600;
  margin: 0 0 8px;
}
.sidebar nav a {
  display: block;
  color: var(--gray-700);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 5px;
  margin: 1px 0;
}
.sidebar nav a:hover { background: var(--gray-100); text-decoration: none; }
.sidebar nav a.active {
  background: var(--gray-100);
  color: var(--async-green-dark);
  font-weight: 600;
}
.sidebar nav a .num { font-family: var(--mono); color: var(--gray-400); margin-right: 6px; font-size: 12px; }

.sidebar-download {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--async-white);
  background: var(--async-green-dark);
  padding: 9px 14px;
  border-radius: 6px;
  width: 100%;
  justify-content: center;
}
.sidebar-download:hover { background: #0b6f37; text-decoration: none; }

.menu-toggle { display: none; }

main {
  flex: 1;
  min-width: 0;
  padding: 0 48px 100px;
}

section { max-width: var(--content-max); margin: 0 auto; }

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 56px;
}
.hero img.hero-logo { width: 120px; margin-bottom: 28px; }
.hero h1 {
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  max-width: 14ch;
}
.hero p.lede {
  font-size: 18px;
  color: var(--gray-700);
  max-width: 56ch;
  margin: 0 0 24px;
}
.hero-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--gray-500);
  font-family: var(--mono);
}
.hero-meta span { margin-right: 18px; }
.hero-meta span:last-child { margin-right: 0; }

/* ---------- Section headings ---------- */

.chapter { padding-top: 56px; scroll-margin-top: 20px; }
.chapter:first-of-type { padding-top: 0; }

.chapter-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--async-green-dark);
  margin-bottom: 6px;
}
.chapter h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
.chapter h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 36px 0 12px;
}
.chapter p { margin: 0 0 16px; color: var(--gray-800); }
.chapter ul, .chapter ol { margin: 0 0 16px; padding-left: 22px; color: var(--gray-800); }
.chapter li { margin-bottom: 6px; }
.note {
  border-left: 3px solid var(--gray-300);
  background: var(--gray-50);
  padding: 12px 16px;
  font-size: 14.5px;
  color: var(--gray-700);
  margin: 0 0 20px;
  border-radius: 0 4px 4px 0;
}
hr { border: none; border-top: 1px solid var(--gray-200); margin: 48px 0; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
th { font-weight: 600; color: var(--gray-700); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* ---------- Color swatches ---------- */

.swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  margin-bottom: 24px;
}
.swatch-grid .swatch { flex: 1 1 150px; }
@supports (display: grid) {
  .swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
.swatch {
  background: var(--async-white);
  padding: 0;
  cursor: pointer;
  border: none;
  text-align: left;
  font-family: inherit;
  display: flex;
  flex-direction: column;
}
.swatch-color { height: 92px; width: 100%; position: relative; }
.swatch-info { padding: 10px 12px 14px; background: var(--async-white); }
.swatch-name { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.swatch-hex { font-family: var(--mono); font-size: 12px; color: var(--gray-500); }
.swatch-copied {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  color: #fff; font-size: 12px; font-family: var(--mono);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
  pointer-events: none;
}
.swatch.copied .swatch-copied { opacity: 1; }

.gray-strip { display: flex; margin-bottom: 24px; border: 1px solid var(--gray-200); }
.gray-chip { flex: 1; height: 64px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.gray-chip span { font-family: var(--mono); font-size: 10.5px; background: rgba(255,255,255,0.85); padding: 1px 4px; border-radius: 2px; }

.status-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.status-chip {
  flex: 1; min-width: 140px;
  border-radius: 6px;
  padding: 14px 16px;
  color: #fff;
  font-size: 13.5px;
}
.status-chip strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.status-chip span { font-family: var(--mono); font-size: 12px; opacity: 0.9; }

/* ---------- Usage ratio ring ---------- */

.ratio-wrap { display: flex; align-items: center; gap: 28px; margin: 20px 0 28px; flex-wrap: wrap; }
.ratio-ring {
  width: 140px; height: 140px; border-radius: 50%; flex-shrink: 0;
  background: var(--gray-200); /* fallback for engines without conic-gradient */
  background: conic-gradient(
    var(--gray-100) 0% 60%,
    var(--async-ink) 60% 90%,
    var(--async-green-dark) 90% 100%
  );
  position: relative;
}
.ratio-ring::after {
  content: ''; position: absolute; inset: 22px; border-radius: 50%; background: var(--async-white);
}
.ratio-legend { font-size: 14px; }
.ratio-legend div { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ratio-dot { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }

/* ---------- Contrast bars ---------- */

.contrast-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; font-size: 13.5px; }
.contrast-label { width: 190px; flex-shrink: 0; font-family: var(--mono); font-size: 12px; }
.contrast-bar-track { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.contrast-bar-fill { height: 100%; border-radius: 4px; }
.contrast-value { width: 90px; text-align: right; font-family: var(--mono); font-size: 12px; flex-shrink: 0; }
.pass { color: var(--status-success); }
.fail { color: var(--status-error); }

/* ---------- Logo showcase ---------- */

.logo-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }
.logo-grid .logo-tile { flex: 1 1 220px; }
@supports (display: grid) {
  .logo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
.logo-tile {
  border: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
}
.logo-tile-canvas {
  height: 160px; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.logo-tile-canvas img { max-height: 100%; max-width: 100%; }
.logo-tile-canvas.bg-white { background: var(--async-white); }
.logo-tile-canvas.bg-charcoal { background: var(--async-charcoal); }
.logo-tile-canvas.bg-gray { background: var(--gray-100); }
.logo-tile-canvas.bg-gradient { background: var(--async-gradient-brand); }
.logo-tile-label {
  padding: 10px 14px; font-size: 13px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.logo-tile-label a { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }

.clearspace-demo {
  border: 1px dashed var(--gray-400);
  display: inline-block;
  padding: 44px;
  margin: 12px 0 28px;
  background: var(--gray-50);
  position: relative;
}
.clearspace-demo img { width: 130px; }
.clearspace-demo .cs-label {
  position: absolute; font-family: var(--mono); font-size: 11px; color: var(--gray-500);
  background: var(--gray-50); padding: 0 4px;
}
.clearspace-demo .cs-top { top: -8px; left: 50%; transform: translateX(-50%); }
.clearspace-demo .cs-left { left: -6px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: left center; }

/* ---------- Do / Don't ---------- */

.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.dodont > div { padding: 16px 18px; border-radius: 6px; font-size: 14.5px; }
.do-col { background: rgba(14,134,66,0.07); border: 1px solid rgba(14,134,66,0.25); }
.dont-col { background: rgba(192,57,43,0.06); border: 1px solid rgba(192,57,43,0.22); }
.dodont h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.do-col h4 { color: var(--status-success); }
.dont-col h4 { color: var(--status-error); }
.dodont ul { margin: 0; padding-left: 18px; }
.dodont li { margin-bottom: 8px; }

@media (max-width: 640px) {
  .dodont { grid-template-columns: 1fr; }
}

/* ---------- Type specimen ---------- */

.type-specimen { border-top: 1px solid var(--gray-200); padding: 20px 0; }
.type-specimen:last-child { border-bottom: 1px solid var(--gray-200); }
.type-specimen .sample { margin-bottom: 6px; }
.type-specimen .meta { font-family: var(--mono); font-size: 12px; color: var(--gray-500); display: flex; gap: 16px; }

.weight-scale { display: flex; flex-direction: column; gap: 2px; margin: 20px 0 32px; }
.weight-row { display: flex; align-items: baseline; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.weight-row .wname { width: 130px; font-family: var(--mono); font-size: 12px; color: var(--gray-500); flex-shrink: 0; }
.weight-row .wsample { font-size: 24px; }

/* ---------- Voice before/after ---------- */

.voice-compare { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 28px; }
.voice-line { padding: 14px 16px; border-radius: 6px; font-size: 15px; }
.voice-bad { background: rgba(192,57,43,0.06); border-left: 3px solid var(--status-error); }
.voice-good { background: rgba(14,134,66,0.07); border-left: 3px solid var(--status-success); }
.voice-line .tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; display: block; margin-bottom: 4px; color: var(--gray-500); }

/* ---------- Download cards ---------- */

.download-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 32px; }
.download-grid .download-card { flex: 1 1 200px; }
@supports (display: grid) {
  .download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
.download-card {
  border: 1px solid var(--gray-200);
  padding: 16px 18px;
  border-radius: 6px;
  transition: border-color 0.15s;
}
.download-card:hover { border-color: var(--async-green-dark); text-decoration: none; }
.download-card strong { display: block; font-size: 14.5px; color: var(--async-ink); margin-bottom: 4px; }
.download-card span { font-size: 12.5px; color: var(--gray-500); font-family: var(--mono); }

.download-all {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: var(--async-ink); color: #fff; border-radius: 8px; padding: 24px 28px; margin: 24px 0 36px;
}
.download-all h3 { margin: 0 0 4px; color: #fff; font-size: 17px; }
.download-all p { margin: 0; color: var(--gray-300); font-size: 14px; }
.download-all a {
  background: var(--async-green-dark); color: #fff; padding: 10px 20px; border-radius: 6px;
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.download-all a:hover { background: var(--async-green-light); text-decoration: none; }

/* ---------- Footer ---------- */

footer {
  max-width: var(--content-max); margin: 0 auto; padding-top: 40px; border-top: 1px solid var(--gray-200);
  font-size: 13px; color: var(--gray-500); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    background: var(--async-white);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,0.12);
  }
  .sidebar.open { transform: translateX(0); }
  main { padding: 0 22px 80px; }
  .hero { padding-top: 84px; }
  .menu-toggle {
    display: flex;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 50;
    width: 40px; height: 40px;
    border-radius: 8px;
    background: var(--async-ink);
    color: #fff;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 18px;
  }
  .sidebar-scrim {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 30;
  }
  .sidebar-scrim.show { display: block; }
}
