/* Pomodoro timer. Sizes follow the embed box (vw/vh of the frame): a tall narrow block stacks the
   parts, a wide one (most Notion embeds) puts the ring beside the buttons. */
.pomo {
  --tab: clamp(10px, min(3.4vw, 5vh), 17px);
  --btn: clamp(28px, min(11vw, 13vh), 58px);
  --snd: clamp(24px, min(7vw, 9vh), 34px);
  --tile-c: var(--tile, var(--tile-default));
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: min(3.4vh, 4vw);
  width: 100%;
  height: 100%;
}
.pomo p {
  margin: 0;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Session tabs */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2em;
  max-width: 100%;
  font-size: var(--tab);
}
.has-snd .tabs {
  max-width: calc(100% - 2 * var(--snd) - 8px);
}
.tab {
  padding: 0.38em 0.85em;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.55;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.tab:hover {
  opacity: 0.85;
}
.tab[aria-pressed='true'] {
  background: var(--tile-c);
  color: var(--num, inherit);
  opacity: 1;
}

/* Label and round dots */
.label {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}
.dots {
  display: flex;
  gap: 0.55em;
}
.dot {
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.18;
}
.dot.done {
  background: var(--accent);
  opacity: 1;
}
.dot.now {
  background: transparent;
  box-shadow: inset 0 0 0 0.14em var(--accent);
  opacity: 1;
}

/* Ring */
.ring {
  --d: min(54vh, 78vw);
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: var(--d);
  height: var(--d);
}
.no-tabs .ring {
  --d: min(64vh, 80vw);
}
.ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}
.track,
.arc {
  fill: none;
  stroke-width: 3.6;
}
.track {
  stroke: var(--tile-c);
}
.arc {
  stroke: var(--accent);
  stroke-dasharray: 100 200;
  stroke-linecap: round;
}
.ready.run .arc {
  transition: stroke-dashoffset 1s linear;
}
.ring .in {
  position: relative;
  display: grid;
  justify-items: center;
  gap: calc(var(--d) * 0.05);
  font-size: calc(var(--d) * 0.068);
}
.ring .time {
  font-size: calc(var(--d) * 0.25);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1;
}
.ring .label {
  margin-bottom: calc(var(--d) * -0.02);
  font-size: calc(var(--d) * 0.07);
}

/* Cards */
.cards {
  display: grid;
  justify-items: center;
  gap: min(3vh, 3vw);
  font-size: var(--tab);
}
.cards .row {
  display: flex;
  align-items: center;
  gap: min(1.6vw, 2.6vh);
  font-size: min(15vw, 31vh);
  font-weight: 700;
  line-height: 1;
}
.no-tabs .cards .row {
  font-size: min(16vw, 34vh);
}
.cards .tile {
  padding: 0.13em 0.16em 0.15em;
  border-radius: 0.16em;
  background: var(--tile-c);
  color: var(--num, inherit);
  letter-spacing: -0.03em;
}
.cards .colon {
  font-size: 0.6em;
  opacity: 0.45;
}
.f-serif .cards .row,
.f-serif .mini .time {
  font-weight: 500;
}

/* Minimal */
.mini {
  display: grid;
  justify-items: center;
  gap: min(1.6vh, 2vw);
}
.mini .meta {
  display: flex;
  align-items: center;
  gap: 0.9em;
  font-size: var(--tab);
}
.mini .time {
  font-size: min(25vw, 46vh);
  font-weight: 300;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.f-display .mini .time {
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Buttons */
.ctl {
  display: flex;
  align-items: center;
  gap: calc(var(--btn) * 0.26);
}
.ic {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--btn);
  height: var(--btn);
  padding: 0;
  border-radius: 50%;
  background: var(--tile-c);
  color: var(--num, inherit);
  transition: filter 0.15s ease;
}
.ic svg {
  width: 42%;
  height: 42%;
}
svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
svg.solid path:first-child {
  fill: currentColor;
}
.main {
  height: var(--btn);
  min-width: calc(var(--btn) * 2.75);
  padding: 0 1.1em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: clamp(12px, calc(var(--btn) * 0.34), 21px);
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: filter 0.15s ease;
}
.ic:hover,
.main:hover {
  filter: brightness(0.94);
}
.main:active,
.ic:active {
  filter: brightness(0.88);
}

/* Mute, top right */
.snd {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: var(--snd);
  height: var(--snd);
  padding: 0;
  border-radius: 50%;
  background: transparent;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}
.snd:hover,
.snd:focus-visible {
  opacity: 0.9;
}
.snd svg {
  width: 62%;
  height: 62%;
}

/* A session just ended: the time pulses a few times. */
@keyframes ding {
  50% {
    opacity: 0.3;
  }
}
.ding .time,
.ding .cards .row {
  animation: ding 0.9s ease-in-out 3;
}

/* Wide embeds (most Notion embeds): the ring beside the buttons. Very wide: the tabs go beside the ring
   too; a bit less wide: the tabs run across the top. */
@media (min-aspect-ratio: 3/2) {
  .s-ring .pomo {
    --tab: clamp(10px, min(5.6vh, 2.6vw), 18px);
    --btn: clamp(28px, min(17vh, 8vw), 64px);
    display: grid;
    grid-template-areas: 'tabs tabs' 'ring ctl';
    grid-template-columns: auto auto;
    align-content: center;
    justify-content: center;
    align-items: center;
    gap: min(4vh, 3vw) min(7vw, 10vh);
  }
  .s-ring .tabs {
    grid-area: tabs;
    justify-self: center;
  }
  .s-ring .ring {
    --d: min(66vh, 40vw);
    grid-area: ring;
  }
  .s-ring .ctl {
    grid-area: ctl;
  }
  .s-ring.no-tabs .pomo {
    grid-template-areas: 'ring ctl';
  }
  .s-ring.no-tabs .ring {
    --d: min(84vh, 44vw);
  }
}
/* Tabs beside the ring need about 460 px; narrower wide boxes keep the tabs on top. */
@media (min-aspect-ratio: 9/5) and (min-width: 461px) {
  .s-ring .pomo {
    --tab: clamp(10px, min(5.6vh, 2.2vw), 18px);
    --btn: clamp(28px, min(19vh, 8vw), 64px);
    grid-template-areas: 'ring tabs' 'ring ctl';
    align-items: initial;
    gap: min(7vh, 3vw) min(7vw, 10vh);
  }
  .s-ring .ring {
    --d: min(84vh, 40vw);
  }
  .s-ring .tabs {
    align-self: end;
    justify-self: center;
  }
  .s-ring .ctl {
    align-self: start;
    justify-self: center;
  }
  .s-ring.no-tabs .ctl {
    align-self: center;
  }
}
