/* The opening hours card with the time of now sliding by: a white card on a white page, with a small real photo of
   the bakery on top, the status line, today's bar from 6:00 to 21:00 with the "Now" hand, and the week in rows.
   Every height also follows the height of the window, so the card fits the phone box of 341 by 410. */
:root {
  --page: #ffffff;            /* the page */
  --card: #ffffff;            /* the card */
  --ink: #1b1917;             /* the words */
  --ink-2: #6f6a64;           /* the quieter words */
  --ink-3: #aaa49d;           /* the quietest words and the hour marks */
  --edge: rgba(27, 25, 23, 0.1); /* the 1px edge */
  --line: rgba(27, 25, 23, 0.07); /* thin rules */
  --track: #f3f1ee;           /* the empty bar */
  --pill: #f5f3f0;            /* the soft pill under the chosen day */
  --accent: #d2652a;          /* the one accent: open hours, the elapsed part, "Open now" */
  --accent-soft: #fbe6d8;     /* the open hours still to come */
  --night: #232a3a;           /* the colour the photo takes when the shop closes */
  --focus: #d2652a;

  --row: clamp(19px, 5vh, 30px);   /* the height of a day in the week */
  --gap: clamp(8px, 2.4vh, 16px);  /* the space between the parts of the card */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 24px) 16px;
}

/* the card: a 1px edge that catches the light on top, and three layers of shadow */
.card {
  position: relative;
  width: min(372px, calc(100vw - 32px));
  padding: clamp(6px, 1.4vh, 8px) clamp(6px, 1.4vh, 8px) clamp(6px, 1.6vh, 12px);
  background: var(--card);
  border-radius: 22px;
  box-shadow:
    0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(27, 25, 23, 0.05),
    0 8px 18px -10px rgba(27, 25, 23, 0.16),
    0 32px 56px -30px rgba(60, 38, 20, 0.32);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

/* the photo: a real one, with its own thin edge and a slow drift */
.photo {
  position: relative;
  height: clamp(52px, 14vh, 128px);
  border-radius: 15px;
  overflow: hidden;
  background: #e9e2d8;
  isolation: isolate;
}
.photo__move {
  position: absolute;
  inset: 0;
  filter: saturate(1.12) brightness(1.1) contrast(1.04);
}
.photo__move img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 58%;
  display: block;
}
/* the dusk over the photo: the shop's lights going down after closing */
.photo__dusk {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(35, 42, 58, 0.15), var(--night));
  mix-blend-mode: multiply;
  opacity: 0;
  pointer-events: none;
}
.photo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), inset 0 -24px 30px -24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.photo__chip {
  position: absolute;
  left: 8px;
  bottom: 7px;
  z-index: 1;
  padding: 3px 8px 3px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: 0.01em;
  color: #fff;
  background: rgba(20, 16, 12, 0.28);
  -webkit-backdrop-filter: blur(8px) saturate(1.3);
  backdrop-filter: blur(8px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

/* the name and the status */
.head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--gap) 6px 0;
}
.head__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(28px, 8vh, 34px);
  height: clamp(28px, 8vh, 34px);
  border-radius: 10px;
  background: #f6f2ed;
  box-shadow: inset 0 0 0 1px rgba(27, 25, 23, 0.06), inset 0 1px 0 #fff;
}
.head__mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.head__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.head__name {
  font-size: 14.5px;
  font-weight: 640;
  font-stretch: 106%;
  letter-spacing: -0.005em;
}

.status {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
}
.status__icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: -2px;
}
.status__icon svg {
  width: 16px;
  height: 16px;
  overflow: visible;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico { transform-box: fill-box; transform-origin: 50% 50%; }
.ico--set, .ico--moon { opacity: 0; }
.ico--moon { stroke: var(--ink-2); }
.ico__rays { transform-box: view-box; transform-origin: 10px 10px; }
/* one line high: the old sentence leaves upwards while the new one comes in from below */
.status__win {
  position: relative;
  display: block;
  height: 17px;
  line-height: 17px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}
.status__line {
  display: block;
  white-space: nowrap;
}
.status__line b {
  font-weight: 620;
  color: var(--accent);
}
.status__line.is-closed b {
  color: var(--ink);
}

/* today's bar */
.today {
  padding: var(--gap) 6px 0;
}
.today__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  line-height: 15px;
}
.today__win {
  position: relative;
  display: block;
  height: 15px;
  overflow: hidden;
}
.today__day {
  display: block;
  font-weight: 620;
  font-stretch: 104%;
  color: var(--ink);
  white-space: nowrap;
}
.today__hours {
  display: block;
  color: var(--ink-2);
  white-space: nowrap;
  text-align: right;
}

.bar {
  position: relative;
  margin-top: 4px;
  padding-top: 19px;
}
.bar__track {
  position: relative;
  height: clamp(10px, 2.8vh, 14px);
  border-radius: 999px;
  background: var(--track);
  box-shadow: inset 0 1px 1.5px rgba(27, 25, 23, 0.08), inset 0 0 0 1px rgba(27, 25, 23, 0.03);
  overflow: hidden;
}
.bar__open {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
  overflow: hidden;
}
.bar__done {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent));
}
/* a thin highlight along the top of the open hours, like a glaze */
.bar__sheen {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 1px;
  height: 35%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.bar__shut {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 560;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  opacity: 0;
}

/* the "Now" hand: a 1px line with its small tag; GSAP moves .needle, the CSS draws its children */
.needle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: -4px;
  width: 0;
  pointer-events: none;
}
.needle__line {
  position: absolute;
  left: -0.5px;
  top: 15px;
  bottom: 0;
  width: 1px;
  background: var(--ink);
  border-radius: 1px;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}
.needle__tag {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(var(--tag-x, -50%));
  padding: 1px 6px 1px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 1px 1px rgba(27, 25, 23, 0.2), 0 4px 10px -4px rgba(27, 25, 23, 0.45);
}
.needle__tag::after {
  content: '';
  position: absolute;
  left: calc(var(--tag-x-abs, 50%) - 3px);
  bottom: -3px;
  width: 6px;
  height: 6px;
  background: var(--ink);
  border-radius: 1px;
  transform: rotate(45deg);
  z-index: -1;
}
.needle__word {
  font-weight: 500;
  opacity: 0.62;
}

.ticks {
  position: relative;
  height: 15px;
  margin-top: 4px;
}
.tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 3px;
  margin-left: -0.5px;
  background: var(--ink-3);
  opacity: 0.55;
}
.tick--big { height: 5px; opacity: 0.9; }
.tick.is-past { background: var(--accent); opacity: 1; }
.tick__label {
  position: absolute;
  top: 6px;
  left: 0;
  transform: translateX(-50%);
  font-size: 9.5px;
  line-height: 9px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* the week */
.week {
  position: relative;
  margin-top: calc(var(--gap) * 0.6);
}
.week__pill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--row);
  border-radius: 9px;
  background: var(--pill);
  box-shadow: inset 0 0 0 1px rgba(27, 25, 23, 0.045), 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
}
.week__list {
  position: relative;
  list-style: none;
}
.day {
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--row);
  padding: 0 8px 0 6px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  text-align: left;
  cursor: default;
  border-radius: 9px;
  outline: none;
}
.day:focus-visible {
  box-shadow: inset 0 0 0 1.5px var(--focus);
}
.day__name {
  display: inline-block;
  min-width: 2.6em;
  font-weight: 500;
  color: var(--ink);
}
.day__today {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 9.5px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}
.day__hours {
  margin-left: auto;
  white-space: nowrap;
}
.day.is-today .day__name { font-weight: 660; }
.day.is-today .day__hours { color: var(--ink); font-weight: 560; }
.day.is-shut .day__hours { color: var(--ink-3); }
.day.is-shown .day__hours { color: var(--ink); }

@media (hover: hover) {
  .day { cursor: pointer; transition: color 0.2s; }
  .day:hover .day__hours { color: var(--ink); }
}
.day:active .day__name { transform: translateY(0.5px); }
