/* ==========================================================================
   Direction F: Focus. Two stops on the home page, About and Work; the work
   opens over the wall and snaps image by image. Small type, see-through corners.
   ========================================================================== */


:root {
  --radius: 24px;
  --wall-gap: 16px;
}

.focus-open { overflow: hidden; }

.page-f .media { border-radius: var(--radius); }
.page-f .tile:focus-visible { border-radius: var(--radius); }

/* --- Corners -------------------------------------------------------------- */

/* The name and Contact stay above everything, the open work included, and invert over images.
   Close joins Contact while a project is open. */
.page-f .e-name,
.f-corner {
  position: fixed;
  top: 20px;
  z-index: 500;
  color: #fff;
  mix-blend-mode: difference;
}

.f-corner {
  right: var(--gutter);
  display: flex;
  gap: 20px;
}

.f-close { display: none; }
.focus-open .f-close { display: block; }

/* --- About: the first stop ------------------------------------------------ */

/* The work starts two thirds of the way down, so the first row already shows. */
.f-intro {
  min-height: 68svh;
  padding-bottom: 96px;
  align-content: start;
}

/* The first line belongs to the name and Contact; all three columns start under it. */
.page-f .e-intro__nav,
.page-f .e-intro__bio { padding-top: 1.45em; }

.page-f .e-intro:not(.f-intro) { padding-bottom: clamp(64px, 10vh, 112px); }

.f-accent,
.page-f .e-footer .f-accent,
.page-f .e-intro__bio .f-accent { color: var(--accent); }

@media (hover: hover) {
  .page-f .e-footer .f-accent:hover { color: var(--fg); }
}

.page-f .e-footer { padding-top: 96px; }

/* --- Wall ---------------------------------------------------------------- */

/* Columns are filled by script, shortest first, so the wall reads left to right.
   Without it, CSS columns do the same job top to bottom. */
.f-wall {
  padding-inline: var(--gutter);
  columns: var(--desk-cols, 3);
  column-gap: var(--wall-gap);
  scroll-margin-top: 64px;
  --wall-cols: var(--desk-cols, 3);
}


.f-wall.is-packed {
  columns: auto;
  display: grid;
  grid-template-columns: repeat(var(--wall-cols), minmax(0, 1fr));
  gap: var(--wall-gap);
  align-items: start;
}

.f-wall__col { display: grid; gap: var(--wall-gap); }

.f-tile { break-inside: avoid; margin-bottom: var(--wall-gap); }
.f-wall.is-packed .f-tile { margin-bottom: 0; }

.f-tile--soon .media { background: var(--surface); }
.f-tile--soon .pill { color: var(--muted); }

/* Phones have no hover, so the name and what it was sit under the tile there. */
.f-tile__caption { display: none; }

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

/* One image at a time: each row snaps to the top, level with the text beside it. */
.f-focus {
  position: fixed;
  inset: 0;
  z-index: 400;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  padding: 0 var(--gutter);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  backdrop-filter: blur(32px) saturate(1.4);
  outline: none;
  cursor: pointer;
  animation: f-in 0.35s var(--ease-out);
}

.f-focus[hidden] { display: none; }

.f-focus.is-closing {
  opacity: 0;
  transition: opacity 0.2s ease;
}

@keyframes f-in { from { opacity: 0; } }

.f-focus .e-proj { padding-top: 64px; }
.f-focus .e-proj + .e-proj { margin-top: 64px; }
.f-focus .e-proj__text { top: 64px; cursor: auto; }

/* Images snap to the top edge, level with the name; the previous one leaves just as it lands. */
.f-focus .e-proj__media > .media,
.f-focus .e-proj__media > .row,
.f-focus .e-note {
  scroll-snap-align: start;
  scroll-margin-top: var(--gap);
}

.f-focus .e-note { padding-block: 16px; cursor: auto; }
.f-focus .e-note { display: none; }

.f-focus .e-proj__text dl > div + div { margin-top: 0.5em; }

.f-proj__cta { padding-top: 16px; cursor: auto; }
.f-proj__cta a { color: var(--accent); }

.f-focus .e-sheet__end {
  padding: 64px 0 96px;
  scroll-snap-align: end;
}

.f-corner > * { transition: opacity 0.2s ease; }

@media (hover: hover) {
  .f-corner > *:hover { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .f-focus { animation: none; }
}

/* --- How I work: one document -------------------------------------------- */

.f-doc {
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: var(--gap);
  padding-inline: var(--gutter);
}

.f-doc__toc {
  position: sticky;
  top: 64px;
  align-self: start;
}

.f-doc__toc a { color: var(--muted); transition: color 0.2s ease; }
.f-doc__toc .f-accent { color: var(--accent); }
.f-doc__toc a[aria-current="true"] { color: var(--fg); }
.f-doc__toc p { margin-top: 1.45em; }

@media (hover: hover) {
  .f-doc__toc a:hover { color: var(--fg); }
}

.f-doc__text { grid-column: 2 / -1; max-width: 760px; }

.f-doc__chapter { scroll-margin-top: 64px; text-wrap: pretty; }
.f-doc__chapter + .f-doc__chapter { margin-top: 72px; }
.f-doc__chapter h2 { font-weight: 500; }
.f-doc__chapter p + p { margin-top: 0.75em; }
.f-doc__lead { margin-bottom: 1.45em; color: var(--muted); }

.f-doc__fig { margin-top: 28px; }
.f-doc__fig figcaption { margin-top: 8px; font-size: var(--t-xs); }
.f-doc__fig--small img { width: 240px; height: auto; }
.f-doc__fig--portrait { max-width: 360px; }

/* --- Small screens ------------------------------------------------------- */

@media (max-width: 900px) {
  .f-wall { columns: 2; --wall-cols: 2; }
  .page-f .e-intro__bio { padding-top: 0; }

  /* Text first, then the images; snapping only helps, it never holds you. */
  .f-focus { scroll-snap-type: y proximity; }
  .f-focus .e-proj__text { scroll-snap-align: start; scroll-margin-top: 64px; }

  .f-doc { grid-template-columns: 1fr; }
  .f-doc__toc { display: none; }
  .f-doc__text { grid-column: 1; }
}

@media (max-width: 560px) {
  .f-wall { columns: 1; --wall-cols: 1; }
  .f-tile__caption { display: block; padding-top: 10px; font-size: var(--t-sm); }
}

/* ==========================================================================
   Direction G: Float. F, with the project's text in a floating card that keeps
   the left third and slides away to give the work the whole width, and About
   as a page of its own.
   ========================================================================== */

/* --- About page ----------------------------------------------------------- */

.g-list > div { display: flex; flex-wrap: wrap; gap: 0 8px; }
.g-list > div + div { margin-top: 0.25em; }
.f-doc__chapter a:not(.f-accent) { text-decoration: underline; text-decoration-color: rgba(0, 0, 0, 0.2); text-underline-offset: 3px; }

/* --- The work: a third for the text, the rest for the images --------------- */

.page-g .f-focus {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  cursor: auto;
}

.page-g .f-focus .e-proj {
  --g-info: calc((100% - 2 * var(--gap)) / 3);
  grid-template-columns: var(--g-info) minmax(0, 1fr);
  transition: grid-template-columns 0.45s var(--ease-out), column-gap 0.45s var(--ease-out);
}

.page-g .f-focus .e-proj__media { grid-column: 2; }

/* The card keeps its width while its column closes, and slides out to the left. */
.page-g .f-focus .e-proj__text {
  width: calc((100vw - 2 * var(--gutter) - 2 * var(--gap)) / 3);
  max-width: none;
  max-height: calc(100svh - 88px);
  overflow-y: auto;
  padding: 16px 20px 20px;
  border-radius: calc(var(--radius) + 4px);
  background: rgba(244, 244, 244, 0.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  transition: transform 0.45s var(--ease-out), opacity 0.3s ease, visibility 0.45s;
}

.g-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.g-panel__head h2 { font-weight: 500; }
.g-panel__hide { flex-shrink: 0; color: var(--muted); transition: color 0.2s ease; }
.g-panel__body { margin-top: 12px; }
.g-panel__body > :first-child { margin-top: 0; }

/* Hidden: the column closes and the work takes the whole width; a tab brings the text back. */
:root[data-info="closed"] .page-g .f-focus .e-proj { --g-info: 0px; column-gap: 0; }

:root[data-info="closed"] .page-g .f-focus .e-proj__text {
  transform: translateX(calc(-100% - var(--gutter)));
  opacity: 0;
  visibility: hidden;
}

.g-info-tab {
  position: fixed;
  top: 64px;
  left: var(--gutter);
  z-index: 3;
  display: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(244, 244, 244, 0.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  font-size: var(--t-sm);
}

:root[data-info="closed"] .g-info-tab {
  display: inline-flex;
  align-items: center;
  animation: f-in 0.3s ease 0.2s both;
}

@media (hover: hover) {
  .g-panel__hide:hover { color: var(--accent); }
  .g-info-tab:hover { color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-info="closed"] .g-info-tab { animation: none; }
  .page-g .f-focus .e-proj,
  .page-g .f-focus .e-proj__text { transition: none; }
}

@media (max-width: 900px) {
  .page-g .f-focus .e-proj { grid-template-columns: minmax(0, 1fr); }
  .page-g .f-focus .e-proj__media { grid-column: 1; }
  .page-g .f-focus .e-proj__text { width: auto; max-height: none; }
  :root[data-info="closed"] .page-g .f-focus .e-proj__text { display: none; }
}
