/* The loader of Rowan, an invented personal finance app: a near-black screen, a thin grid, one lime accent.
   The growth line becomes the mark, the mark goes into the header of the first screen. */
:root {
  --ground: #0b0c0e;        /* the background */
  --ink: #f2f1ec;           /* the name and the balance */
  --soft: rgba(242, 241, 236, 0.52); /* the small text */
  --faint: rgba(242, 241, 236, 0.09); /* the grid and the rules */
  --accent: #b9f26a;        /* the line, the tile, the gain */
  --elastic: cubic-bezier(0.34, 1.9, 0.45, 1);
  --screen: 100vh;
}
@supports (height: 100lvh) {
  :root { --screen: 100lvh; }
}

* { box-sizing: border-box; }
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--ground);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}

.stage {
  position: relative;
  height: var(--screen);
  max-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(185, 242, 106, 0.05), transparent 70%),
    var(--ground);
}

/* ---------------------------------------------------------------- the intro */
.intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: min(1.6vh, 12px);
  padding: 0 16px 40px;
  pointer-events: none;
}
.mark-wrap {
  width: min(84vw, 520px, 92vh);
  transform-origin: 0 0;
  will-change: transform;
}
.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
#area stop { stop-color: var(--accent); }
.grid line {
  stroke: var(--faint);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.grid .grid__base { stroke: rgba(242, 241, 236, 0.18); }
.ticks text {
  fill: var(--soft);
  font: 500 8px 'Mona Sans Variable', sans-serif;
  letter-spacing: 0.02em;
}
.area { fill: url(#area); }
.line,
.head {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line { stroke-width: 2.2; }
.head { stroke-width: 6; stroke: var(--ground); }
.tile {
  fill: var(--accent);
  filter: drop-shadow(0 6px 14px rgba(185, 242, 106, 0.16));
}
.tile-sheen { pointer-events: none; }
.dots circle {
  fill: var(--ground);
  stroke: var(--accent);
  stroke-width: 1.4;
}
.tip { fill: var(--accent); }
.tip-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
}
.tip-label rect {
  fill: #1a1d17;
  stroke: rgba(185, 242, 106, 0.28);
  stroke-width: 0.8;
}
.tip-label text {
  fill: var(--ink);
  font: 600 8.5px 'Mona Sans Variable', sans-serif;
  font-variant-numeric: tabular-nums;
}
.sweep { pointer-events: none; }
.gain text {
  fill: var(--accent);
  font: 600 11px 'Mona Sans Variable', sans-serif;
  font-stretch: 110%;
}

.name {
  margin: 0;
  font-size: clamp(30px, min(9vw, 9vh), 64px);
  font-weight: 620;
  font-stretch: 112%;
  letter-spacing: -0.035em;
  line-height: 1;
}
.name span { display: inline-block; }
.tagline {
  margin: 0;
  color: var(--soft);
  font-size: clamp(12px, min(3.4vw, 2.6vh), 15px);
  font-stretch: 104%;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------- the app */
.app {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min(92vw, 380px);
  display: flex;
  flex-direction: column;
  gap: min(1.2vh, 10px);
  visibility: hidden;
}
.app__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: min(2vh, 16px);
}
.app__slot {
  width: 30px;
  height: 30px;
  flex: none;
}
.app__brand {
  font-size: 15px;
  font-weight: 640;
  font-stretch: 110%;
  letter-spacing: -0.01em;
}
.app__avatar {
  margin-left: auto;
  will-change: transform;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1b1d21;
  box-shadow: inset 0 0 0 1px rgba(242, 241, 236, 0.1);
  color: var(--soft);
  font-size: 10.5px;
  font-weight: 600;
}
.app__label {
  margin: 0;
  color: var(--soft);
  font-size: 12.5px;
}
.app__balance {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: clamp(30px, min(10vw, 8vh), 46px);
  font-weight: 560;
  font-stretch: 106%;
  letter-spacing: -0.035em;
  line-height: 1;
}
.app__change {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--soft);
  font-size: 12.5px;
}
.app__change b { display: inline-block; color: var(--accent); font-weight: 600; }
.app__change svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app__spark {
  position: relative;
  width: 100%;
  height: min(11vh, 82px);
  margin: min(1vh, 8px) 0;
}
.app__spark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
/* the end of the small line: a dot with a thin halo, where today's balance sits */
.app__spark-dot {
  position: absolute;
  left: calc(318 / 320 * 100%);
  top: calc(8 / 90 * 100%);
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(185, 242, 106, 0.14), 0 0 0 1.5px var(--ground);
}
.app__spark-area { fill: url(#area); }
.app__spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.app__list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: min(1.2vh, 10px) 0;
  border-top: 1px solid var(--faint);
  font-size: 13px;
}
.app__list li span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.app__list em {
  color: var(--soft);
  font-size: 11.5px;
  font-style: normal;
}
.app__list b {
  margin-left: auto;
  font-weight: 560;
  white-space: nowrap;
}
.app__list b.in { color: var(--accent); }
.app__ico {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #17191c;
  box-shadow: inset 0 0 0 1px rgba(242, 241, 236, 0.08);
  color: var(--soft);
  font-size: 12px;
  font-weight: 600;
}
.app__ico--in { color: var(--accent); }

/* ---------------------------------------------------------------- the elastic pill */
.pillola {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ground);
  font: 600 13px/1 'Mona Sans Variable', 'Helvetica Neue', Arial, sans-serif;
  cursor: pointer;
  isolation: isolate;
  visibility: hidden;
  -webkit-tap-highlight-color: transparent;
}
.pillola::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ink);
  transition: inset 0.6s var(--elastic);
}
.pillola__scritta {
  font-stretch: 86%;
  transition: font-stretch 0.6s var(--elastic);
}
.pillola__scritta::before {
  content: attr(data-testo);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 100%;
}
@media (hover: hover) and (pointer: fine) {
  .pillola:hover::before { inset: -2px -7px; }
  .pillola:hover .pillola__scritta { font-stretch: 100%; }
}
.pillola:active::before { inset: 2px 3px; }
.pillola:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

@media (max-height: 520px) {
  .app { gap: 6px; }
  .app__head { margin-bottom: 6px; }
  .app__list li { padding: 6px 0; }
  .pillola { bottom: 10px; min-height: 32px; }
}
