@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Noto+Sans+SC:wght@100..900&display=swap');

/* Tip 007: five CSS switches for text in a card, in English and Chinese. */

.tip-stage {
  --inter: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;
  --zh: 'PingFang SC', 'Noto Sans SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --ink: #17171a;
  --muted: #6f6d66;
  --accent: #3a5cff;
}

.tip-stage:has(> .tip-credit) { padding: 0; }

.area-top,
.area-bottom {
  position: absolute;
  left: 0;
  right: 0;
}

.area-top {
  top: 0;
  height: 780px;
  background: #c9c9cb url('./media/backdrop-cliffs.png') center bottom / cover;
}

.area-bottom {
  top: 780px;
  bottom: 0;
  background: #151515;
}

/* ---------- Language tab ---------- */

.langs {
  position: absolute;
  top: 36px;
  left: 50%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 280px;
  padding: 5px;
  translate: -50% 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.22);
}

.langs-pill {
  position: absolute;
  top: 5px;
  left: 5px;
  width: calc(50% - 5px);
  height: calc(100% - 10px);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.92);
}

.lang {
  position: relative;
  cursor: pointer;
  padding: 11px 0;
  color: rgba(40, 44, 52, 0.5);
  font: 600 20px/1 var(--inter);
  text-align: center;
}

.lang[data-lang="zh"] { font-family: var(--zh); }

/* ---------- Card ---------- */

/*
 * A white shell around an inner panel. The radii nest: the shell is 34 and
 * the panel sits 10 in, so it gets 34 - 10 = 24. Everything inside sits 28
 * in from the panel's edges, the button included.
 */
.card {
  position: absolute;
  top: 116px;
  left: 220px;
  width: 640px;
  padding: 10px;
  border-radius: 34px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(40, 36, 28, 0.05), 0 24px 48px -28px rgba(40, 36, 28, 0.26);
  font-family: var(--inter);
}

.card[data-lang="zh"] { font-family: var(--zh); }

.panel {
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #ebe9e3;
}

/* A type specimen. Its top corners are clipped to the panel's continuous
   corners by type.js. */
.art {
  position: relative;
  height: 236px;
  margin: 0;
  background-color: #f5f4f0;
  background-image: radial-gradient(circle, #d9d7cf 1.1px, transparent 1.5px);
  background-size: 18px 18px;
  background-position: 9px 9px;
  border-bottom: 1px solid #e3e1da;
}

.plan {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plan path { fill: none; }
.plan .metric { stroke: #bdbab0; stroke-width: 1; }
.plan .metric.is-base { stroke: #8f8c82; }
.plan .band { fill: color-mix(in srgb, var(--accent) 9%, transparent); stroke: none; }
.plan .cell { fill: #ffffff; stroke: var(--accent); stroke-width: 1.2; }
.plan .cell-guide { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.plan .glyph { fill: var(--ink); font-family: var(--inter); letter-spacing: -0.01em; }
.plan .glyph.is-zh { font-family: 'Noto Sans SC', var(--zh); letter-spacing: 0; }
.plan .glyph .is-accent { fill: var(--accent); }
.plan .label { fill: #8f8c82; font: 500 12px/1 var(--tip-font-mono); }
.plan .label.is-zh { font: 500 13px/1 var(--zh); }
.plan .label.is-end { text-anchor: end; }

/* The current weight, as a font tool labels it. */
.coords {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px #e4e2db;
  color: #6f6d66;
  font: 500 15px/1 var(--inter);
  white-space: nowrap;
}

.coords-dot {
  width: 8px;
  height: 8px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  --lumno-corner-shape: round;
  background: #ffffff;
  box-sizing: border-box;
}

.body { flex: 1; padding: 26px 28px 28px; }

.title {
  margin: 0 0 12px;
  color: var(--ink);
  font: 600 36px/1.18 var(--inter);
  letter-spacing: -0.02em;
}

.desc {
  margin: 0;
  color: var(--muted);
  font: 400 21px/1.55 var(--inter);
}

.card[data-lang="zh"] .title { font: 600 34px/1.3 var(--zh); letter-spacing: 0; }
/* Chinese lines hold a whole number of characters, so a justified line
   only stretches to absorb Latin words and squeezed punctuation. */
.card[data-lang="zh"] .desc { max-width: 26em; font: 400 21px/1.7 var(--zh); }

/* Clipped at the panel's sides, as an overflowing row would be. */
.foot {
  overflow: clip;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  border-top: 1px solid #e9e7e1;
}

.btn {
  padding: 13px 21px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
  font: 500 19px/1.15 var(--inter);
  box-shadow: 0 1px 2px rgba(23, 23, 26, 0.2), 0 6px 14px -8px rgba(23, 23, 26, 0.45);
}

.status {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #a3a097;
  font: 400 15px/1.2 var(--inter);
}

.status svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card[data-lang="zh"] :is(.btn, .status) { font-family: var(--zh); }

/* ---------- Before: what many projects ship ---------- */

/* The Chinese card's footer is fine as is; only its text is fixed. */
.card[data-lang="zh"] .btn { white-space: nowrap; }
.card[data-lang="zh"] .status { min-width: 0; }

/* ---------- The switches ---------- */

.card[data-lang="en"].fix-1 .title { text-wrap: balance; }
.card[data-lang="en"].fix-2 .desc { text-wrap: pretty; }
.card[data-lang="en"].fix-3 .coords { font-variant-numeric: tabular-nums; }
.card[data-lang="en"].fix-4 .btn { white-space: nowrap; }
.card[data-lang="en"].fix-5 .status { min-width: 0; }

.card[data-lang="zh"].fix-1 .desc { text-align: justify; }
.card[data-lang="zh"].fix-2 .desc { text-autospace: normal; }
.card[data-lang="zh"].fix-3 .desc { text-spacing-trim: trim-start; }
.card[data-lang="zh"].fix-4 .desc { text-wrap: pretty; }
.card[data-lang="zh"].fix-5 .title { word-break: keep-all; }

/* ---------- Gliding glyphs ---------- */

.ghosts { position: absolute; inset: 0; pointer-events: none; }
.ghost { position: absolute; white-space: pre; }

/* ---------- Change marks ---------- */

.marks { position: absolute; inset: 0; pointer-events: none; }

.mark { position: absolute; opacity: 0; }
.mark.is-bad { --c: #f0284a; }
.mark.is-good { --c: #10b26b; }

/* A soft highlight laid over the text, like a marker pen. */
.ring { background: color-mix(in srgb, var(--c) 17%, transparent); }

/* A guide along an edge, to show what should line up. */
.edge { border-left: 2px dashed var(--c); }

/* ---------- Hover ---------- */

.hint {
  position: absolute;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: #ffffff;
  font: 500 15px/1.3 var(--inter);
  white-space: nowrap;
  box-shadow: 0 8px 20px -10px rgba(23, 23, 26, 0.5);
  opacity: 0;
  pointer-events: none;
}

/* A small notch pointing down at the text. */
.hint::after {
  content: "";
  position: absolute;
  right: var(--notch, 40px);
  bottom: -5px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: inherit;
  rotate: 45deg;
}

.cursor {
  position: absolute;
  width: 26px;
  height: 26px;
  fill: #111114;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.3));
}

/* ---------- Below: the list ---------- */

.rules {
  position: absolute;
  top: 780px;
  left: 0;
  right: 0;
  bottom: 96px;
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: 56px;
}

.sheets { display: grid; }
.sheets > .css { grid-area: 1 / 1; justify-self: center; }

.css {
  margin: 0;
  color: #d4d4d4;
  font: 500 24px/1 var(--tip-font-mono);
}

.css[data-lang="zh"] { opacity: 0; }

.line {
  position: relative;
  display: block;
  cursor: pointer;
  padding: 10px 24px 10px 62px;
  border-radius: 14px;
}

.line .no {
  position: absolute;
  left: 24px;
  color: #6f6f6f;
  font-style: normal;
}

.line.is-done .no { color: #13a663; }

.css .sel { color: #e0a3ff; }
.css .prop { color: #9ecbff; }
.css .val { color: #fcd116; }

/* What a rule does, in a slot kept under it, so nothing moves when it
   appears. */
.how { display: block; }

.how-text {
  display: block;
  padding-top: 7px;
  color: #a9a9a9;
  font: 500 19px/1.35 var(--inter);
  white-space: normal;
  opacity: 0;
}

.css[data-lang="zh"] .how-text { font-family: var(--zh); }

.tip-credit { bottom: 34px; color: #8f8f8f; }
.tip-credit img { filter: invert(1); }
