/*
 * Styles for «گذار» (Gozar). Mobile first; no external resources.
 * Colors: a neutral turquoise/teal and saffron, deliberately not taken from any flag
 * or political symbol (see docs/decisions.md).
 */

/* ------------------------------------------------------------------ font */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --md-text-font: "Vazirmatn";
  --gozar-saffron: #f2b632;
  --gozar-saffron-dark: #b07800;
  --gozar-teal: #0b5563;
  --gozar-radius: 0.6rem;
}

/* ---------------------------------------------------------------- colors */

[data-md-color-primary="custom"] {
  --md-primary-fg-color: #0b5563;
  --md-primary-fg-color--light: #11707f;
  --md-primary-fg-color--dark: #073d47;
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: #ffffffb3;
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color: #c98a00;
  --md-accent-fg-color--transparent: #c98a001a;
  --md-accent-bg-color: #ffffff;
  --md-accent-bg-color--light: #ffffffb3;
}

[data-md-color-scheme="slate"][data-md-color-primary="custom"] {
  --md-primary-fg-color: #0e6878;
  --md-primary-fg-color--light: #1a8596;
  --md-primary-fg-color--dark: #0a4b57;
  --md-typeset-a-color: #5cc7d6;
}

[data-md-color-scheme="slate"][data-md-color-accent="custom"] {
  --md-accent-fg-color: #f2b632;
  --md-accent-fg-color--transparent: #f2b6321a;
}

[data-md-color-scheme="slate"] {
  --md-hue: 200;
}

/* ------------------------------------------------------------ typography */

.md-typeset {
  font-size: 0.86rem;
  line-height: 1.85;
}

[dir="ltr"] .md-typeset {
  font-size: 0.82rem;
  line-height: 1.7;
}

.md-typeset h1 {
  font-weight: 800;
  color: var(--md-default-fg-color);
  margin-bottom: 0.8em;
  line-height: 1.4;
}

.md-typeset h2 {
  font-weight: 700;
  line-height: 1.5;
}

.md-typeset h3 {
  font-weight: 700;
}

.md-typeset table:not([class]) {
  font-size: 0.78rem;
}

.md-typeset table:not([class]) th {
  white-space: nowrap;
}

/* Persian numbering for ordered lists on Persian pages. */
[dir="rtl"] .md-typeset ol:not(.gozar-timeline) {
  list-style-type: persian;
}

/* Keep code and commands left-to-right inside right-to-left pages. */
.md-typeset code,
.md-typeset pre {
  direction: ltr;
  unicode-bidi: isolate;
}

.md-typeset blockquote {
  border-inline-start-color: var(--md-accent-fg-color);
}

/* -------------------------------------------- plain-language summary box */

:root {
  --md-admonition-icon--simple: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11h3v2h-3zM1 11h3v2H1zM13 1v3h-2V1zM4.92 3.5l2.13 2.14-1.42 1.41L3.5 4.93zm12.03 2.13 2.12-2.13 1.43 1.43-2.13 2.12zM12 6a6 6 0 0 1 6 6c0 2.22-1.21 4.16-3 5.2V19a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-1.8c-1.79-1.04-3-2.98-3-5.2a6 6 0 0 1 6-6m2 15v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-1zm-3-3h2v-2.13c1.73-.44 3-2.01 3-3.87a4 4 0 0 0-4-4 4 4 0 0 0-4 4c0 1.86 1.27 3.43 3 3.87z"/></svg>');
}

.md-typeset .admonition.simple,
.md-typeset details.simple {
  border-color: var(--gozar-saffron);
  font-size: 0.9rem;
  line-height: 1.9;
  background: color-mix(in srgb, var(--gozar-saffron) 7%, transparent);
}

[dir="ltr"] .md-typeset .admonition.simple {
  font-size: 0.86rem;
  line-height: 1.75;
}

.md-typeset .simple > .admonition-title,
.md-typeset .simple > summary {
  background-color: color-mix(in srgb, var(--gozar-saffron) 18%, transparent);
  font-weight: 700;
}

.md-typeset .simple > .admonition-title::before,
.md-typeset .simple > summary::before {
  background-color: var(--gozar-saffron-dark);
  -webkit-mask-image: var(--md-admonition-icon--simple);
  mask-image: var(--md-admonition-icon--simple);
}

[data-md-color-scheme="slate"] .md-typeset .simple > .admonition-title::before {
  background-color: var(--gozar-saffron);
}

/* ------------------------------------------------ "needs source" markers */

.md-typeset a.needs-source {
  display: inline-block;
  font-size: 0.72em;
  line-height: 1.4;
  padding: 0 0.35em;
  margin-inline: 0.15em;
  border-radius: 0.3em;
  border: 1px dashed var(--gozar-saffron-dark);
  color: var(--gozar-saffron-dark);
  background: color-mix(in srgb, var(--gozar-saffron) 10%, transparent);
  vertical-align: 0.15em;
  white-space: nowrap;
}

[data-md-color-scheme="slate"] .md-typeset a.needs-source {
  color: var(--gozar-saffron);
  border-color: var(--gozar-saffron);
}

.md-typeset a.needs-source:hover {
  background: color-mix(in srgb, var(--gozar-saffron) 25%, transparent);
}

/* --------------------------------------------------- document status line */

.gozar-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  align-items: center;
  font-size: 0.68rem;
  margin: 0 0 0.6rem;
  color: var(--md-default-fg-color--light);
}

.gozar-status__label::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-inline-end: 0.35rem;
  background: var(--gozar-saffron);
  vertical-align: 0.05rem;
}

.gozar-status--reviewed .gozar-status__label::before {
  background: #2e9e5b;
}

.gozar-status__sources {
  color: var(--gozar-saffron-dark) !important;
  text-decoration: underline dotted;
}

[data-md-color-scheme="slate"] .gozar-status__sources {
  color: var(--gozar-saffron) !important;
}

/* Hide the "draft" icon in navigation (almost everything is a draft for now). */
.md-status--draft {
  display: none;
}

.md-status--reviewed::after {
  -webkit-mask-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68zm-13 5-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9z"/></svg>');
  mask-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68zm-13 5-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9z"/></svg>');
  background-color: #2e9e5b;
}

/* ------------------------------------------------------- page action bar */

.gozar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.md-typeset .gozar-actions .md-button,
.gozar-actions .md-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.72rem;
  padding: 0.55em 1.1em;
  border-radius: var(--gozar-radius);
  cursor: pointer;
  font-family: inherit;
  background: transparent;
}

.gozar-actions .md-button svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}

.md-typeset .gozar-actions .md-button--primary,
.gozar-actions .md-button--primary {
  background-color: var(--md-primary-fg-color);
  border-color: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
}

.md-typeset .gozar-actions .md-button--primary:hover,
.gozar-actions .md-button--primary:hover {
  background-color: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
}

@media screen and (min-width: 45em) {
  .gozar-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.gozar-share-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  font-size: 0.7rem;
}

.gozar-share-menu[hidden] {
  display: none;
}

.gozar-share-menu a,
.gozar-share-menu button {
  padding: 0.35em 0.9em;
  border-radius: 1em;
  border: 1px solid var(--md-default-fg-color--lighter);
  color: var(--md-default-fg-color);
  background: var(--md-default-bg-color);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.gozar-toast {
  position: fixed;
  inset-inline: 1rem;
  bottom: 1rem;
  margin: 0 auto;
  max-width: 20rem;
  padding: 0.6rem 1rem;
  border-radius: var(--gozar-radius);
  background: var(--md-default-fg-color);
  color: var(--md-default-bg-color);
  font-size: 0.72rem;
  text-align: center;
  z-index: 10;
}

/* -------------------------------- Persian pages inside the English site */

.gozar-fallback {
  font-family: "Vazirmatn", sans-serif;
}

.gozar-fallback .md-typeset,
.md-typeset .gozar-fallback {
  text-align: start;
}

/* Material's full-bleed table margins assume the page direction; inside an RTL block on
   an LTR page they push tables off-screen on phones. */
.gozar-fallback .md-typeset__scrollwrap {
  margin-left: 0;
  margin-right: 0;
}

/* The English "not yet translated" notice stays left-to-right. */
.md-typeset .admonition.gozar-untranslated {
  direction: ltr;
  text-align: left;
}

/* --------------------------------------------------------------- home page */

.gozar-hero {
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.md-typeset .gozar-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.3rem;
  color: var(--md-primary-fg-color);
}

[data-md-color-scheme="slate"] .md-typeset .gozar-hero h1 {
  color: var(--md-typeset-a-color);
}

.gozar-hero__tagline {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 1.4rem;
  color: var(--md-default-fg-color--light);
}

.gozar-what {
  text-align: start;
  font-size: 0.95rem;
  line-height: 2;
  max-width: 38rem;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.2rem;
  border-radius: var(--gozar-radius);
  background: var(--md-code-bg-color);
}

[dir="ltr"] .gozar-what {
  font-size: 0.88rem;
  line-height: 1.75;
}

.md-typeset .gozar-what h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.gozar-what p {
  margin: 0;
}

.gozar-cta {
  display: grid;
  gap: 0.7rem;
  max-width: 38rem;
  margin: 0 auto 2rem;
}

/* Markdown wraps the three links in one paragraph; let them join the grid directly. */
.gozar-cta > p {
  display: contents;
}

.md-typeset .gozar-cta .md-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  border-radius: var(--gozar-radius);
}

.md-typeset .gozar-cta .md-button svg {
  width: 1.3em;
  height: 1.3em;
  fill: currentColor;
}

@media screen and (min-width: 45em) {
  .gozar-cta {
    grid-template-columns: repeat(3, 1fr);
    max-width: 52rem;
  }
}

.gozar-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.4rem;
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
  margin-bottom: 1.5rem;
}

.gozar-stats strong {
  color: var(--md-default-fg-color);
  font-size: 0.95rem;
}

.gozar-cards {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0 1.5rem;
}

@media screen and (min-width: 45em) {
  .gozar-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (min-width: 76em) {
  .gozar-cards--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gozar-card {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: var(--gozar-radius);
  padding: 0.9rem 1rem;
  background: var(--md-default-bg-color);
}

.md-typeset .gozar-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
}

.md-typeset .gozar-card p {
  margin: 0.2rem 0;
  font-size: 0.78rem;
}

.gozar-card__icon svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: var(--md-accent-fg-color);
}

/* ------------------------------------------------ timeline ("at a glance") */

.gozar-strip {
  display: flex;
  gap: 2px;
  margin: 1rem 0 0.4rem;
  border-radius: var(--gozar-radius);
  overflow: hidden;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
}

.gozar-strip > a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  padding: 0.45rem 0.15rem;
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.gozar-strip__legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--md-default-fg-color--light);
  margin-bottom: 1.5rem;
}

.gozar-phase-0 { --phase: #6b7a86; }
.gozar-phase-1 { --phase: #b3261e; }
.gozar-phase-2 { --phase: #d9730d; }
.gozar-phase-3 { --phase: #b08900; }
.gozar-phase-4 { --phase: #2e7d6b; }
.gozar-phase-5 { --phase: #0b5563; }
.gozar-phase-6 { --phase: #4a4f9a; }

.gozar-strip > a {
  background: var(--phase);
}

.gozar-timeline {
  position: relative;
  margin: 1rem 0 2rem;
  padding: 0;
  list-style: none;
}

.md-typeset ol.gozar-timeline {
  margin-inline-start: 0;
}

.gozar-timeline::before {
  content: "";
  position: absolute;
  inset-block: 0.5rem;
  inset-inline-start: 0.6rem;
  width: 3px;
  background: var(--md-default-fg-color--lightest);
  border-radius: 3px;
}

.md-typeset .gozar-timeline > li {
  position: relative;
  margin: 0 0 1.1rem;
  padding-inline-start: 2.1rem;
  list-style: none;
}

.gozar-timeline > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.18rem;
  top: 0.9rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--phase);
  box-shadow: 0 0 0 4px var(--md-default-bg-color);
}

.gozar-phase {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-inline-start: 5px solid var(--phase);
  border-radius: var(--gozar-radius);
  padding: 0.7rem 1rem 0.6rem;
  background: var(--md-default-bg-color);
}

.gozar-phase__when {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  color: #fff;
  background: var(--phase);
  border-radius: 1em;
  padding: 0.05rem 0.7rem;
}

.md-typeset .gozar-phase h3 {
  margin: 0.35rem 0 0.2rem;
  font-size: 0.95rem;
}

.md-typeset .gozar-phase ul {
  margin: 0.3rem 0;
  font-size: 0.78rem;
}

.md-typeset .gozar-phase ul li {
  margin-bottom: 0.15rem;
}

.gozar-phase__goal {
  font-weight: 600;
  font-size: 0.8rem;
  margin: 0.2rem 0;
}

.gozar-phase__more {
  font-size: 0.72rem;
}

/* ------------------------------------------------ participate page ("how") */

.gozar-steps {
  counter-reset: step;
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0 1.5rem;
}

.gozar-step {
  position: relative;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: var(--gozar-radius);
  padding: 0.8rem 1rem 0.8rem;
  padding-inline-start: 3.2rem;
}

.gozar-step::before {
  counter-increment: step;
  content: counter(step, persian);
  position: absolute;
  inset-inline-start: 0.8rem;
  top: 0.8rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: var(--md-primary-fg-color);
}

[dir="ltr"] .gozar-step::before {
  content: counter(step);
}

.md-typeset .gozar-step h3 {
  margin: 0.1rem 0 0.3rem;
  font-size: 0.88rem;
}

.md-typeset .gozar-step p {
  margin: 0.2rem 0;
  font-size: 0.8rem;
}

/* Imitations of GitHub buttons, so readers recognise them on the real site. */
.gh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  direction: ltr;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15em 0.75em;
  border-radius: 0.4em;
  border: 1px solid #d0d7de;
  background: #f6f8fa;
  color: #24292f;
  white-space: nowrap;
  vertical-align: middle;
}

.gh-btn--green {
  background: #1f883d;
  border-color: #1a7f37;
  color: #fff;
}

.gh-btn svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.gozar-paths {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0 1.5rem;
}

@media screen and (min-width: 45em) {
  .gozar-paths {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gozar-path {
  border-radius: var(--gozar-radius);
  padding: 0.9rem 1rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-top: 4px solid var(--md-accent-fg-color);
}

.gozar-path__time {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--md-accent-fg-color);
}

.md-typeset .gozar-path h3 {
  margin: 0.2rem 0 0.3rem;
  font-size: 0.9rem;
}

.md-typeset .gozar-path p,
.md-typeset .gozar-path li {
  font-size: 0.78rem;
}

/* ------------------------------------------------------------ small screens */

@media screen and (max-width: 44.9375em) {
  .md-typeset {
    font-size: 0.84rem;
  }

  .md-typeset h1 {
    font-size: 1.5rem;
  }

  .md-typeset .gozar-hero h1 {
    font-size: 1.7rem;
  }

  /* Wide tables scroll horizontally instead of breaking the layout. */
  .md-typeset__table {
    display: block;
    overflow-x: auto;
  }
}

/* ------------------------------------------------------------------ print */

@media print {
  .gozar-actions,
  .gozar-share-menu,
  .gozar-status__sources,
  .md-content__button {
    display: none !important;
  }

  .md-typeset a.needs-source {
    border: none;
    padding: 0;
    color: inherit;
    background: none;
  }
}

/* Never let anything widen the page on phones (e.g. Persian titles in the English navigation
   drawer). "clip" does not create a scroll container, so sticky headers keep working. */
html,
body {
  overflow-x: clip;
}
