/* The demo's page: the homepage's cards (stream.css), the edit mode's
   pencil and bar (prototypes/thumb-studio/home-edit.js). */
@font-face {
  font-family: "GT America";
  src: url("/fonts/GT-America-Standard-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: oklch(0.96 0.004 106.5);
  --ink: oklch(0.145 0 0);
  --ink-soft: oklch(0.473 0.006 106.6);
  --frame-empty: oklch(0.925 0.004 106.5);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --yellow: #f5d76e;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 15px/20px "GT America", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main { padding: 24px 24px 96px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.back {
  display: inline-block;
  /* A 44px target for a finger, with the line where it was. */
  padding-block: 12px;
  margin: -12px 0 0;
  color: var(--ink);
  text-underline-offset: 3px;
}

.back[hidden] { display: none; }

.hint {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

/* Four columns, as the homepage's grid at this width */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px 20px;
  max-width: 1312px;
}

@media (max-width: 899px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card { min-width: 0; }

.card__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 256 / 182;
  background: var(--frame-empty);
}

.card__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The browser's crop, as the homepage first drew this card */
.card__thumb--raw { object-position: top; }

.card__live {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.card__live > div {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
}

.card__pencil {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #2c2c2c;
  border-radius: 6px;
  background: #1b1b1b;
  color: #ecebe8;
  cursor: pointer;
}

/* A larger target than the button draws, for a finger */
.card__pencil::before { content: ""; position: absolute; inset: -6px; }

@media (hover: hover) and (pointer: fine) {
  .card__pencil:hover { border-color: #777; }
}
/* Two tones, so the ring shows on dark thumbnails as well as light ones. */
.card__pencil:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px var(--paper); }

.card__pencil[aria-pressed="true"] {
  border-color: var(--yellow);
  background: var(--yellow);
  color: #111;
}

.card__pencil[data-picked]::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ecebe8;
  box-shadow: 0 0 0 2px #1b1b1b;
}

.card__title {
  margin-top: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__meta {
  margin-top: 7px;
  color: var(--ink-soft);
  font: 500 11px/14px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* The bar at the foot: the open card, a style, the pick, Done */
.bar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  /* Just under DialKit's panel, which sets 9999 itself. */
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 6px 8px 6px 12px;
  translate: -50% 0;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  background: #1b1b1b;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
  color: #ecebe8;
  font: 500 13px/1.3 ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.bar[hidden] { display: none; }

.bar__title {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar__status {
  /* A fixed width, so the centered bar doesn't shift when Not picked
     becomes Picked: Photograph. */
  width: 10.5em;
  overflow: hidden;
  color: #a8a6a1;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bar__status--picked { color: #ecebe8; }

.bar select,
.bar button {
  min-height: 40px;
  padding: 5px 10px;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #121212;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.bar select:focus-visible,
.bar button:focus-visible { outline: 2px solid #ecebe8; outline-offset: 2px; }

/* The bar and the panel arrive together, with the site's --ease-out; both
   leave at once when the card closes. */
@keyframes demo-bar-enter { from { opacity: 0; transform: translateY(var(--enter-rise, 6px)); } }
@keyframes demo-panel-enter { from { opacity: 0; scale: 0.97; } }
.bar[data-enter] { animation: demo-bar-enter 200ms cubic-bezier(0.23, 1, 0.32, 1); }
.dialkit-root[data-enter] .dialkit-panel-inner { animation: demo-panel-enter 200ms cubic-bezier(0.23, 1, 0.32, 1); }

@media (prefers-reduced-motion: reduce) {
  .bar[data-enter],
  .dialkit-root[data-enter] .dialkit-panel-inner { animation: none; }
}

/* ---- Phones: the panel docks at the foot, under half the screen, and the
   bar moves to the top, so the card being edited has the space between. ---- */
@media (max-width: 599px) {
  main { padding: 16px 16px 60vh; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .card { scroll-margin-top: 72px; }

  .bar {
    top: 8px;
    bottom: auto;
    left: 8px;
    right: 8px;
    max-width: none;
    translate: none;
    padding: 6px 6px 6px 10px;
    /* At the top of the screen, it comes down rather than up. */
    --enter-rise: -6px;
  }
  .bar__status { display: none; }
  /* iOS Safari zooms the page into any control under 16px when it's focused. */
  .bar select { font-size: 16px; }
  .bar select,
  .bar button { min-height: 44px; }
  .bar__title { flex: 1; min-width: 0; }

  .dialkit-panel[data-position] {
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    max-height: 44vh;
  }
  .dialkit-panel[data-position] .dialkit-panel-wrapper { width: 100%; }
  /* The header's icon sits over the end of the title row, so a long card
     title stops short of it; the card below shows the title in full. */
  .dialkit-panel[data-position] .dialkit-folder-title-row { min-width: 0; padding-inline-end: 24px; }
  .dialkit-panel[data-position] .dialkit-folder-title-root { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* DialKit sets its desktop width and height on this one inline. */
  .dialkit-panel[data-position] .dialkit-panel-inner {
    width: 100% !important;
    max-height: 44vh !important;
  }
  /* The offset pad lies flat, so it isn't the height of the screen. */
  .dialkit-pad-surface { aspect-ratio: 3 / 1; }
}
