/* Bauhaus edition. Rules: assets/downloads/bauhaus-ui.md */

/* ---------- Tokens (from the skill) ---------- */
:root {
  --color-red: #be1e2d;      /* white text on red: 6.2:1 */
  --color-yellow: #f2b705;   /* black text only: 10.4:1 */
  --color-blue: #1f3f99;     /* white text on blue: 9.4:1 */
  --color-black: #111111;
  --color-paper: #f4efe6;
  --color-white: #ffffff;
  --color-gray: #5e5e5e;     /* secondary text: 5.7:1 on paper */

  --font-display: "Futura PT", Futura, "Jost", "Century Gothic", sans-serif;
  --font-body: "Jost", "Futura PT", Futura, "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.8rem;
  --step-0: 1.0625rem;
  --step-1: 1.417rem;
  --step-2: 1.889rem;
  --step-3: 2.518rem;
  --step-4: 3.357rem;
  --step-5: 5.96rem;

  --leading-body: 1.55;
  --leading-tight: 1.0;
  --tracking-caps: 0.08em;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 96px;

  --bar: 8px;
  --radius-circle: 50%;
  --motion: 200ms ease-out;

  /* Theme roles. Panels of a primary set their own values below */
  --bg: var(--color-paper);
  --ink: var(--color-black);
  --muted: var(--color-gray);
  --key: var(--color-blue);     /* shape keys: information */
  --focus: var(--color-blue);
}

/* Dark theme: black and paper swap. Blue fails on black (2:1), so keys and focus use yellow */
:root[data-theme="dark"] {
  --bg: var(--color-black);
  --ink: var(--color-paper);
  --muted: #a8a29a;             /* 7.5:1 on black */
  --key: var(--color-yellow);
  --focus: var(--color-yellow);
  color-scheme: dark;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
}

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

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

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 2px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  z-index: 20;
  padding: var(--space-1) var(--space-2);
  background: var(--color-yellow);
  color: var(--color-black);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Shared parts ---------- */
.label {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.note {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* Triangle: direction. Points right; turns 90° to point down */
.tri {
  display: inline-block;
  flex: none;
  width: 0.7em;
  aspect-ratio: 1;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  transition: transform var(--motion);
}

.tri--down {
  transform: rotate(90deg);
}

/* Shape keys: square = desktop app, circle = web app, triangle = mobile app */
.key {
  display: inline-block;
  flex: none;
  width: 20px;
  aspect-ratio: 1;
  background: var(--key);
  transition: transform var(--motion);
}

.key--triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.key--circle {
  border-radius: var(--radius-circle);
}

/* Bar with a vertical label: the one place type turns 90°. Reads bottom to top */
.bar-label {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px var(--space-3);
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color var(--motion), color var(--motion);
}

.btn--primary {
  border-color: var(--color-red);
  background: var(--color-red);
  color: var(--color-white);
}

.btn:hover {
  border-color: var(--ink);
  background: var(--color-black);
  color: var(--color-white);
}

/* ---------- Header: black bar ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) clamp(16px, 2vw, 32px);
  border-bottom: 2px solid var(--ink);
  background: var(--color-black);
  color: var(--color-paper);
  --focus: var(--color-yellow);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step-1);
  font-weight: 700;
}

.wordmark__mark {
  display: inline-flex;
  gap: 4px;
}

.mark {
  width: 14px;
  aspect-ratio: 1;
}

.mark--circle {
  border-radius: var(--radius-circle);
  background: var(--color-red);
}

.mark--square {
  background: var(--color-blue);
  box-shadow: inset 0 0 0 1px var(--color-paper); /* keeps blue visible on black */
}

.mark--triangle {
  background: var(--color-yellow);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.site-header__colophon {
  display: none;
  margin-left: auto;
  color: #a8a29a;
  font-size: var(--step--1);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* Theme toggle: a circle, half black and half paper */
.theme-toggle {
  position: relative;
  width: 36px;
  aspect-ratio: 1;
  margin-left: auto;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--color-paper);
  border-radius: var(--radius-circle);
  background: var(--color-black);
  cursor: pointer;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  inset: 0 50% 0 0;
  background: var(--color-paper);
  transition: transform var(--motion);
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateX(100%);
}

@media (min-width: 60rem) {
  .site-header__colophon {
    display: block;
  }

  .theme-toggle {
    margin-left: 0;
  }
}

/* ---------- Board: panels on paper ---------- */
.board {
  display: grid;
  gap: var(--space-2);
  padding: 12px clamp(16px, 2vw, 32px);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.panel {
  --panel-bg: var(--bg);
  --panel-ink: var(--ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 20px;
  background: var(--panel-bg);
  color: var(--panel-ink);
}

.panel--yellow {
  --panel-bg: var(--color-yellow);
  --panel-ink: var(--color-black);
  --muted: var(--color-black);
}

.panel--red {
  --panel-bg: var(--color-red);
  --panel-ink: var(--color-white);
  --focus: var(--color-white);
}

/* Section head: number in a circle, lowercase title, thick bar below */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: var(--space-1);
  border-bottom: var(--bar) solid var(--panel-ink);
}

.section-head__num {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  aspect-ratio: 1;
  border-radius: var(--radius-circle);
  background: var(--panel-ink);
  color: var(--panel-bg);
  font-size: var(--step--1);
  font-weight: 700;
}

.section-head__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: var(--leading-tight);
}

/* ---------- Hero ---------- */
.hero,
.projects,
.system {
  padding: 0; /* paper panels sit on the ground with no frame */
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 15vw, var(--step-5));
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.hero__lead {
  max-width: 34em;
}

/* Composition on a 6 × 6 square module. The circle overlaps one corner of the square */
.composition {
  display: grid;
  grid-template: repeat(6, 1fr) / repeat(6, 1fr);
  width: min(100%, 480px);
  aspect-ratio: 1;
  container-type: inline-size;
}

.composition__square {
  grid-area: 2 / 2 / 7 / 7;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 7cqi;
  background: var(--color-blue);
  color: var(--color-white);
}

.composition__words {
  font-size: 7cqi;
  font-weight: 500;
  line-height: 1.1;
  text-align: right;
}

.composition__circle {
  grid-area: 1 / 1 / 4 / 4;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius-circle);
  background: var(--color-red);
  color: var(--color-white);
  font-family: var(--font-display);
  font-size: 18cqi;
  font-weight: 500;
  line-height: 1;
}

.composition__bar {
  grid-area: 6 / 1 / 7 / 2;
  align-self: end;
  height: var(--bar);
  background: var(--ink);
}

/* ---------- Profile ---------- */
.statement {
  font-weight: 500;
  line-height: 1.35;
}

.facts {
  display: grid;
  gap: var(--space-1);
  margin-top: auto;
}

.facts__item {
  padding-top: var(--space-1);
  border-top: 2px solid var(--panel-ink);
}

.facts__label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.count {
  display: grid;
  place-items: center;
  width: 24px;
  aspect-ratio: 1;
  border-radius: var(--radius-circle);
  background: var(--panel-ink);
  color: var(--panel-bg);
  font-weight: 700;
}

/* ---------- Contact: 2 × 2 ---------- */
.channels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
}

.channel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--space-1);
  padding: 4px var(--space-1);
  border-top: 2px solid var(--panel-ink);
  text-decoration: none;
  transition: background-color var(--motion);
}

.channel__name {
  font-weight: 700;
}

.channel__text {
  grid-row: 2;
  font-size: var(--step--1);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.channel .tri {
  grid-row: 1 / 3;
  grid-column: 2;
}

.channel:hover {
  background: var(--color-black);
}

.channel:hover .tri {
  transform: translateX(4px);
}

/* ---------- Projects ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px var(--space-2);
  border: 2px solid var(--ink);
}

.card--blue {
  --key: var(--color-white);
  --focus: var(--color-white);
  border-color: var(--color-blue);
  background: var(--color-blue);
  color: var(--color-white);
}

.card__title {
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.15;
}

.card__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-1);
  margin-top: auto;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.card__link,
.card__type {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.card__link {
  font-size: var(--step-0);
  text-decoration: none;
}

/* The whole card is the hit area of its link */
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Yellow bar on the right edge, with room kept for it */
.card:has(.card__flag) {
  padding-right: calc(36px + var(--space-2));
}

.card__flag {
  position: absolute;
  inset: 0 0 0 auto;
  width: 36px;
  background: var(--color-yellow);
  color: var(--color-black);
  line-height: 36px;
}

/* Selection motion: the key grows, the triangle moves forward */
.card:hover .key,
.card:focus-within .key {
  transform: scale(1.3);
}

.card:hover .card__link .tri,
.card:focus-within .card__link .tri {
  transform: translateX(4px);
}

/* Asymmetric pairs: 7 + 5, then 5 + 7 */
@media (min-width: 40rem) {
  .card:nth-child(4n + 1),
  .card:nth-child(4n + 4) {
    grid-column: span 7;
  }

  .card:nth-child(4n + 2),
  .card:nth-child(4n + 3) {
    grid-column: span 5;
  }
}

/* ---------- System ---------- */
.system {
  display: grid;
  gap: 12px var(--space-3);
}

@media (min-width: 40rem) {
  .system {
    grid-template-columns: 1fr 1fr;
  }

  .system .section-head {
    grid-column: 1 / -1;
  }
}

.system__intro,
.system__specs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.system__motto {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: var(--leading-tight);
}

.shapes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-1);
}

.shapes__item {
  display: grid;
  justify-items: start;
  gap: 4px;
  font-size: var(--step--1);
  line-height: 1.3;
}

.shapes__item strong {
  font-size: var(--step-0);
  font-weight: 500;
}

.shape {
  width: 32px;
  aspect-ratio: 1;
  margin-bottom: 4px;
}

.shape--circle {
  border-radius: var(--radius-circle);
  background: var(--color-red);
}

.shape--square {
  background: var(--color-blue);
}

.shape--triangle {
  background: var(--color-yellow);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.shape--bar {
  width: 16px;
  height: 32px;
  aspect-ratio: auto;
  margin-left: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 8px;
  line-height: 16px;
}

.proportion {
  display: flex;
  height: 24px;
  border: 2px solid var(--ink);
}

.proportion__part--ground { flex: 60; background: var(--bg); }
.proportion__part--ink { flex: 25; background: var(--ink); }
.proportion__part--red { flex: 5; background: var(--color-red); }
.proportion__part--yellow { flex: 5; background: var(--color-yellow); }
.proportion__part--blue { flex: 5; background: var(--color-blue); }

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--space-2);
}

.swatch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.swatch__chip {
  width: 16px;
  aspect-ratio: 1;
}

.swatch__chip--red { background: var(--color-red); }
.swatch__chip--blue { background: var(--color-blue); }
.swatch__chip--yellow { background: var(--color-yellow); }

.system .note {
  font-size: var(--step--1);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* ---------- One screen: wide and tall enough viewports ---------- */
@media (min-width: 75rem) and (min-height: 42rem) {
  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
  }

  .board {
    flex: 1;
    min-height: 0;
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .hero { grid-column: 1 / 4; }
  .stack:nth-of-type(1) { grid-column: 4 / 7; }
  .stack:nth-of-type(2) { grid-column: 7 / -1; }

  /* The panel on top of each stack takes the free height */
  .stack > .panel:first-child {
    flex: 1;
  }

  .hero__title {
    font-size: min(var(--step-5), 5.4vw, 10dvh);
  }

  /* The composition fills the space left under the text, as a square */
  .hero__art {
    flex: 1;
    min-height: 0;
    container-type: size;
  }

  .composition {
    width: min(100cqw, 100cqh);
  }

  .cards {
    flex: 1;
    grid-template-rows: 1fr 1fr;
  }
}

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