/* Mocka website stylesheet.
   Design tokens first, then the reset, then components. Every color pair
   here is checked for WCAG AA contrast in both schemes. */

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

:root {
  color-scheme: light;

  /* Surfaces and text. Warm neutrals, not pure grey. */
  --color-bg: #fffdfb;
  --color-surface: #f7f2ec;
  --color-sunken: #efe7de;
  /* Cards and other lifted surfaces, one step away from the section behind. */
  --color-raised: #fffdfb;
  --color-text: #1c1613;
  --color-text-muted: #5a4f47;
  --color-border: #e3d9cf;
  --color-border-strong: #cdbfb1;

  /* Coffee accents, taken from the browns in the Mocka cup logo so the
     artwork and the interface agree. */
  --color-accent: #6b3f22;
  --color-accent-hover: #5a3219;
  --color-on-accent: #fffdfb;

  /* Status badges. */
  --badge-alpha-fg: #6d4212;
  --badge-alpha-bg: #f7e6d0;
  --badge-beta-fg: #14505e;
  --badge-beta-bg: #d9ecf0;
  --badge-stable-fg: #1c5230;
  --badge-stable-bg: #dcecdf;
  --badge-planned-fg: #554a42;
  --badge-planned-bg: #ece5dd;

  --shadow-card: 0 1px 2px rgb(28 22 19 / 6%), 0 8px 24px rgb(28 22 19 / 5%);

  /* Type. System stack, with the faces GhostBSD and FreeBSD actually ship
     named before the generic fallback. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Cantarell, "Noto Sans",
    "DejaVu Sans", sans-serif;
  --font-mono: ui-monospace, "DejaVu Sans Mono", "Liberation Mono", monospace;

  /* Fluid where it earns it, fixed where it does not. */
  --text-xs: 0.78rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.45rem);
  --text-2xl: clamp(1.5rem, 1.25rem + 1.1vw, 2rem);
  --text-3xl: clamp(1.9rem, 1.4rem + 2.1vw, 2.75rem);
  --text-4xl: clamp(2.3rem, 1.5rem + 3.4vw, 3.75rem);

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.65;

  /* Spacing scale. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --width-max: 68rem;
  --width-prose: 36rem;
  /* Body copy on reading pages. Larger than interface text so that a
     comfortable measure fills a column that does not look thin. */
  --text-prose: 1.1875rem;
  --gutter: var(--space-4);

  --border-hairline: 1px solid var(--color-border);
  --transition: 120ms ease;

  /* Reading pages: the measure is capped in characters, and the type is
     larger so that measure fills a comfortable column. */
  --width-reading: 42rem;
}

@media (min-width: 640px) {
  :root {
    --gutter: var(--space-6);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --color-bg: #16120f;
    --color-surface: #201a16;
    --color-sunken: #100d0b;
    /* Lifted surfaces go lighter in the dark scheme, not darker. */
    --color-raised: #2a231e;
    --color-text: #f4efe9;
    --color-text-muted: #b6a99d;
    --color-border: #332b24;
    --color-border-strong: #4a3f36;

    /* Espresso is too dark to read on a dark background, so the accent
       moves up the scale to caramel. */
    --color-accent: #e0a86a;
    --color-accent-hover: #f0bd85;
    --color-on-accent: #1c1613;

    --badge-alpha-fg: #f0c48a;
    --badge-alpha-bg: #3a2a14;
    --badge-beta-fg: #8fd0de;
    --badge-beta-bg: #10323a;
    --badge-stable-fg: #9bd6ab;
    --badge-stable-bg: #14321e;
    --badge-planned-fg: #c3b6aa;
    --badge-planned-bg: #2a231e;

    --shadow-card: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

/* ----------------------------------------------------------------- Reset */

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  /* Keep the footer at the bottom on short pages. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-4);
  font-weight: 650;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
}

p {
  text-wrap: pretty;
}

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

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

img,
picture,
svg {
  max-width: 100%;
  height: auto;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
  background: var(--color-sunken);
}

pre {
  padding: var(--space-4);
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: var(--color-sunken);
}

pre code {
  padding: 0;
  background: none;
}

hr {
  height: 1px;
  margin: var(--space-7) 0;
  border: 0;
  background: var(--color-border);
}

blockquote {
  margin: var(--space-5) 0;
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-border-strong);
  color: var(--color-text-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-5);
}

th,
td {
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-hairline);
  text-align: left;
}

/* --------------------------------------------------------------- Focus */

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

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

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

.wrap {
  width: 100%;
  max-width: var(--width-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Reading pages. The children are capped at a comfortable measure and
   centred in the page, so the column sits on its own rather than running
   the full width of the other sections. */
.wrap--reading > * {
  max-width: var(--width-reading);
  margin-inline: auto;
}

.site-main {
  flex: 1;
}

.section {
  padding-block: var(--space-7);
}

@media (min-width: 640px) {
  .section {
    padding-block: var(--space-8);
  }
}

.section--tint {
  background: var(--color-surface);
}

.section__lead {
  max-width: var(--width-prose);
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

/* Sent to the top of the page for keyboard and screen reader users. */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  color: var(--color-on-accent);
  transform: translateY(0);
}

/* --------------------------------------------------------------- Header */

.site-header {
  border-bottom: var(--border-hairline);
  background: var(--color-bg);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-4);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-accent);
  text-decoration: none;
}

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

.wordmark__logo {
  display: block;
  width: 2rem;
  height: 2rem;
}

.site-nav {
  /* Push navigation to the right once there is room for it. */
  margin-inline-start: auto;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: inline-block;
  padding-block: var(--space-1);
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
}

.site-nav__link:hover {
  color: var(--color-text);
  border-bottom-color: var(--color-border-strong);
}

.site-nav__link[aria-current="page"] {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
}

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

.site-footer {
  margin-top: var(--space-8);
  padding-block: var(--space-7) var(--space-6);
  border-top: var(--border-hairline);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

.site-footer__groups {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .site-footer__groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.footer-group__title {
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.footer-group__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

.footer-group__list a {
  color: var(--color-text);
  text-decoration: none;
}

.footer-group__list a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.site-footer__meta {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--border-hairline);
  color: var(--color-text-muted);
}

.site-footer__meta p {
  margin: 0 0 var(--space-1);
}

/* -------------------------------------------------------------- Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition);
}

.button--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.button--primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-on-accent);
}

.button--secondary {
  border-color: var(--color-border-strong);
  background: transparent;
  color: var(--color-text);
}

.button--secondary:hover {
  border-color: var(--color-accent);
  background: var(--color-surface);
  color: var(--color-accent-hover);
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* --------------------------------------------------------------- Badges */

.badge {
  display: inline-block;
  padding: 0.15em 0.7em;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.03em;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--badge-planned-bg);
  color: var(--badge-planned-fg);
}

.badge--alpha {
  background: var(--badge-alpha-bg);
  color: var(--badge-alpha-fg);
}

.badge--beta {
  background: var(--badge-beta-bg);
  color: var(--badge-beta-fg);
}

.badge--stable {
  background: var(--badge-stable-bg);
  color: var(--badge-stable-fg);
}

.badge--planned {
  background: var(--badge-planned-bg);
  color: var(--badge-planned-fg);
}

/* ----------------------------------------------------------------- Cards */

.card {
  padding: var(--space-5);
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
}

/* -------------------------------------------------------- Device frames */

/* Both frames are drawn in CSS. No frame image is ever requested. */

.device-laptop__screen {
  padding: var(--space-2);
  border-radius: 12px 12px 3px 3px;
  background: #2b241f;
  box-shadow: var(--shadow-card);
}

.device-laptop__screen img {
  display: block;
  width: 100%;
  border-radius: 3px;
}

/* The lid sits on a base slightly wider than the screen. */
.device-laptop__base {
  height: 10px;
  margin-inline: -4%;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(var(--color-border-strong), var(--color-border));
}

.device-window {
  overflow: hidden;
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
  box-shadow: var(--shadow-card);
}

.device-window__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 2rem;
  padding-inline: var(--space-3);
  border-bottom: var(--border-hairline);
  background: var(--color-sunken);
}

.device-window__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--color-border-strong);
}

.device-window img {
  display: block;
  width: 100%;
}

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

.hero {
  padding-block: var(--space-7) var(--space-6);
}

.hero__inner {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 1024px) {
  .hero {
    padding-block: var(--space-8) var(--space-7);
  }

  .hero__inner {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: var(--space-8);
  }
}

.hero__headline {
  margin-bottom: var(--space-4);
  font-size: var(--text-4xl);
  letter-spacing: -0.025em;
}

.hero__subline {
  max-width: 34rem;
  margin-bottom: var(--space-5);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}

/* ------------------------------------------------------------ Highlight */

/* A section that butts against the one before it. */
.section--flush {
  padding-top: 0;
}

.highlight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  transition: border-color var(--transition), background-color var(--transition);
}

.highlight:hover {
  border-color: var(--color-accent);
  background: var(--color-sunken);
  color: var(--color-text);
}

.highlight__label {
  padding: 0.15em 0.7em;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.highlight__body {
  flex: 1;
  min-width: 8rem;
}

.highlight__title {
  display: block;
  font-weight: 650;
}

.highlight__text {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.highlight__arrow {
  color: var(--color-accent);
  font-size: var(--text-lg);
}

/* ------------------------------------------------------- Feature story */

.feature {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.feature + .feature {
  margin-top: var(--space-8);
}

@media (min-width: 1024px) {
  .feature {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-8);
  }

  /* Even numbered stories put the screenshot on the left. */
  .feature--reverse .feature__visual {
    order: -1;
  }
}

.feature__eyebrow {
  margin-bottom: var(--space-2);
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feature__title {
  margin-bottom: var(--space-3);
}

.feature__text p:last-child {
  margin-bottom: 0;
}

/* ----------------------------------------------------------- Why Mocka */

.why-grid {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .why-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
  }
}

.why__title {
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
}

.why__text {
  margin-bottom: 0;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------- Get involved */

.involve-grid {
  display: grid;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .involve-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .involve-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.involve {
  padding-top: var(--space-4);
  border-top: 2px solid var(--color-border-strong);
}

.involve__title {
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
}

.involve__title a {
  text-decoration: none;
}

.involve__title a:hover {
  text-decoration: underline;
}

.involve__text {
  margin-bottom: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------ Get Mocka */

.get-mocka {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 1024px) {
  .get-mocka {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-8);
  }
}

.get-mocka__text p {
  max-width: 38rem;
  margin-bottom: 0;
  color: var(--color-text-muted);
}

.get-mocka__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.get-mocka__notes {
  font-size: var(--text-sm);
  font-weight: 550;
}

/* ----------------------------------------------------------------- News */

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.section__more {
  font-size: var(--text-sm);
  font-weight: 600;
}

.news-list {
  display: grid;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .news-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* The full listing stays one column so summaries have room. */
  .news-list--full {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

.news-item {
  padding-top: var(--space-4);
  border-top: var(--border-hairline);
}

.news-item__date {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.news-item__title {
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
}

.news-item__title a {
  text-decoration: none;
}

.news-item__title a:hover {
  text-decoration: underline;
}

.news-item__summary {
  color: var(--color-text-muted);
}

.news-item__summary p:last-child {
  margin-bottom: 0;
}

.news-list__empty {
  color: var(--color-text-muted);
}

.news-item__cover {
  display: block;
  margin-bottom: var(--space-4);
  overflow: hidden;
  border-radius: var(--radius-md);
}

.news-item__cover img {
  display: block;
  width: 100%;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--border-hairline);
  font-size: var(--text-sm);
}

.pagination__status {
  color: var(--color-text-muted);
}

.pagination__link {
  font-weight: 600;
}

/* ----------------------------------------------------------------- Page */

.page__title {
  margin-bottom: var(--space-6);
}

.page__body {
  font-size: var(--text-prose);
}

.page__body h2 {
  margin-top: var(--space-6);
  font-size: var(--text-xl);
}

.page__body h3 {
  margin-top: var(--space-5);
  font-size: var(--text-lg);
}

/* Offsets the jump target so a linked heading is not flush to the top. */
.page__body :target {
  scroll-margin-top: var(--space-5);
}

/* -------------------------------------------------------------- Article */

.article__back {
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  font-weight: 550;
}

.article__header {
  margin-bottom: var(--space-6);
}

.article__title {
  margin-bottom: var(--space-2);
}

.article__meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.article__cover {
  margin-bottom: var(--space-6);
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.article__cover img {
  display: block;
  width: 100%;
}

.article__body {
  font-size: var(--text-prose);
}

.article__body h2 {
  margin-top: var(--space-6);
  font-size: var(--text-xl);
}

.article__body h3 {
  margin-top: var(--space-5);
  font-size: var(--text-lg);
}

.article__body li {
  margin-bottom: var(--space-2);
}

/* ----------------------------------------------------------- Components */

.component-grid {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-6) 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .component-grid {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--space-5);
  }
}

.component-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
}

.component-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.component-card__name {
  margin: 0;
  font-size: var(--text-xl);
}

.component-card__description {
  /* Pushes the links to the bottom so cards in a row line up. */
  flex: 1;
  color: var(--color-text-muted);
}

.component-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  font-weight: 550;
}