/* Fixed UI shares the same visible viewport as the coordinate frame. */
:root {
  --mat-visible-width: 100vw;
  --mat-visible-height: 100dvh;
  --mat-visible-left: 0px;
  --mat-visible-top: 0px;
  --mat-toolbar-gap: max(32px, env(safe-area-inset-bottom, 0px));
}
.mat-frame-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}
.mat-rulers {
  view-transition-name: mat-rulers;
  inset: auto;
  right: auto;
  bottom: auto;
  top: var(--mat-visible-top);
  left: var(--mat-visible-left);
  width: var(--mat-visible-width);
  height: var(--mat-visible-height);
  overflow: hidden;
  pointer-events: none;
}
/* The frame is continuous, opaque, and has no cutout in its outer corners. */
.mat-rulers .mat-frame-band {
  fill: var(--color-background);
  fill-opacity: 1;
}
body:has(.detail-page) .mat-frame-overlay { display: none; }
body:has(#cutting-mat-shell[data-intro]) .mat-frame-overlay { visibility: hidden; }
.mat-toolbar {
  left: calc(var(--mat-visible-left) + var(--mat-visible-width) / 2);
  top: calc(var(--mat-visible-top) + var(--mat-visible-height) - 88px - var(--mat-toolbar-gap));
  bottom: auto;
  touch-action: none;
}
#mat-filters {
  left: calc(var(--mat-visible-left) + var(--mat-visible-width) / 2);
  top: auto;
  bottom: calc(100vh - var(--mat-visible-top) - var(--mat-visible-height) + 88px + var(--mat-toolbar-gap));
  max-width: var(--mat-visible-width);
}
@media (min-width: 768px) {
  :root { --mat-toolbar-gap: 40px; }
}
/* Shared prose wrapping for every reading page, including future projects. */
.detail-page :is(p, li, blockquote, figcaption, h1, h2, h3, h4, h5, h6) {
  text-wrap: pretty;
  overflow-wrap: break-word;
}

/* Dragging the board must not rubber-band the document behind its frame. */
html:has(#cutting-mat-shell:not([hidden]) [data-floating-posts-layer]) {
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 767px) {
  .mat-frame-overlay { display: none; }
  #cutting-mat-shell main[data-view-mode="grid"] > .mx-auto {
    column-gap: 8px;
    padding-inline: 12px;
  }
  #cutting-mat-shell main[data-view-mode="grid"] > .mx-auto > div {
    row-gap: 8px;
  }
  .mat-toolbar .mat-theme-picker { margin-left: -44px; }
}

@media (max-width: 767px) {
  .cutting-mat-pan-surface {
    pointer-events: none;
    touch-action: auto;
    cursor: default;
    background-position: 0 0 !important;
  }
}

@media (max-width: 767px) {
  .cutting-mat-dots { background-image: none !important; }
}

.archive-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  color: var(--color-foreground);
  font-size: 12px;
  font-weight: 300;
  line-height: 1.5;
  text-transform: uppercase;
}
.archive-caption > :first-child { min-width: 0; overflow-wrap: anywhere; }
.archive-caption > :last-child { flex-shrink: 0; }
.archive-caption a { text-decoration: none; }
.archive-caption a:hover { text-decoration: underline; text-underline-offset: 3px; }
.archive-caption a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
.project-archive-caption { width: 100%; max-width: 1000px; margin-inline: auto; }
@media (max-width: 767px) {
  .archive-caption { font-size: 10px; gap: 12px; margin-bottom: 12px; }
  .archive-columns { column-gap: 8px; }
  .archive-columns > div { row-gap: 8px; }
}

@media (min-width: 768px) {
  #cutting-mat-shell .archive-grid { padding-inline: 56px; }
}

.about-photo-card {
  width: 100%; max-width: 1100px; margin: 56px 0 0;
  border-radius: 20px; overflow: hidden;
}
.about-photo-card img { display: block; width: 100%; height: auto; }
@media (max-width: 767px) {
  .about-photo-card { margin-top: 36px; border-radius: 14px; }
}

.about-photo-card { position: relative; overflow: visible; transform-origin: center; touch-action: none; cursor: grab; will-change: transform; }
.about-photo-card img { border-radius: inherit; pointer-events: none; user-select: none; }
.about-photo-card[data-dragging] { cursor: grabbing; z-index: 25; }
.about-photo-card:focus-visible { outline: 2px solid var(--color-foreground); outline-offset: 6px; }
.about-photo-card button { position: absolute; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--color-foreground); touch-action: none; }
.about-photo-card [data-photo-resize] { right: -10px; bottom: -10px; cursor: nwse-resize; }
.about-photo-card [data-photo-resize]::after { content: none; }


.about-photo-card button:focus-visible { outline: 2px solid currentColor; border-radius: 4px; }

.about-page { position: relative; }
.about-photo-card { transform: rotate(-2deg); }
.about-photo-card video { width: 100%; height: auto; display: block; border-radius: inherit; pointer-events: none; background: #01010f; }
@media (min-width: 1024px) {
  .about-page .about-photo-card { position: absolute; width: clamp(320px, 35vw, 520px); right: 5vw; top: 420px; margin: 0; z-index: 2; }
}

@media (min-width: 1440px) {
  .about-page .about-photo-card { width: min(42vw, 900px); right: 3vw; }
}

/* Let iOS composite fixed controls during momentum scrolling. VisualViewport
   offsets can include transient rubber-band motion and must not move the dock. */
@media (max-width: 767px) {
  .mat-toolbar {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: 50%;
  }
  #mat-filters {
    top: auto;
    left: 50%;
    bottom: calc(88px + max(16px, env(safe-area-inset-bottom, 0px)));
    max-width: 100vw;
  }
}

[data-glass-fallback] > canvas { display: none !important; }
[data-glass-fallback] > a, [data-glass-fallback] > button {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid currentColor; border-radius: 999px;
  color: var(--fallback-ink, #f0f1f9); background: #1717bb;
  font: 500 11px/1 sans-serif; text-transform: uppercase;
  text-align: center; text-decoration: none; padding: 4px;
  box-sizing: border-box; overflow: hidden;
}
[data-theme="white"] [data-glass-fallback] { --fallback-ink: #01010f; }
[data-theme="white"] [data-glass-fallback] > :is(a,button) { background: #f0f1f9; }
[data-theme="dark"] [data-glass-fallback] > :is(a,button) { background: #01010f; }
[data-glass-fallback] > :is(a,button):focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Headings keep words whole, including the long profession on narrow phones. */
.detail-page :is(h1,h2,h3,h4,h5,h6) {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
@media (max-width: 767px) {
  .detail-page.about-page h2 { font-size: clamp(24px, 6.6vw, 32px); }
}
