/* How a 20-year Old Mobile Technology Protocol is Revolutionising Africa
   Concept: the feature phone. Pixel type, a backlit green LCD, and a USSD session you can run. */

html.theme-ussd {
  --fg: #19200f;
  --muted: #5d6651;
  --accent: #4f7d17;
  --rule: #e3e8da;
  --selection: #d9eab3;
  --lcd: #b6c98a;
  --lcd-ink: #1f2a10;
  --pixel: 'VT323', ui-monospace, monospace;
}

/* ---------------------------------------------------------------- hero */

.ussd-hero {
  display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}
@media (max-width: 52rem) { .ussd-hero { grid-template-columns: 1fr; justify-items: start; } }

.theme-ussd .hero-meta { font: 400 1.15rem/1 var(--pixel); letter-spacing: 0.04em; color: var(--accent); }
.theme-ussd .hero-title {
  font: 400 clamp(2.8rem, 1.4rem + 4.6vw, 5.2rem)/0.92 var(--pixel);
  letter-spacing: -0.01em; max-width: 14em;
}
.theme-ussd .hero-dek { font-style: normal; max-width: 30em; }

.phone {
  width: 15.5rem; padding: 1.5rem 1.1rem 1.2rem;
  background: linear-gradient(160deg, #3a3f44, #1c1f22 60%);
  border-radius: 2.4rem 2.4rem 3rem 3rem;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.15), 0 30px 50px -25px rgb(0 0 0 / 0.55);
  color: #e8ece4;
}
.phone-speaker { width: 3.5rem; height: 0.35rem; margin: 0 auto 1rem; border-radius: 99px; background: #0d0f10; }
.lcd {
  background: var(--lcd); color: var(--lcd-ink);
  border-radius: 6px; padding: 0.45rem 0.6rem 0.5rem;
  box-shadow: inset 0 0 0 3px #8fa462, inset 0 6px 14px rgb(0 0 0 / 0.18);
  font-family: var(--pixel);
}
.lcd-status { display: flex; justify-content: space-between; font-size: 0.85rem; line-height: 1; opacity: 0.75; }
.lcd-text {
  margin: 0.3rem 0 0; height: 8.4rem; overflow: hidden;
  font: 400 1.12rem/1.18 var(--pixel); white-space: pre-wrap;
}
.lcd-text b { font-weight: 400; background: var(--lcd-ink); color: var(--lcd); padding: 0 0.15em; }
.lcd-timer { height: 3px; background: color-mix(in srgb, var(--lcd-ink) 15%, transparent); }
.lcd-timer span { display: block; height: 100%; background: var(--lcd-ink); transform-origin: left; transform: scaleX(0); }
.lcd-timer.is-running span { animation: countdown var(--t, 20s) linear forwards; }
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin-top: 1rem; }
.key {
  font: 600 1.05rem/1 var(--font-ui); color: inherit;
  background: #2b3034; border: 0; border-radius: 0.8rem;
  padding: 0.55rem 0 0.4rem; cursor: pointer;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.08);
  display: grid; justify-items: center; gap: 0.1rem;
}
.key small { font-size: 0.55rem; font-weight: 500; letter-spacing: 0.08em; opacity: 0.6; text-transform: uppercase; }
.key:active { translate: 0 1px; box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.45); }
.key:focus-visible { outline-color: var(--lcd); }
.key-call, .key-end { font-size: 1rem; padding-block: 0.55rem; }
.key-call { background: #2f6b2a; grid-column: 1; }
.key-end { background: #8a2b24; grid-column: 3; }
.phone-hint { margin: 0.9rem 0 0; text-align: center; font: 400 1rem/1 var(--pixel); color: #aab4a0; }

/* ---------------------------------------------------------------- prose */

.theme-ussd .prose h2, .theme-ussd .prose h3 {
  font-family: var(--pixel); font-weight: 400; letter-spacing: 0;
}
.theme-ussd .prose h2 { font-size: clamp(2rem, 1.4rem + 2vw, 2.8rem); line-height: 1; }
.theme-ussd .prose h3 { font-size: 1.9rem; line-height: 1; }
.theme-ussd .prose h2::before, .theme-ussd .prose h3::before { content: '> '; color: var(--accent); }

/* Asides read like messages on the phone screen */
.theme-ussd .prose blockquote {
  border: 0; border-radius: 6px;
  background: var(--lcd); color: var(--lcd-ink);
  box-shadow: inset 0 0 0 3px #8fa462;
  padding: 0.8rem 1rem; font: 400 1.25rem/1.3 var(--pixel);
}
.theme-ussd .prose blockquote strong, .theme-ussd .prose blockquote em { font-weight: 400; font-style: normal; background: var(--lcd-ink); color: var(--lcd); padding: 0 0.15em; }
.theme-ussd .prose blockquote.statement {
  background: none; box-shadow: none; padding: 0; text-align: center;
  font-size: clamp(2.6rem, 1.5rem + 4vw, 4.6rem); line-height: 1; color: var(--accent);
  margin-block: 1.2em;
}

.theme-ussd .prose ul { list-style: none; padding-left: 0; }
.theme-ussd .prose ul li::before { content: '▸ '; color: var(--accent); }

.ussd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-block: 1.5em 2em !important; }
@media (max-width: 36rem) { .ussd-stats { grid-template-columns: 1fr; } }
.ussd-stats p {
  margin: 0; padding: 1rem 1.1rem 0.9rem; border-radius: 6px;
  background: var(--lcd); color: var(--lcd-ink); box-shadow: inset 0 0 0 3px #8fa462;
  font-family: var(--pixel);
}
.ussd-stats b { display: block; font-weight: 400; font-size: 3.4rem; line-height: 0.9; }
.ussd-stats span { font-size: 1.2rem; }

.theme-ussd .prose figcaption { font: 400 1.05rem/1.3 var(--pixel); }
