/* Treatly — the system.
 *
 * One place for what the app is made of: colour, type, space, corners and
 * motion. Everything visible is built from these, so a screen can't drift.
 *
 *   Colour   black, three greys lifted off it, white for what you act on.
 *            Amber for streaks, green for "now", red for "late". Nothing else:
 *            colour belongs to what friends send, not to the app around it.
 *   Type     Figtree (the wordmark's own face) for names, numbers and titles;
 *            the phone's face for everything you read. Five sizes.
 *   Space    a 4px grid. Screens have a 16px gutter; lockers run edge to edge.
 *   Corners  6 (stickers), 10 (controls), 16 (sheets), round (people, actions).
 *   Motion   springs, on the compositor only (transform and opacity).
 *
 * Loaded after the older stylesheets, so it wins on equal specificity. */

:root {
  /* colour: greys are lifted off the theme's background, so a tinted theme stays tinted */
  --surface: color-mix(in srgb, var(--bg) 93%, #fff);
  --surface-2: color-mix(in srgb, var(--bg) 88%, #fff);
  --surface-3: color-mix(in srgb, var(--bg) 79%, #fff);
  --line: color-mix(in srgb, var(--bg) 85%, #fff);
  --ink: #f5f5f5;
  --ink-2: #a8a8a8;
  --ink-3: #737373;
  --ok: #3fd17a;
  --hot: var(--amber);
  --late: var(--danger);

  /* type */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Figtree', var(--font);
  --font-head: var(--font-display);
  --t-xs: 400 12px/1.3 var(--font);
  --t-sm: 400 13px/1.35 var(--font);
  --t-md: 400 15px/1.4 var(--font);
  --t-label: 600 14px/1.2 var(--font);
  --t-title: 700 17px/1.2 var(--font-display);
  --t-head: 800 28px/1.05 var(--font-display);

  /* space and corners */
  --gutter: 16px;
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-card: 16px;
  --bar-h: 52px;
  --bar-gap: 0px;

  /* motion: damped springs sampled into linear(); each has the time it takes to settle */
  --spring: linear(0, 0.039, 0.132, 0.252, 0.378, 0.5, 0.61, 0.705, 0.784, 0.848, 0.897, 0.935, 0.962, 0.982, 0.995, 1.003, 1.008, 1.01, 1.011, 1.011, 1.01, 1.008, 1.007, 1.006, 1.004, 1.003, 1.002, 1.002, 1);
  --spring-t: 0.39s;
  --bounce: linear(0, 0.075, 0.251, 0.467, 0.677, 0.854, 0.986, 1.071, 1.115, 1.126, 1.116, 1.093, 1.066, 1.04, 1.017, 1.001, 0.991, 0.985, 0.984, 0.985, 0.988, 0.992, 0.995, 0.998, 1, 1.001, 1.002, 1.002, 1);
  --bounce-t: 0.65s;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 0.14s;
}
/* before linear() easing (Safari < 17.2): the same feel from one bezier */
@supports not (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
    --bounce: cubic-bezier(0.25, 1.4, 0.4, 1);
  }
}

html,
body {
  font-family: var(--font);
}
body {
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#g-app {
  background: var(--bg);
}
h1,
h2,
h3 {
  font-family: var(--font-display);
}

/* ---------- material: flat surfaces, hairlines, no blur ---------- */
/* Blurring what's behind a panel is the most expensive thing a phone can be
   asked to paint, and every panel here used to do it. None do now. */
.glass {
  background: var(--surface);
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.glass::before,
.glass::after {
  content: none;
}

/* ---------- controls ---------- */
.g-btn,
.gd-cap,
.lk-act,
.g-tabbar button {
  transition: transform var(--fast) var(--ease), opacity var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
/* everything you can press gives a little under the finger */
.g-btn:active,
.lk-act:active,
.g-pill:active {
  transform: scale(0.94);
}
.g-btn--round,
.g-btn--round.glass {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
}
.g-btn--round:active {
  background: var(--surface-2);
}
.g-btn--solid,
.g-btn--round.g-btn--solid {
  background: #fff;
  color: #000;
  box-shadow: none;
}
.g-pill {
  border-radius: var(--r-xs);
  background: var(--surface-2);
  box-shadow: none;
  font-weight: 600;
}
.g-search,
.g-search.glass {
  height: 40px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.g-search input {
  font: var(--t-md);
}
.g-search input::placeholder {
  color: var(--ink-3);
}

/* ---------- screens ---------- */
.g-scroll {
  padding: calc(var(--safe-t) + 6px) var(--gutter) calc(var(--safe-b) + var(--bar-h) + 32px);
}
/* switching tabs: the new screen settles in from a hair below, on the compositor */
.g-screen {
  transform: translateY(6px);
  transition:
    opacity 0.16s var(--ease),
    transform 0.3s var(--spring),
    visibility 0s 0.16s;
}
.g-screen.is-active {
  transform: none;
  transition:
    opacity 0.16s var(--ease),
    transform 0.3s var(--spring);
}
.g-edge {
  display: none;
}

/* a screen's title bar */
.g-head {
  min-height: 44px;
  padding: 0 0 8px;
}
.g-head--row {
  align-items: center;
  gap: 4px;
}
.g-head h1 {
  font: var(--t-head);
  letter-spacing: -0.035em;
}
.g-head-actions {
  gap: 2px;
}
.g-kicker {
  margin-bottom: 2px;
  font: var(--t-sm);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
}
.g-section,
.g-mytasks {
  margin: 0;
  padding: 20px 0 8px;
  font: var(--t-label);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
#mytasks-h {
  display: none;
}

/* Today's bar: the wordmark, then what you reach for */
#s-today .g-head {
  padding-bottom: 6px;
}
.g-brand-head {
  gap: 8px;
}
.g-streak-chip {
  height: 40px;
  padding: 0 6px 0 0;
  gap: 2px;
  background: none;
  font: 700 15px/1 var(--font-display);
  color: var(--ink);
}
.g-streak-chip .gi {
  color: var(--hot);
}
.g-bell-dot {
  font: 700 10px/1 var(--font);
}

/* ---------- people ---------- */
.g-avatar:not(.has-photo) {
  background: var(--surface-3);
  box-shadow: none;
  font-family: var(--font-display);
  font-weight: 700;
}
/* friends along the top: a face, the streak you share, a name */
.gh-duos-host--home {
  margin: 2px calc(var(--gutter) * -1) 6px;
  padding: 0;
}
.gh-duos-host--home .gh-duos {
  padding-inline: var(--gutter);
  scroll-padding-inline: var(--gutter);
}
.gh-duo-name {
  font: var(--t-xs);
  color: var(--ink-2);
}
.g-story-ring::before {
  background: var(--line);
}

/* ---------- the bar ---------- */
/* Flat, edge to edge, a hairline on top. The middle is the one thing the app
   wants you to do, so it's the one solid shape on it. */
html #tabbar.g-tabbar {
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  max-width: none;
  height: calc(var(--bar-h) + var(--safe-b));
  margin: 0;
  padding: 0 8px var(--safe-b);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  transform: none !important;
}
#tabbar .g-lens {
  display: none;
}
#tabbar button {
  height: var(--bar-h);
  color: var(--ink);
}
#tabbar button .gi {
  width: 26px;
  height: 26px;
  opacity: 0.5;
  transition: opacity var(--fast) var(--ease), transform var(--spring-t) var(--bounce);
}
#tabbar button[aria-selected='true'] .gi {
  opacity: 1;
  transform: scale(1.06);
}
#tabbar button:active .gi {
  transform: scale(0.86);
}
#tabbar .g-tab-add {
  justify-self: center;
  align-self: center;
  width: 48px;
  height: 34px;
  border-radius: 12px;
  background: #fff;
  color: #000;
  box-shadow: none;
}
#tabbar .g-tab-add::before,
#tabbar .g-tab-add .g-add-aura,
#tabbar .g-tab-add .g-add-core {
  display: none;
}
#tabbar .g-tab-add .gi {
  color: #000;
  filter: none;
  width: 22px;
  height: 22px;
  opacity: 1;
}
#tabbar .g-tab-add:active {
  transform: scale(0.9);
}
.g-tab-me .g-avatar {
  width: 26px;
  height: 26px;
  font-size: 11px;
  transition: box-shadow var(--fast) var(--ease);
}
.g-tab-me[aria-selected='true'] .g-avatar {
  box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px var(--ink);
}

/* ---------- sheets ---------- */
.g-sheet,
.g-sheet.glass {
  left: 0;
  right: 0;
  bottom: 0;
  max-width: none;
  border: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--surface);
  padding-bottom: calc(18px + var(--safe-b));
}
.g-sheet--page,
.g-sheet.g-sheet--page {
  border-radius: 0;
  background: var(--bg);
}
.g-grabber {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}
.g-sheet-bg {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(0, 0, 0, 0.6);
}
.g-page-head {
  min-height: 44px;
}
.g-inbox-title,
.g-page-head h2 {
  font: var(--t-title);
  letter-spacing: -0.01em;
}

/* ---------- messages ---------- */
.g-toast,
.g-toast.glass {
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font: var(--t-label);
}

@media (prefers-reduced-motion: reduce) {
  .g-screen,
  .g-screen.is-active {
    transform: none;
    transition: opacity 0.12s linear, visibility 0s;
  }
  .g-tabbar button .gi,
  .g-btn {
    transition: none;
  }
}

/* ====================================================================
 * Surfaces. Everything that isn't a locker, brought to the same language:
 * a filled panel on black, no border, no blur, no colour that isn't a
 * person's photo or something a friend sent.
 * ==================================================================== */

/* panels */
html :is(.g-screen, .g-set, .g-overlay, .g-sheet-wrap) .glass,
html:is(.g-q-low, .g-q-medium) :is(.g-screen, .g-set) .glass {
  background: var(--surface);
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
html .g-btn--round.glass {
  background: transparent;
}
html .g-btn--round.glass:active {
  background: var(--surface-2);
}

/* ---------- a task, opened full ---------- */
html .g-overlay-bg {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html .gcard.is-open {
  border-radius: 20px !important;
  background: var(--surface);
  border: 0;
  box-shadow: none;
}
html .gcard.is-open::before,
html .gcard.is-open .gcard-aura,
html .gcard.is-open .gcard-rim,
html .gcard .gcard-cracks {
  display: none;
}
html .gcard.is-open .gcard-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
}
html .gcard.is-open .gcard-check {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--ink-3);
}
html .g-tools .glass,
html .g-tools .g-toolrow {
  border-radius: var(--r-md);
  background: var(--surface);
}

/* ---------- calendar ---------- */
html .g-week.glass {
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}
html .g-wd.is-sel {
  background: var(--ink);
  color: #000;
  border-radius: 12px;
}
html .g-wd.is-sel :is(b, span) {
  color: #000;
}
html .g-calwho {
  background: var(--surface);
}
html .g-calwho-b.is-on {
  background: var(--surface-3);
  color: var(--ink);
}
html .g-ev {
  border-radius: var(--r-sm);
  background: var(--surface-2);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 3px 0 0 var(--ink);
  transition: transform var(--fast) var(--ease);
}
html .g-ev:not([class*='is-mine']):has(.g-avatar) {
  box-shadow: inset 3px 0 0 var(--ink-3);
}
html .g-ev.is-done {
  box-shadow: inset 3px 0 0 var(--ink-3);
}

/* ---------- profile ---------- */
html .g-stats .g-stat.glass {
  background: transparent;
  border-radius: 0;
  padding-block: 6px;
}
html .g-stat .gi {
  display: none;
}
html .g-stat strong,
html .g-stat b {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
}
html .g-stat--flame :is(strong, b) {
  color: var(--hot);
}
html .g-profile h2 {
  font: 800 26px/1.1 var(--font-display);
  letter-spacing: -0.02em;
}
html .g-profile-face {
  box-shadow: none;
}
html .g-account-btn {
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 0;
  font: var(--t-label);
}
/* the year in squares: brighter is more, and it's only ever white */
html .g-heat i[data-n='1'] {
  background: rgba(255, 255, 255, 0.22);
}
html .g-heat i[data-n='2'] {
  background: rgba(255, 255, 255, 0.45);
}
html .g-heat i[data-n='3'] {
  background: rgba(255, 255, 255, 0.7);
}
html .g-heat i[data-n='4'] {
  background: #fff;
  box-shadow: none;
}
html .g-heat i {
  border-radius: 3px;
}

/* ---------- treats ---------- */
html .gtr-row {
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: none;
}
html .gtr-row:active {
  background: var(--surface-2);
}
html .gtr-tile {
  border-radius: var(--r-sm);
  background: var(--surface);
}
html .g-sec-h {
  font: var(--t-title);
  letter-spacing: -0.01em;
}

/* ---------- notes ---------- */
html .gn-row {
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--line);
}
html .gn-tip {
  color: var(--ink-3);
  font: var(--t-sm);
}

/* a kicker reads under its title, never over it */
html .g-head .g-kicker {
  order: 2;
  font: var(--t-sm);
  color: var(--ink-2);
}
html .g-head > div:first-child {
  display: flex;
  flex-direction: column;
}

/* ---------- leaderboard ---------- */
html :is(.gb-pod, .g-lb-pod, .gl-pod) {
  box-shadow: none;
}

/* ====================================================================
 * The cabinet. Treatly is a piece of office furniture: black steel, chrome
 * hardware, typed paper cards, label tape. These are its materials, and the
 * parts of the page that aren't drawers (the bar it stands on, headings,
 * buttons) made of the same things.
 * ==================================================================== */
:root {
  --font-type: 'Special Elite', 'Courier New', ui-monospace, monospace; /* anything typed on paper */
  --font-etch: 'Barlow Condensed', 'Arial Narrow', sans-serif; /* label tape */
  --paper: #f1eee6;
  --paper-ink: #151515;
  --stamp: #c2261a;
  --steel-0: #151517;
  --steel-1: #18181a;
  --steel-2: #2a2a2d;
  --steel-3: #29292c;
  --chrome: linear-gradient(180deg, #e6e6e6, #808080 45%, #cfcfcf 55%, #5c5c5c);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* headings are typed */
html .g-head h1,
html .g-profile h2,
html .g-cal-head h1 {
  font: 400 26px/1.15 var(--font-type);
  letter-spacing: 0;
  color: var(--paper);
}
html .g-head .g-kicker {
  font: 400 11px/1.3 var(--font-type);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* section names are label tape */
html .g-sec-h,
html .g-fd-heading,
html .g-heat-label,
html .gh-section-row > :first-child:not(button) {
  width: max-content;
  padding: 5px 10px 4px !important;
  background: #0b0b0b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 4px rgba(0, 0, 0, 0.6);
  color: #fff !important;
  font: 700 11px/1 var(--font-etch) !important;
  letter-spacing: 0.22em !important;
  text-transform: uppercase;
}
html .g-fd-heading {
  margin-top: 26px;
}

/* the plinth it stands on */
html #tabbar.g-tabbar {
  border-top: 0;
  background: linear-gradient(#111112, #050505);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 -1px 0 #000;
}
#tabbar .g-tab-add {
  border-radius: 4px;
  background: var(--paper);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25), 0 2px 3px rgba(0, 0, 0, 0.6);
}
#tabbar .g-tab-add:active {
  transform: translateY(2px);
}

/* things you press are paper keys */
html :is(#sc-today, #sc-friends) .g-fd-art.is-sugg .g-fd-btn.g-fd-card-go:not(.x),
html .g-account-btn,
html .gar-pin {
  border-radius: 3px !important;
  background: var(--paper) !important;
  color: #000 !important;
  font: 400 12px/1 var(--font-type) !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-top: 2px !important;
}
html :is(#sc-today, #sc-friends) .g-fd-art.is-sugg .g-fd-art-title {
  font: 400 15px/1.25 var(--font-type) !important;
}
html :is(#sc-today, #sc-friends) .g-fd-art.is-sugg .g-fd-art-line {
  font: 400 10px/1.3 var(--font-type) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* treats: a folder for each task, the count on its tab */
html .gtr-row {
  border-radius: 3px;
  background: var(--grain), linear-gradient(180deg, var(--steel-3), var(--steel-1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.8);
}
html .gtr-row b,
html .gtr-row strong {
  font-family: var(--font-type);
  font-weight: 400;
}

/* profile: counters */
html .g-stat :is(strong, b) {
  display: inline-block;
  min-width: 44px;
  padding: 7px 8px 3px;
  border-radius: 3px;
  background: linear-gradient(#0c0c0c 49%, #000 50%, #171717 51%);
  box-shadow: inset 0 0 0 1px #353535;
  color: var(--paper);
  font: 400 22px/1 var(--font-type);
}
html .g-stat--flame :is(strong, b) {
  color: var(--hot);
}
html .g-stat small {
  font: 400 10px/1.6 var(--font-type);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
