
:root {
  
  --dh-rhythm: round(nearest, calc(100vh / 60), 1px);   
  --dh-rhythm-k: 1;                                      
  --dh-z: 1;  --dh-zs: 1;  --dh-zh: 1;                   
  --dh-zc: 1;                                            
  --dh-dense: 0;                                         

  
  --dh-rhythm-half:   round(nearest, calc(var(--dh-rhythm) * var(--dh-rhythm-k) * 0.5), 1px);
  --dh-rhythm-tight:  round(nearest, calc(var(--dh-rhythm) * var(--dh-rhythm-k)), 1px);
  --dh-rhythm-normal: round(nearest, calc(var(--dh-rhythm) * var(--dh-rhythm-k) * 1.75), 1px);
  --dh-rhythm-loose:  round(nearest, calc(var(--dh-rhythm) * var(--dh-rhythm-k) * 3), 1px);

  
  --dh-edge:       var(--dh-rhythm-normal);   
  --dh-title-top:  var(--dh-rhythm-loose);    
  --dh-title-gap:  var(--dh-rhythm-loose);    
  --dh-section:    var(--dh-rhythm-loose);
  --dh-group:      var(--dh-rhythm-normal);
  --dh-card-pad:   var(--dh-rhythm-normal);   
  --dh-row-pad:    var(--dh-rhythm-half);     
  --dh-inline:     var(--dh-rhythm-half);     
  --dh-hud-top:    var(--dh-rhythm-half);     
  --dh-tap:        44px;                      

  
  --dh-safe-top: env(safe-area-inset-top, 0px);
  --dh-safe-right: env(safe-area-inset-right, 0px);
  --dh-safe-bottom: env(safe-area-inset-bottom, 0px);
  --dh-safe-left: env(safe-area-inset-left, 0px);
  --dh-inset-top:    calc(var(--dh-safe-top) + var(--dh-title-top));
  --dh-inset-right:  calc(var(--dh-safe-right) + var(--dh-edge));
  --dh-inset-bottom: calc(var(--dh-safe-bottom) + var(--dh-edge));
  --dh-inset-left:   calc(var(--dh-safe-left) + var(--dh-edge));

  
  --dh-f-display: 'Dope Digits', 'Dope Display', 'Dope Regular', monospace;
  --dh-f-label:   'Dope Regular', monospace;
  --dh-f-cond:    'Dope Condensed', 'Dope Regular', monospace;
  --dh-f-oe:      'Dope Old English', 'Dope Regular', serif;
  --dh-f-text:    'Chicago', 'Dope Regular', monospace;
  
  --dh-m-display-cap: .8;  --dh-m-display-x: .6;   --dh-m-display-top: -.18; --dh-m-display-bot: .38;
  --dh-m-label-cap:   .7;  --dh-m-label-x:   .5;   --dh-m-label-top:   .05;  --dh-m-label-bot:   .25;
  --dh-m-text-cap:    .75; --dh-m-text-x:    .583; --dh-m-text-top:    .14;  --dh-m-text-bot:    .11;
  --dh-m-oe-cap:      .7;  --dh-m-oe-x:      .45;  --dh-m-oe-top:      .10;  --dh-m-oe-bot:      .20;

  
  --dh-fs-title:   calc(20px * var(--dh-z));
  --dh-fs-heading: calc(10px * (var(--dh-z) + 1));
  --dh-fs-kicker:  calc(10px * var(--dh-z));
  --dh-fs-label:   calc(10px * var(--dh-z));
  --dh-fs-label-s: calc(10px * var(--dh-zs));
  --dh-fs-lead:    calc(12px * (var(--dh-z) + 1));
  --dh-fs-reading: calc(12px * max(2, var(--dh-z)));
  --dh-fs-body:    calc(12px * var(--dh-z));
  --dh-fs-caption: calc(12px * var(--dh-zs));
  
  --dh-ls-tight: -.2em;
  --dh-ls-tight-mono: -1px;
  
  --dh-fs-hud-name:  calc(10px * var(--dh-zh));
  --dh-fs-hud-timer: calc(20px * var(--dh-zh));
  --dh-fs-hud-line:  10px;
  --dh-fs-hud-call:  calc(10px * (var(--dh-zh) + 1));

  
  --px: min(20px, calc(10px * var(--dh-z)));   
  --cu: calc(var(--px) * 1.2);
  --speech-px: var(--dh-fs-body);
  --chi: var(--dh-f-text);
}
html[data-device='phone'] { --dh-rhythm: 8px; }
@media (min-width: 1000px) and (min-height: 520px)  { :root { --dh-z: 2; --dh-zs: 1; --dh-zh: 2; --dh-zc: 2; --dh-fs-hud-line: 20px; } }
@media (min-width: 1600px) and (min-height: 900px)  { :root { --dh-z: 3; --dh-zs: 2; --dh-zh: 3; --dh-fs-hud-line: 20px; } }
@media (min-width: 2400px) and (min-height: 1300px) { :root { --dh-z: 4; --dh-zs: 2; --dh-zh: 4; --dh-fs-hud-line: 30px; } }
@media (min-width: 3600px) and (min-height: 2000px) { :root { --dh-z: 6; --dh-zs: 3; --dh-zh: 6; --dh-fs-hud-line: 40px; } }
html[data-device='phone'] { --dh-z: 1; --dh-zs: 1; --dh-zh: 1; --dh-zc: 1; --dh-fs-hud-line: 10px; }
@media (orientation: landscape) { html[data-device='phone'] { --dh-zh: 2; --dh-fs-hud-line: 20px; } }   

@media (max-height: 520px) {
  :root { --dh-dense: 1; --dh-edge: var(--dh-rhythm-tight); --dh-title-top: var(--dh-rhythm-normal); --dh-title-gap: var(--dh-rhythm-tight);
          --dh-section: var(--dh-rhythm-normal); --dh-group: var(--dh-rhythm-tight); --dh-card-pad: var(--dh-rhythm-tight); }
}

[class*='dh-ty-'] {
  --lh: calc(var(--fs) + 2 * round(nearest, calc((var(--fs) * var(--cap) + var(--dh-rhythm-tight) - var(--fs)) / 2), 1px));
  font-size: var(--fs); line-height: var(--lh); font-weight: 400; font-style: normal; letter-spacing: 0;
  -webkit-font-smoothing: none; text-rendering: optimizeSpeed;
  
  --trim-top: round(nearest, calc((var(--lh) - var(--fs)) / 2 + var(--fs) * var(--top)), 1px);
  --trim-bot: round(nearest, calc((var(--lh) - var(--fs)) / 2 + var(--fs) * var(--bot)), 1px);
  margin-block: calc(-1 * var(--trim-top)) calc(-1 * var(--trim-bot));
  
  --cap-px: round(nearest, calc(var(--fs) * var(--cap)), 1px);
  --x-px: round(nearest, calc(var(--fs) * var(--x)), 1px);
}

@supports (text-box: trim-both cap alphabetic) { [class*='dh-ty-'] { text-box: trim-both cap alphabetic; margin-block: 0; --trim-top: 0px; --trim-bot: 0px; } }   

.dh-ty-title, .dh-ty-heading, .dh-ty-kicker { font-family: var(--dh-f-display); text-transform: uppercase;
  --cap: var(--dh-m-display-cap); --x: var(--dh-m-display-x); --top: var(--dh-m-display-top); --bot: var(--dh-m-display-bot); }
.dh-ty-label, .dh-ty-label-s, .dh-ty-num { font-family: var(--dh-f-label); text-transform: uppercase;
  --cap: var(--dh-m-label-cap); --x: var(--dh-m-label-x); --top: var(--dh-m-label-top); --bot: var(--dh-m-label-bot); }
.dh-ty-lead, .dh-ty-reading, .dh-ty-body, .dh-ty-caption { font-family: var(--dh-f-text);
  --cap: var(--dh-m-text-cap); --x: var(--dh-m-text-x); --top: var(--dh-m-text-top); --bot: var(--dh-m-text-bot); }

.dh-ty-title   { --fs: var(--dh-fs-title); }
.dh-ty-heading { --fs: var(--dh-fs-heading); }
.dh-ty-kicker  { --fs: var(--dh-fs-kicker); }
.dh-ty-label   { --fs: var(--dh-fs-label); letter-spacing: .1em; margin-inline-end: -.1em; }
.dh-ty-label-s { --fs: var(--dh-fs-label-s); }
.dh-ty-num     { --fs: var(--dh-fs-label); text-align: right; white-space: nowrap; }   
.dh-ty-lead    { --fs: var(--dh-fs-lead); }
.dh-ty-reading { --fs: var(--dh-fs-reading); }
.dh-ty-body    { --fs: var(--dh-fs-body); }
.dh-ty-caption { --fs: var(--dh-fs-caption); }

html[data-type-grid] [class*='dh-ty-'] { outline: 1px solid rgba(255, 0, 255, 0.7); outline-offset: 0; }

:root { --dh-scrim: rgba(7, 19, 13, 0.92); --gc-scrim: var(--dh-scrim); }
html.mode-light, html[data-mode='light'] { --dh-scrim: rgba(242, 239, 230, 0.95); }
.dh-mask { position: absolute; inset: 0; background: var(--dh-scrim); }
