/*
  AlGamma Group — shared stylesheet.
  Keep this file identical across sites (node tools/check.js verifies it).
*/

/* ---------- Fonts (self-hosted) ---------- */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-cyrillic-500-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-cyrillic-500-italic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;

  --bg: #f7f4ef;
  --bg-glow: #fdfbf8;
  --surface: #f0ebe4;
  --flash: #e6dace;
  --ink: #2b2724;
  --ink-2: #5e5750;   /* 6.5:1 on --bg */
  --ink-3: #6f675f;   /* 5:1 on --bg, 4.7:1 on --surface */
  --line: #ddd5ca;
  --line-strong: #c9bdb0;
  --accent: #9a5a44;  /* 4.9:1 on --bg */

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --radius: 12px;
  --gutter: 20px;
  --section: 80px;
  --page: 1200px;
  --measure: 720px;
}

@media (min-width: 768px) {
  :root {
    --gutter: 40px;
    --section: 120px;
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

@media (min-width: 768px) {
  body {
    font-size: 17px;
  }
}

h1, h2, h3, p, ol, ul {
  margin: 0;
}

ol, ul {
  padding: 0;
  list-style: none;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: #ead9ce;
}

.nowrap {
  white-space: nowrap;
}

/* Emblem sprite: must not be display:none, or gradients inside <use> stop rendering */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.wrap {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Label: short spaced-out caps */
.label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.h2 {
  margin-top: 16px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(36px, 8vw, 56px);
  line-height: 1.08;
  text-wrap: balance;
}

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

/*
  The first screen is one composition (wordmark, tagline, map), so it has to fit
  the window: vertical sizes scale with the window height (svh), and the hero is
  at least one screen tall with its content centred.
*/
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
  padding: clamp(24px, 5svh, 56px) 0 clamp(24px, 4svh, 48px);
  text-align: center;
  background: radial-gradient(80% 55% at 50% 0%, var(--bg-glow) 0%, rgba(253, 251, 248, 0) 100%);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.wordmark {
  margin-top: clamp(12px, 2.5svh, 28px);
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1;
}

.wordmark__name {
  display: block;
  font-size: clamp(64px, min(18vw, 14.5svh), 128px);
  letter-spacing: -0.01em;
}

.wordmark__group {
  display: block;
  margin-top: clamp(8px, 1.6svh, 16px);
  /* letter-spacing adds space after the last letter; balance it on the left */
  padding-left: 0.62em;
  font-family: var(--sans);
  font-size: clamp(13px, 3.4vw, 17px);
  font-weight: 500;
  letter-spacing: 0.62em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.tagline {
  max-width: 19em;
  margin: clamp(14px, 3svh, 28px) auto 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, min(6.6vw, 4.2svh), 36px);
  line-height: 1.22;
  text-wrap: balance;
}

.lead {
  max-width: 36em;
  margin: clamp(10px, 2svh, 20px) auto 0;
  color: var(--ink-2);
  text-wrap: balance;
}

@media (min-width: 768px) {
  .lead {
    font-size: 18px;
  }
}

/* ---------- Ecosystem map (hero) ---------- */

.map {
  margin-top: clamp(24px, 5svh, 56px);
}

.map__caption {
  text-wrap: balance;
}

.map__arc {
  display: none;
}

.map__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 16px;
  margin-top: 20px;
}

.map__item {
  flex: 0 0 33.333%;
  min-width: 0;
}

.map__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 10px;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.map__emblem {
  width: 56px;
  height: 56px;
  transition: transform 0.25s var(--spring);
}

.map__pre {
  margin-top: 12px;
}

.map__name {
  margin-top: 2px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(15px, 4.3vw, 18px);
  line-height: 1.15;
  white-space: nowrap;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .map__link:hover {
    color: var(--ink);
  }

  .map__link:hover .map__emblem {
    transform: translateY(-4px);
  }

  .map__link:hover .map__name {
    color: var(--accent);
  }
}

.map__link:active .map__emblem {
  transform: scale(0.94);
  transition-duration: 0.1s;
}

.map__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/*
  Wide screens: the brand arc. Items sit in equal columns with no gap, so their
  centres match the arc path (x = 1000 * (i + 0.5) / n in the SVG). Each dot sits
  on the arc's baseline; a tick rises from it to meet the arc.
  Arc rise at item i = 2t(1 - t) * 160 units, t = i / (n - 1) → --lift below.
*/
@media (min-width: 768px) {
  .map {
    --arc-h: clamp(40px, 8svh, 76px);
    --drop: clamp(16px, 2.6svh, 24px);
  }

  .map__arc {
    display: block;
    width: 100%;
    height: var(--arc-h);
    margin-top: 12px;
    overflow: visible;
  }

  .map__arc path {
    fill: none;
    stroke: var(--line-strong);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
  }

  .map__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    row-gap: 0;
    margin-top: var(--drop);
  }

  .map__item {
    --lift: 0;
    position: relative;
  }

  .map__list--5 .map__item:nth-child(2),
  .map__list--5 .map__item:nth-child(4) {
    --lift: 0.75;
  }

  .map__list--5 .map__item:nth-child(3),
  .map__list--3 .map__item:nth-child(2) {
    --lift: 1;
  }

  /* tick: from the dot up to the arc */
  .map__item::before {
    content: "";
    position: absolute;
    bottom: calc(100% + var(--drop));
    left: 50%;
    width: 1px;
    height: calc(var(--lift) * var(--arc-h) * 0.8);
    background: var(--line-strong);
  }

  /* dot on the arc's baseline */
  .map__item::after {
    content: "";
    position: absolute;
    bottom: calc(100% + var(--drop) - 3px);
    left: calc(50% - 3px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-3);
  }

  .map__emblem {
    width: clamp(48px, 7svh, 60px);
    height: clamp(48px, 7svh, 60px);
  }

  .map__pre {
    margin-top: clamp(8px, 1.6svh, 14px);
  }

  .map__name {
    font-size: 20px;
  }
}

@media (min-width: 1024px) {
  .map__emblem {
    width: clamp(48px, 7svh, 64px);
    height: clamp(48px, 7svh, 64px);
  }

  .map__name {
    font-size: 22px;
  }
}

/* ---------- About ---------- */

.about {
  padding-top: var(--section);
}

.about__text {
  margin-top: 24px;
  color: var(--ink-2);
}

.about__text p + p {
  margin-top: 16px;
}

@media (min-width: 960px) {
  .about__grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: 64px;
    align-items: start;
  }

  .about__text {
    margin-top: 44px;
  }
}

/* ---------- Path ---------- */

.path {
  margin-top: 72px;
}

.path__caption {
  max-width: var(--measure);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.25;
  text-wrap: balance;
}

.path__list {
  margin-top: 40px;
}

.path__item {
  position: relative;
  padding: 0 0 28px 32px;
}

/* dot */
.path__item::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 0;
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  background: var(--bg);
}

/* line to the next dot */
.path__item::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: -5px;
  left: 4px;
  width: 1px;
  background: var(--line-strong);
}

.path__item:last-child {
  padding-bottom: 0;
}

.path__item:last-child::after {
  display: none;
}

.path__name {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.1;
}

.path__desc {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}

@media (min-width: 960px) {
  .path__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 24px;
  }

  .path__item {
    padding: 32px 0 0;
  }

  .path__item::before {
    top: 0;
  }

  .path__item::after {
    top: 4px;
    right: -20px;
    bottom: auto;
    left: 13px;
    width: auto;
    height: 1px;
  }
}

/* ---------- Practices ---------- */

.practices {
  padding-top: var(--section);
}

.section-head {
  max-width: var(--measure);
}

.group {
  margin-top: 48px;
}

.group + .group {
  margin-top: 56px;
}

.group__label {
  margin-bottom: 16px;
}

.cards {
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .cards {
    gap: 24px;
  }
}

@media (min-width: 960px) {
  .cards--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .cards--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  scroll-margin-top: 24px;
}

@media (min-width: 768px) {
  .card {
    padding: 32px 32px 30px;
  }
}

/* Opened from the map: one soft flash */
.card:target {
  animation: card-flash 1.6s ease-out;
}

@keyframes card-flash {
  from {
    background-color: var(--flash);
  }
  to {
    background-color: var(--surface);
  }
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card__emblem {
  flex: none;
  width: 56px;
  height: 56px;
}

.card__num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: lining-nums;
  color: var(--ink-3);
}

.card__title {
  margin-top: 24px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.05;
  text-wrap: balance;
}

.card__kicker {
  margin-top: 10px;
}

.card__kicker::after {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  margin-top: 20px;
  background: var(--line-strong);
}

.card__text {
  margin-top: 20px;
  font-size: 16px;
  color: var(--ink-2);
}

/* Link out to a partner site */
.card__link {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
}

.card__link span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(154, 90, 68, 0.4);
}

.card__link svg {
  width: 15px;
  height: 10px;
  flex: none;
  transition: transform 0.25s var(--spring);
}

@media (hover: hover) {
  .card__link:hover {
    color: var(--ink);
  }

  .card__link:hover span {
    text-decoration-color: currentColor;
  }

  .card__link:hover svg {
    transform: translateX(4px);
  }
}

.card__link:active svg {
  transform: translateX(2px);
  transition-duration: 0.1s;
}

.card__focus {
  margin-top: auto;
  padding-top: 24px;
}

/* ---------- Closing and footer ---------- */

.closing {
  padding: var(--section) 0;
  text-align: center;
}

.closing::before {
  content: "";
  display: block;
  width: 1px;
  height: 64px;
  margin: 0 auto 48px;
  background: var(--line-strong);
}

.closing__line {
  max-width: 18em;
  margin: 0 auto;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 6.4vw, 46px);
  line-height: 1.15;
  text-wrap: balance;
}

.closing__text {
  max-width: 34em;
  margin: 20px auto 0;
  color: var(--ink-2);
  text-wrap: balance;
}

.closing__label {
  margin-top: 36px;
}

.closing__contact {
  margin-top: 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(22px, 4.6vw, 30px);
  line-height: 1.2;
}

.closing__contact a {
  color: var(--ink);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 6px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

@media (hover: hover) {
  .closing__contact a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
  }
}

.footer {
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-3);
}

.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

/* ---------- 404 ---------- */

.notfound {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 64px 0;
  text-align: center;
}

.notfound__mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  line-height: 1;
}

.notfound__title {
  margin-top: 40px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 7vw, 48px);
  line-height: 1.1;
}

.notfound__text {
  max-width: 30em;
  margin: 16px auto 0;
  color: var(--ink-2);
}

.notfound__link {
  display: inline-block;
  margin-top: 32px;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
