/* ---------- Fonts ---------- */
@font-face {
  font-family: "TAY Bang!";
  src: url("../fonts/taybang.woff2") format("woff2"),
       url("../fonts/taybang.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #f9f9f9;
  --display-color: #393939;
  --label-color: #7d7d7d;
  --rule: #7d7d7d;
  --dot: 1px;   /* divider dot size */
  --gap: 6px;   /* space between divider dots */

  --font-display: "TAY Bang!", Georgia, serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --label-size: 12px;
  --display-size: 60px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--display-color);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Grid (mobile: one column) ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: clamp(280px, 80vw, 340px);
  padding: 60px 20px 0;
  text-align: center;
}

/* Dotted dividers: 1x1 dots, 6px apart. Drawn with gradients (not
   `border: dotted`) so the dot size and spacing are exact in every browser. */
.cell::after {                       /* horizontal rule along the bottom */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--dot);
  background-image: linear-gradient(to right, var(--rule) var(--dot), transparent var(--dot));
  background-size: calc(var(--dot) + var(--gap)) var(--dot);
  background-repeat: repeat-x;
  pointer-events: none;
}

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

/* ---------- Text ---------- */
.label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-color);
}

/* The value is centered in the space under the label, so values line up
   across a row. The optional detail line hangs below it. */
.stack {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.value {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--display-size);
  font-weight: 400;
  line-height: 1;
  color: var(--display-color);
}

.detail {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + var(--display-size) * 0.8);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--display-color);
}

/* ---------- Links ---------- */
.value a,
.detail a {
  color: inherit;
  text-decoration: none;
}

.value a:hover,
.value a:focus-visible,
.detail a:hover,
.detail a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}

.value a:focus-visible,
.detail a:focus-visible {
  outline: 2px solid var(--label-color);
  outline-offset: 6px;
  border-radius: 2px;
}

/* ---------- Desktop: 2x2 grid that always fills the window ---------- */
@media (min-width: 768px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(2, minmax(220px, 1fr));
  }

  /* Type scales with the window (width or height, whichever is tighter). */
  :root { --display-size: clamp(34px, min(4.3vw, 8vh), 120px); }

  .cell {
    min-height: 0;
    padding: clamp(28px, 7vh, 80px) 24px;
  }

  .cell:nth-child(n+3)::after { display: none; }     /* no rule under the bottom row */

  .cell:nth-child(even)::before {    /* vertical rule between the columns */
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--dot);
    background-image: linear-gradient(to bottom, var(--rule) var(--dot), transparent var(--dot));
    background-size: var(--dot) calc(var(--dot) + var(--gap));
    background-repeat: repeat-y;
    pointer-events: none;
  }
}
