/* ---------- The Mac card: a Mac window drawn in em, so it scales with the card ---------- */
/* Full width under the looks and Duo cards. The window is the Mac app in light mode: the sidebar, the calculator and
   its history inspector; keys pressed on the keyboard show as keycaps under it (js/mac.js types a sum on a loop). */
.touches-grid .touch-mac { grid-column: 1 / -1; }
.mac-stage { width: 100%; max-width: 1040px; container-type: inline-size; display: flex; flex-direction: column; align-items: center; gap: 1.1em; }
.mac {
  --m-side: #ECEBEF; --m-line: #E2E1E6; --m-sub: #8A8A90; --m-key: #E5E5EA; --m-fn: #C7C7CC; --m-op: #FF9F0A;
  font-size: clamp(5.5px, 1.32cqi, 13.5px);
  display: grid; grid-template-columns: 15em minmax(0, 1fr) 15em; width: 100%; height: 42em;
  border-radius: 1.1em; overflow: hidden; background: #fff; color: #111; font-family: var(--font-ui);
  border: 1px solid rgba(0, 0, 0, .14);
  box-shadow: 0 .2em .5em rgba(40, 30, 15, .08), 0 1.6em 3.6em rgba(40, 30, 15, .16);
}
.mac svg { width: 1.25em; height: 1.25em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Sidebar */
.mac-side { display: flex; flex-direction: column; gap: .15em; padding: 1em .7em; background: var(--m-side); border-right: 1px solid var(--m-line); }
.mac-lights { display: flex; gap: .55em; padding: .2em .4em 1.1em; }
.mac-lights i { width: .95em; height: .95em; border-radius: 50%; background: #FF5F57; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.mac-lights i:nth-child(2) { background: #FEBC2E; } .mac-lights i:nth-child(3) { background: #28C840; }
.mac-search { display: flex; align-items: center; gap: .45em; height: 2.3em; padding: 0 .7em; margin-bottom: .8em; border-radius: .7em; background: rgba(0, 0, 0, .06); color: var(--m-sub); font-size: 1em; }
.mac-search svg { width: 1em; height: 1em; }
.mac-row { display: flex; align-items: center; gap: .6em; height: 2.3em; padding: 0 .7em; border-radius: .6em; font-size: 1.05em; white-space: nowrap; overflow: hidden; }
.mac-row svg { color: #D96C00; }
.mac-row.on { background: #FFE3C2; font-weight: 600; }
.mac-sec { padding: 1em .7em .3em; color: var(--m-sub); font-size: .85em; font-weight: 600; }

/* The calculator */
.mac-main { display: flex; flex-direction: column; min-width: 0; }
.mac-bar { display: flex; align-items: center; justify-content: space-between; height: 3.4em; padding: 0 1.1em 0 1.4em; }
.mac-bar b { font-size: 1.15em; font-weight: 700; }
.mac-tb { display: grid; place-items: center; width: 2.4em; height: 2.4em; border-radius: 50%; background: rgba(0, 0, 0, .05); color: #3A3A3C; }
.mac-calc { flex: 1; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; width: 20em; margin: 0 auto; padding: 0 0 1.8em; }
.mac-last { color: var(--m-sub); font-size: 1.15em; font-variant-numeric: tabular-nums; white-space: nowrap; min-height: 1.4em; }
.mac-num { font-size: 4.2em; font-weight: 300; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; margin-bottom: .25em; }
.mac-quick { display: flex; gap: .3em; width: 100%; margin-bottom: .7em; }
.mac-quick i:first-child { flex: 0 0 auto; padding: 0 .9em; }
.mac-quick i { flex: 1 0 auto; padding: 0 .6em; display: grid; place-items: center; height: 2.2em; border-radius: 1.1em; background: var(--m-key); font-style: normal; font-size: .85em; font-weight: 600; white-space: nowrap; }
.mac-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65em; width: 100%; }
.mac-keys i {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; background: var(--m-key); color: #111;
  font-style: normal; font-size: 1.6em; transition: filter .3s var(--ease-out);
}
.mac-keys .fn { background: var(--m-fn); font-size: 1.35em; }
.mac-keys .op { background: var(--m-op); color: #fff; font-size: 1.8em; }
/* A key flashes when its keyboard key goes down, like the app's keys: instantly on, fading off. */
.mac-keys i.hit { filter: brightness(.86); transition: none; }

/* History inspector */
.mac-insp { display: flex; flex-direction: column; gap: .5em; padding: 1.1em 1em; border-left: 1px solid var(--m-line); background: #FAFAFB; }
.mac-insp-title { font-weight: 700; font-size: 1.1em; padding: .3em .2em .6em; }
.mac-hist { display: flex; flex-direction: column; gap: .2em; }
.mac-hist > span { display: flex; flex-direction: column; align-items: flex-end; padding: .55em .6em; border-radius: .6em; border-bottom: 1px solid var(--m-line); transition: background-color .8s ease; }
.mac-hist em { font-style: normal; color: var(--m-sub); font-size: .9em; font-variant-numeric: tabular-nums; }
.mac-hist b { font-weight: 500; font-size: 1.25em; font-variant-numeric: tabular-nums; }
.mac-hist > span.new { animation: mac-in .35s var(--ease-out); background: #FFF4E6; }
@keyframes mac-in { from { opacity: 0; transform: translateY(-.4em); } }

/* Keys pressed, as keycaps under the window */
.mac-keystrokes { display: flex; justify-content: center; gap: .45em; width: 100%; min-height: 2.6em; overflow: hidden; font-size: clamp(11px, 1.5cqi, 15px); }
.mac-keystrokes kbd {
  display: inline-grid; place-items: center; min-width: 2.3em; height: 2.3em; padding: 0 .6em; border-radius: .45em;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 .14em 0 var(--line);
  font: 600 .95em/1 var(--font-ui); color: var(--ink); animation: mac-key .18s var(--ease-out);
}
.mac-keystrokes kbd.old { opacity: .45; }
@keyframes mac-key { from { transform: translateY(.18em); box-shadow: 0 0 0 var(--line); } }

/* Narrower cards: no inspector, then a slimmer sidebar */
@container (max-width: 760px) {
  .mac { grid-template-columns: 13em minmax(0, 1fr); font-size: clamp(5.5px, 1.9cqi, 13px); }
  .mac-insp { display: none; }
}
@container (max-width: 460px) {
  .mac { grid-template-columns: 11em minmax(0, 1fr); font-size: clamp(5px, 2.15cqi, 12px); height: 43em; }
  .mac-calc { width: 18.5em; }
}
@media (prefers-reduced-motion: reduce) {
  .mac-keys i, .mac-keystrokes kbd, .mac-hist > span.new { animation: none; transition: none; }
}
