/* ==========================================================================
   O · Pocket. Made for a phone first. Pills float over the page top and
   bottom, no white bar. Loaded after basics.css, which it builds on.
   ========================================================================== */

/* The type scale (see TYPE.md). Text is 18 on 28 on every screen, labels (the names under the work,
   captions) one step down at 16. Buttons are 16px on a computer and 18px on a phone, where they're
   tapped with a thumb. */
/* Fixed: corners at 24px, three columns, and one 16px gap for everything, the wall, a project's
   images, the grid and the footer. */
.page-o {
  --radius: 24px;
  --desk-cols: 3;
  --wall-gap: 16px;
  --gap: 16px;
  --bar: 72px;
  --pill-h: 44px;
  --t-xs: 16px;
  --t-sm: 16px;
  --t-body: 18px;
  --t-lg: var(--t-body);
  --t-ui: 16px;
  /* The line height of all text, as a ratio so labels keep the proportion: 18 on 28. */
  --lh: calc(28 / 18);
  line-height: var(--lh);
}

@media (max-width: 900px) {
  .page-o { --t-ui: 18px; }
}

/* --- Floating pills --------------------------------------------------------------- */

.o-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--pill-h);
  padding: 0 20px;
  border-radius: 999px;
  background: rgba(246, 246, 246, 0.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  color: var(--fg);
  font-size: var(--t-ui);
  font-weight: var(--strong);
  white-space: nowrap;
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 150ms ease-out;
}

.o-pill--dark {
  background: rgba(10, 10, 10, 0.9);
  color: #fff;
}

.o-pill:active { transform: scale(0.97); }

@media (hover: hover) {
  .o-pill:hover { background: rgba(228, 228, 228, 0.9); }
  .o-pill--dark:hover { background: var(--fg); }
}

/* The name and Contact, always at the top, above the work when it's open too. */
.o-top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 500;
  display: flex;
  justify-content: space-between;
  padding: 16px var(--gutter) 0;
  pointer-events: none;
}

.o-top > *,
.o-top__end > * { pointer-events: auto; }

.o-top__end { display: flex; gap: 8px; }

.page-o .e-name {
  position: static;
  color: var(--fg);
  mix-blend-mode: normal;
}

/* On a computer Work and About live up here; on a phone they move down to the dock. */
.page-o .o-dock { display: none; }

.page-o .f-close { display: none; }
.focus-open .page-o .f-close { display: inline-flex; }

/* Work and About float at the bottom, then step aside when the footer, which has them too, arrives. */
.o-dock {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 300;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  transition: transform 0.25s var(--ease-out), opacity 0.2s ease;
}

.o-dock.is-landed {
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
}

/* --- The page ----------------------------------------------------------------------- */

.o-intro {
  grid-column: 1 / span 5;
  padding: 40px 2px 40px;
  text-wrap: pretty;
}

.o-intro h1 { font-size: var(--t-body); line-height: var(--lh); text-wrap: balance; }
.o-intro p { margin-top: 0; text-wrap: pretty; }

.page-o .f-wall.n-work { padding-top: 0; scroll-margin-top: var(--bar); }

/* --- The wall: nothing written on it until you point at a piece --------------------- */

/* With a mouse the name shows on hover, over the image; on a phone it sits under the piece. */
.page-o .n-tile[data-hover] { position: relative; }

@media (hover: hover) and (pointer: fine) {
  .page-o .n-tile[data-hover] .n-tile__caption { display: none; }

  /* No caption under the pieces, so no room left for one: the same gap down as across. */
  .page-o .n-work .f-wall__col { gap: var(--wall-gap); }
  .page-o .n-work .n-tile { margin-bottom: var(--wall-gap); }
  .page-o .n-work.is-packed .n-tile { margin-bottom: 0; }
  .page-o .n-tile[data-hover]:hover .tile__hover,
  .page-o .n-tile[data-hover]:focus-visible .tile__hover { opacity: 1; transform: none; }
}

@media not ((hover: hover) and (pointer: fine)) {
  .page-o .n-tile .tile__hover { display: none; }
}

/* Cut-out images float on the page, with no grey card behind them. */
.page-o .media { background: transparent; }

/* --- The footer: A's pills, big enough to tap ------------------------------------------ */

.page-o .o-footer {
  max-width: none;
  margin-top: clamp(96px, 14vh, 160px);
  padding-bottom: 24px;
  grid-template-columns: 2fr repeat(5, minmax(0, 1fr)) 2fr;
}

.page-o .o-footer .pill { height: var(--pill-h); font-size: var(--t-sm); }

/* --- The work, over the page ---------------------------------------------------------- */

.page-o .f-focus {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  backdrop-filter: blur(32px) saturate(1.4);
}

.page-o .f-focus .e-sheet__end { padding-left: 0; text-align: center; grid-column: auto; }

/* Close at the end of each project, for phones. */
.o-exit { display: none; }

/* --- Phones ------------------------------------------------------------------------------ */

@media (max-width: 900px) {
  .page-o { --pill-h: 52px; --bar: 84px; }

  .o-top__nav { display: none; }
  .page-o .o-dock { display: flex; }

  .o-intro { grid-column: 1 / -1; padding: 28px 2px 28px; }

  /* Nothing snaps on a phone. */
  .page-o .f-focus { scroll-snap-type: none; }
  .page-o .f-focus .e-proj { padding-top: var(--bar); }

  .o-exit { display: flex; justify-content: center; padding: 32px 0 8px; }
  .o-exit .o-pill { padding: 0 28px; }

  .page-o .o-footer { grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-o .o-footer .o-footer__line,
  .page-o .o-footer .o-footer__mail { grid-column: 1 / -1; }
  .page-o .o-footer .pill:nth-child(6) { grid-column: 1 / -1; }
}

/* Preview only: on a phone the switcher sits above the dock so it doesn't cover it. */

@media (max-width: 760px) {
  .page-o .switcher { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .o-dock { transition: none; }
}
