/* ==========================================================================
   Base reset, typography, buttons, icons
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 1.125em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  height: 100%;
}

/* Live scrolls the page itself: the week grid has a 54vh minimum but grows
   with the tallest day column, so tall columns push the layout past the
   viewport and you scroll the window (sticky header/footer) to reach every
   task. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* Let the document (html) be the scroll container so the sticky
     header/footer stick to the viewport, like live. */
  overflow: visible;
  background: var(--app-bg);
  color: var(--app-color);
  font-family: var(--ff-sans);
  font-size: 1rem;
  line-height: 1.5;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* live's text-input reset — transparent, borderless, no outline; specific
   classes (e.g. .text-input, .edit-title__input) add their own chrome.
   Wrapped in :where() so it carries no specificity, like live's own cascade. */
:where(
  input[type="email"],
  input[type="number"],
  input[type="password"],
  input[type="text"],
  input[type="search"],
  textarea
) {
  appearance: none;
  background-color: transparent;
  border: 0;
  color: inherit;
  display: block;
  font-family: inherit;
  font-size: inherit;
  outline: none;
  padding: 0;
  width: 100%;
}

/* live .ui-button:focus-visible */
.ui-button:focus-visible {
  outline: 2px solid var(--focus-outline);
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

/* live: .link, a { color: inherit; text-decoration: none; transition: color .25s } */
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}
a:focus,
a:hover {
  color: var(--accent-highlight); /* live --custom-color-highlight */
}
a:not([class]) {
  text-decoration-skip-ink: auto;
}
a.btn {
  text-decoration: none !important;
}

.hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Icons ----
   Live's sprite draws with stroke-width 2 / round joins; fill-based glyphs
   carry their own `fill="currentColor"` on the path. */
.ui-icon {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke-width: 2;
}

/* ---- Buttons ---- */
.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2778rem;
  min-height: 1.3333rem;
  min-width: 1.3333rem;
  height: auto;
  padding: 0.5em 1em;
  border-radius: var(--radius-s);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-family: var(--ff-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: normal;
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.ui-button:hover {
  background: var(--btn-hover-bg);
}

.ui-button--icon {
  width: 1.3333rem;
  height: 1.3333rem;
  min-width: 1.3333rem;
  padding: 0;
  background: transparent;
  color: var(--transport-color);
  text-transform: none;
  font-weight: 400;
}

.ui-button--icon .ui-icon {
  width: 0.8889rem;
  height: 0.8889rem;
}

.ui-button--icon:hover {
  background: var(--btn-hover-bg);
  color: var(--transport-hover-color);
}

.ui-button--transparent {
  /* live sets the tokens, so it works whatever the rule order */
  --btn-bg: transparent;
  --btn-hover-bg: transparent;
}

.ui-button--is-active,
.ui-button.is-active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
}

.ui-button--cta {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-radius: var(--radius-s);
  padding: 0 0.8333rem;
  letter-spacing: 0.02em; /* live .ui-button--cta */
}

.ui-button--cta:hover {
  background: var(--btn-active-bg);
  opacity: 0.85;
}

.ui-button--dark {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
}

/* live .ui-button--app-footer — a transparent footer icon button */
.ui-button--app-footer {
  --btn-bg: transparent;
  --btn-active-bg: var(--btn-hover-bg);
  --btn-active-color: var(--transport-hover-color);
}
.ui-button--app-footer:hover,
.ui-button--app-footer:focus-visible {
  background: var(--btn-hover-bg);
  color: var(--transport-hover-color);
}

/* live .ui-button--bright — the filled "attention" icon button */
.ui-button--bright {
  background: #edeef0; /* live --ui-button-bg (light) */
  color: var(--transport-hover-color);
}
html[theme="dark"] .ui-button--bright {
  background: #2c2c2c;
}
.ui-button--bright:hover {
  background: var(--btn-hover-bg);
}

.ui-button--primary {
  background: var(--accent);
  color: #fff;
}
.ui-button--primary:hover {
  background: var(--accent);
  opacity: 0.9;
}

.ui-button--danger {
  background: #ffdddf;
  color: #000;
}

/* ---- Segmented control ---- */
.ui-segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 0.1111rem;
}

.ui-segmented-control--spaced {
  gap: 0.3333rem;
}

.ui-segmented-control__button {
  min-width: 1.3333rem;
  height: 1.3333rem;
  border-radius: var(--radius-s);
  /* live .ui-segmented-control__button — the chip background, and the icon
     colour (live's --ui-button-color: #707070, #868686 inside dark chips) */
  background: var(--btn-bg);
  color: var(--transport-color);
  font-family: var(--ff-sans);
  font-size: 0.6667rem;
  font-weight: 700;
  padding: 0 0.4444rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ui-segmented-control__button:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-color);
}

.ui-segmented-control__button--active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
}

/* live .ui-segmented-control--dim / --large */
.ui-segmented-control--dim {
  --btn-active-bg: var(--btn-bg);
  --btn-active-color: var(--transport-hover-color);
}
.ui-segmented-control--dim .ui-segmented-control__button:not(.ui-segmented-control__button--active) {
  background-color: transparent;
}
.ui-segmented-control--dim .ui-segmented-control__button:not(.ui-segmented-control__button--active):hover {
  background-color: var(--btn-hover-bg);
  color: var(--transport-hover-color);
}
.ui-segmented-control--large .ui-segmented-control__button {
  font-size: 0.7778rem;
}

/* live .ui-button--icon wins over the chip padding — otherwise a 24px icon
   button would squeeze its 16px glyph (the segmented rule comes later here). */
.ui-segmented-control__button.ui-button--icon {
  padding: 0;
}

/* live .ui-segmented-control--app-header — the header nav: plain icons, a 10px
   gap and no separators (unlike the chip-style segmented controls). */
.ui-segmented-control--app-header {
  gap: 0.5556rem;
}
.ui-segmented-control--app-header .ui-segmented-control__button::before {
  content: none;
}

/* ---- Tooltip (live's .tooltip / .tooltip__title) ---- */
.tooltip-wrap {
  display: inline-flex;
}
.tooltip {
  position: absolute;
  left: 50%;
  top: 100%;
  translate: -50% 0;
  z-index: 950;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease-in-out,
    translate 0.25s ease-in-out;
}
.tooltip--bottom,
.tooltip--bottom-left,
.tooltip--bottom-right {
  padding-top: 0.5556rem;
}
.tooltip--top,
.tooltip--top-left,
.tooltip--top-right {
  top: auto;
  bottom: 100%;
  padding-bottom: 0.5556rem;
}
.tooltip--bottom-right,
.tooltip--top-right {
  left: auto;
  right: 0;
  translate: 0 0;
}
.tooltip--bottom-left,
.tooltip--top-left {
  left: 0;
  translate: 0 0;
}
.tooltip__title {
  display: block;
  background-color: #edeef0;
  border-radius: 5px;
  color: #707070;
  font-family: var(--ff-sans);
  font-size: 0.5556rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.1667rem 0.2778rem;
  text-transform: uppercase;
  white-space: nowrap;
}
.tooltip-wrap:hover > .tooltip,
.tooltip-wrap:focus-within > .tooltip {
  opacity: 1;
  transition-delay: 0.5s; /* live's tooltip delay */
}
html[theme="dark"] .tooltip__title {
  background-color: #2c2c2c;
  color: #d1d1d1;
}
.tooltip--disabled {
  display: none;
}

/* ---- Text helpers ---- */
.muted {
  color: var(--text-muted);
}
.nowrap {
  white-space: nowrap;
}
