/*
 * ecem.world — the portfolio.
 *
 * The shape comes from the reference study (ecem-world-notes/REFERENCE-STUDY.md):
 *   - a pinned panel with the bio always visible (Emi, Nik, Amy)
 *   - (an index list here, later: collaborators and clients)
 *   - media at its own ratio, never cropped to one shape (Nik, Emi)
 *   - one typeface, two sizes, hierarchy from position, grey and hairlines
 *   - a project opens over the page, so closing it puts you back (Amy)
 *
 * Every colour and size is a token below. Change them here, not in rules.
 */

:root {
  color-scheme: dark;

  --bg: #000;
  --fg: #fff;
  --dim: rgba(255, 255, 255, 0.52);    /* captions, meta */
  --faint: rgba(255, 255, 255, 0.3);   /* separators */
  --rule: rgba(255, 255, 255, 0.16);   /* hairlines */
  --tile: #111;                        /* where media is still loading */

  --font: Helvetica, "Helvetica Neue", "HelveticaNeue", Arial, sans-serif;
  --t-small: 12px;   /* everything but the bio */
  --t-large: 15px;   /* the bio, and titles inside a project */

  --panel-w: 360px;
  --gap: 12px;       /* between pieces of media */
  --pad: 18px;       /* page margins */
  /* The largest any image may show, in the feed or in an opened project.
     Height: the Mediterranean postcard as it shows at 1440×900 (511px).
     Width: twice Glyph light's width there (2 × 413px). */
  --max-h: 512px;
  --max-w: 826px;

  --mark: 92px;      /* the drifting "e" */
  --big: min(42vmin, 205px);  /* the "e" on the coming-soon page, and at the start */
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--t-small) / 1.45 var(--font);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }

:focus-visible { outline: 1px solid var(--dim); outline-offset: 3px; }

/* ── The panel ───────────────────────────────────────────────────────── */

.panel {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  padding-bottom: max(var(--pad), env(safe-area-inset-bottom));
  border-right: 1px solid var(--rule);
}

.mark { position: relative; display: block; width: var(--mark); aspect-ratio: 1 / 1; margin: -10px 0 4px -14px; }

/* The "e" is always drawn at the coming-soon page's size (--big) and scaled
   down into its corner (--k = mark ÷ big, set by the page's script). That
   keeps it crisp, and lets the opening move grow it back without redrawing. */
#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--big);
  aspect-ratio: 1 / 1;
  transform-origin: 0 0;
  transform: scale(var(--k, 0.41));
}
#stage canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── The opening ─────────────────────────────────────────────────────────
   On the first visit of a session the page starts as the coming-soon page
   did — the "e" large in the middle of black — then the "e" moves into its
   corner and everything else fades in. html.intro is set in <head>, before
   anything paints, so nothing flashes first. */
html.intro body { overflow: hidden; }
html.intro #stage { position: fixed; left: calc(50vw - var(--big) / 2); top: calc(50vh - var(--big) / 2); transform: none; z-index: 5; }
html.intro .panel > :not(.mark),
html.intro .feed { opacity: 0; }
html.intro .panel { border-right-color: transparent; }
.panel { transition: border-color 900ms ease 450ms; }
.panel > :not(.mark), .feed { transition: opacity 900ms ease 450ms; }

.name {
  margin: 0 0 10px;
  font-size: calc(var(--t-small) * 1.5);   /* 18px */
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bio {
  margin: 0;
  font-size: 13px;   /* 2px under --t-large */
  line-height: 1.38;
  letter-spacing: 0;
  text-wrap: pretty;
}
.bio p { margin: 0 0 0.7em; }
.bio p:last-child { margin-bottom: 0; }

.currently { margin: 12px 0 0; color: var(--dim); }

.filters {
  display: flex;
  gap: 14px;
  margin: 26px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.filters button { color: var(--dim); transition: color 150ms ease; }
.filters button[aria-pressed="true"] { color: var(--fg); }
/* About sits on the same row, pushed to its far right. */
.filters .about-link { margin-left: auto; color: var(--dim); transition: color 150ms ease; }
.filters .about-link:hover, .filters .about-link[aria-current="page"] { color: var(--fg); }
.filters sup { font-size: 0.75em; margin-left: 2px; color: var(--faint); }

/* Empty room between the filters and the footer menu, so the menu sits
   at the bottom of the panel. (The index list that was here is gone for
   now: that space is for collaborators and clients, once there are some.) */
.spacer { flex: 1; }

@media (hover: hover) {
  .filters button:hover { color: var(--fg); }
}

/* The coming-soon page's footer menu, carried over as it was. */
.menu {
  padding-top: 14px;
  letter-spacing: 0.12em;
  line-height: 2;
}

.menu a {
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  padding-bottom: 2px;
  white-space: nowrap;
  transition: border-color 250ms ease;
}

.menu a:hover, .menu a:focus-visible { border-bottom-color: var(--fg); }
.menu .sep { padding: 0 0.5em; opacity: 0.4; }

/* ── The feed ────────────────────────────────────────────────────────── */

.feed {
  margin-left: var(--panel-w);
  padding: var(--pad);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 64px var(--gap);
  align-items: start;
}

.item { grid-column: span 2; min-width: 0; }
.item.is-small { grid-column: span 1; }

/* Each piece of media sizes itself: as large as its S / M / L allows
   (--sz × the --max-w by --max-h box), never wider than the column, at its
   own ratio so nothing is cropped. Pieces that fit side by side share a
   line; the rest continue on the next. */
.frames { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: flex-start; }

.frame {
  position: relative;
  flex: none;
  width: min(100%, calc(var(--max-w) * var(--sz, 1)), calc(var(--max-h) * var(--sz, 1) * var(--r)));
  aspect-ratio: var(--r);
  min-width: 0;
  background: var(--tile);
  overflow: hidden;
}

.frame > img, .frame > video, .frame > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}



.frame img { opacity: 0; transition: opacity 500ms ease; }
.frame img.loaded { opacity: 1; }

.caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
  color: var(--dim);
  font-size: var(--t-large);   /* 15px, was 12px */
  line-height: 1.35;
}

.caption > :first-child { color: var(--fg); }
.item.is-small .caption,
.item.image .caption { grid-template-columns: minmax(0, 1fr) auto auto; }
.item.is-small .caption .c-mid:empty,
.item.image .caption .c-mid:empty { display: none; }

.more { color: var(--faint); }

/* Writing: text, not a picture of text. */
/* Writing reads as a list: one full-width row each, the cover on the left
   and everything else beside it. Without a cover the text takes the row. */
.writing a.card {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-areas: "cover meta" "cover title" "cover sub" "cover go";
  grid-template-rows: auto auto auto 1fr;
  column-gap: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.writing a.card.no-cover { grid-template-columns: minmax(0, 1fr); grid-template-areas: "meta" "title" "sub" "go"; }
.writing .w-meta { grid-area: meta; color: var(--dim); display: flex; justify-content: space-between; }
.writing h2 { grid-area: title; margin: 14px 0 10px; font-size: 26px; font-weight: 400; line-height: 1.2; letter-spacing: -0.005em; }
.writing p { grid-area: sub; margin: 0; color: var(--dim); font-size: var(--t-large); line-height: 1.4; max-width: 40em; }
.writing .w-cover { grid-area: cover; width: 100%; aspect-ratio: 320 / 192; background: var(--tile); }
.writing .w-cover img { width: 100%; height: 100%; object-fit: cover; }
.writing .go { grid-area: go; align-self: end; justify-self: start; margin-top: 16px; color: var(--fg); }

@media (hover: hover) {
  .item a { transition: opacity 200ms ease; }
  .item a:hover .frame { opacity: 0.86; }
  .writing a.card:hover h2 { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
}

.item.flash { animation: flash 1200ms ease; }
@keyframes flash { 0%, 40% { opacity: 0.35; } 100% { opacity: 1; } }

.empty { grid-column: 1 / -1; color: var(--dim); padding-top: 40vh; text-align: center; }

/* Shown only in the studio's preview: drafts and archived pieces appear
   there so they can be checked before going live. */
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--faint);
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ── A project, opened ───────────────────────────────────────────────── */

dialog { border: 0; padding: 0; color: var(--fg); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.sheet {
  width: 100vw;
  height: 100dvh;
  margin: 0;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet::backdrop { background: var(--bg); }

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: var(--pad);
  background: linear-gradient(var(--bg) 60%, transparent);
}

.sheet-title { margin: 0; color: var(--dim); }
.sheet-title b { font-weight: 400; color: var(--fg); }
.sheet .close { color: var(--dim); }
.sheet .close:hover { color: var(--fg); }

.sheet-body { outline: none; max-width: 1180px; margin: 0 auto; padding: 0 var(--pad) 120px; }

.sheet-media { display: grid; gap: var(--gap); }
.sheet-media .frame { flex: none; width: 100%; max-width: calc(88vh * var(--r)); margin: 0 auto; }

.sheet-text {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 40px;
  margin: 56px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.sheet-text h2 { margin: 0 0 18px; font-size: var(--t-large); font-weight: 400; }
.sheet-text .prose { font-size: var(--t-large); line-height: 1.5; max-width: 38em; }
.sheet-text .prose p { margin: 0 0 1em; }
.sheet-text .prose a { border-bottom: 1px solid var(--faint); }
.sheet-text .prose img { height: auto; margin: 1.5em 0; }
.sheet-text .prose figure { margin: 0; }
.sheet-text .prose figcaption { font-size: var(--t-small); color: var(--dim); }
.sheet-text .prose blockquote { margin: 0 0 1em; padding-left: 1em; border-left: 1px solid var(--faint); }
.sheet-text dl { margin: 0; color: var(--dim); }
.sheet-text dt { color: var(--faint); }
.sheet-text dd { margin: 0 0 10px; color: var(--fg); }

.sheet-next {
  display: flex;
  justify-content: space-between;
  margin-top: 80px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  color: var(--dim);
}
.sheet-next a:hover { color: var(--fg); }

/* About: the portrait beside the text. The photo is black and white, and
   turns to colour on hover — the colour version sits on top, fading in.
   A screen without hover (phone, tablet) toggles it with a tap instead. */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 48px;
  align-items: start;
}
.portrait { position: relative; margin: 0; background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.portrait img { width: 100%; height: auto; }
.portrait .color { position: absolute; inset: 0; height: 100%; object-fit: cover; opacity: 0; transition: opacity 700ms ease; }
@media (hover: hover) { .portrait:hover .color { opacity: 1; } }
.portrait.is-color .color { opacity: 1; }
.about-text { position: sticky; top: 70px; }
.about-text .lead { margin: 0 0 1.2em; font-size: var(--hero, 20px); line-height: 1.35; max-width: 30em; }
.about-text .lead p { margin: 0 0 0.6em; }
.about-text .lead p:last-child { margin-bottom: 0; }
.about-text .prose { font-size: var(--body, var(--t-large)); line-height: 1.5; max-width: 34em; }
.about-text .prose p { margin: 0 0 1em; }
.about-text dl { margin: 32px 0 0; padding-top: 10px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; }
.about-text dt { color: var(--faint); }
.about-text dd { margin: 0; }
.about-text dd a { border-bottom: 1px solid var(--faint); }
.about-text dd a:hover { border-bottom-color: var(--fg); }

/* ── A project, opened in place ──────────────────────────────────────
   The details sit under the caption at zero height and unfold to their
   natural height (the 0fr → 1fr grid-row trick animates "auto" height).
   Opening is slow and soft: the space eases open while what is inside
   rises and fades in, piece after piece. Closing is quicker and plain. */

.details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 550ms cubic-bezier(0.4, 0, 0.2, 1);
}
.item.is-open .details {
  grid-template-rows: 1fr;
  transition: grid-template-rows 1100ms cubic-bezier(0.16, 1, 0.3, 1);
}
.details-inner { min-height: 0; overflow: hidden; }
.details-inner > :first-child { margin-top: 28px; }
.details-inner > *,
.details .more-frames > .frame {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 300ms ease, transform 300ms ease;
}
.item.is-open .details-inner > *,
.item.is-open .details .more-frames > .frame {
  opacity: 1;
  transform: none;
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
}
/* One after another: each extra image, then the text, then Close. */
.item.is-open .details .more-frames > .frame { transition-delay: calc(150ms + var(--i, 0) * 90ms); }
.item.is-open .details-inner > .sheet-text { transition-delay: 300ms; }
.item.is-open .details-inner > .fold { transition-delay: 450ms; }

/* Opened, the bar above folds away; Close waits at the bottom. */
.more-bar {
  max-height: 60px; overflow: hidden;
  transition: max-height 500ms ease, padding 500ms ease, opacity 250ms ease,
              border-color 200ms ease, background 200ms ease;
}
.item.is-open .more-bar {
  max-height: 0; padding-top: 0; padding-bottom: 0; border-bottom-width: 0;
  opacity: 0; pointer-events: none;
}
.details .sheet-text { margin-top: 40px; }
.details .lead { margin: 0 0 1.1em; font-size: 20px; line-height: 1.35; max-width: 34em; }
.fold {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; margin: 36px 0 8px; padding: 6px 12px;
  border: 1px solid var(--rule); border-radius: 0;
  font-size: var(--t-large); font-style: italic; color: var(--fg); text-align: left;
}

/* A single image's note. Beside the image when chosen in the studio (the
   piece then takes the full width, so the image keeps its size); otherwise
   folded under the caption behind "Note +", using the same unfolding as
   projects. */
.item.has-note { grid-column: span 2; }

/* A Works post with several images: all of them in one sliding row, across
   the full width. Its note, if it has one, folds under the caption behind a
   "Note" bar that stays in place (it reads "Close" while open). */
.item.has-gallery { grid-column: span 2; }
.item.has-gallery .carousel { margin-top: 0; }
.item.image .more-bar { max-height: 60px; }
.item.image.is-open .more-bar {
  max-height: 60px; padding-top: 6px; padding-bottom: 6px; border-bottom-width: 1px;
  opacity: 1; pointer-events: auto;
}
.item.image .details-inner > .note { margin: 14px 0 4px; font-size: var(--t-large); color: var(--fg); }
.with-note { display: flex; gap: 28px; align-items: flex-start; }
.with-note .frames { flex: 1 1 auto; }
.with-note .note { flex: 0 0 min(300px, 34%); }
.note { margin: 0; color: var(--dim); font-size: var(--t-small); line-height: 1.55; max-width: 34em; }
.note p { margin: 0 0 0.9em; }
.item.image .details-inner > .note { margin: 12px 0 4px; }

/* The images held back from the feed, at the top of the opened project:
   one row, all the same height, that slides sideways (arrows, a swipe or
   a trackpad), settling on an image each time. */
.carousel { position: relative; margin-top: 28px; }
.more-frames {
  --car-h: min(440px, 56vh);
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.more-frames::-webkit-scrollbar { display: none; }
.more-frames > .frame {
  width: min(calc(var(--car-h) * var(--r)), 88%);
  scroll-snap-align: start;
}
.car-prev, .car-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.62); border: 1px solid var(--rule);
  color: var(--fg); font-size: 20px;
  transition: opacity 250ms ease, background 200ms ease;
}
.car-prev { left: 10px; }
.car-next { right: 10px; }
.car-prev:hover, .car-next:hover { background: rgba(0, 0, 0, 0.85); }
.carousel.at-start .car-prev, .carousel.at-end .car-next { opacity: 0; pointer-events: none; }

/* ── Full size ───────────────────────────────────────────────────────── */
.frame:has(img), .frame:has(video) { cursor: zoom-in; }
#lightbox {
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 24px;
  display: none;
  place-items: center;
  background: transparent;
  cursor: zoom-out;
  overflow: hidden;
}
#lightbox:focus { outline: none; }
#lightbox[open] { display: grid; animation: lb-in 250ms ease; }
#lightbox::backdrop { background: rgba(0, 0, 0, 0.82); animation: lb-in 250ms ease; }
#lightbox img, #lightbox video {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
}
.lb-stage { display: grid; place-items: center; width: 100%; height: 100%; }
.lb-stage img, .lb-stage video { animation: lb-in 300ms ease; }
#lightbox .lb-prev, #lightbox .lb-next {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; display: grid; place-items: center;
  color: var(--fg); font-size: 26px; cursor: pointer; opacity: 0.7;
  transition: opacity 150ms ease;
}
@media (min-width: 861px) { #lightbox { padding: 24px 72px; } }
#lightbox .lb-prev { left: 8px; }
#lightbox .lb-next { right: 8px; }
#lightbox .lb-prev:hover, #lightbox .lb-next:hover { opacity: 1; }
.lb-count { position: fixed; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; color: var(--dim); font-size: var(--t-small); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Read more ───────────────────────────────────────────────────────
   The only thing that opens a project (or a folded note): unmistakable on
   a phone, a full-width slim box with square corners. */
.more-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 0;
  padding: 6px 12px;
  border: 1px solid var(--rule);    /* a hairline box, square corners */
  border-top: 0;                    /* hangs from the caption's line */
  border-radius: 0;
  font-size: var(--t-large);
  font-style: italic;
  color: var(--fg);
  text-align: left;
}
.more-bar .arrow { font-style: normal; transition: transform 300ms ease; }
.more-bar .when-open { display: none; }
.item.is-open .more-bar .when-open { display: inline; }
.item.is-open .more-bar .when-closed { display: none; }
.item.is-open .more-bar .arrow { transform: rotate(180deg); }
@media (hover: hover) {
  .fold { transition: border-color 200ms ease, background 200ms ease; }
  .more-bar:hover, .fold:hover { border-color: var(--dim); background: #0d0d0d; }
}
/* The caption no longer opens anything, so it loses its pointer. */
.caption { cursor: default; }

/* A single image's note, laid over the image on a see-through black. */
.note-over {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 18px 18px 56px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.72);
  color: var(--fg);
  font-size: var(--t-large);
  line-height: 1.5;
  cursor: default;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 0s 300ms;
}
.note-over p { margin: 0 0 0.9em; }
.frame.note-open .note-over { opacity: 1; visibility: visible; transition: opacity 300ms ease; }
.note-pm {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: var(--fg);
  font-size: 22px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
}
.note-pm::before { content: "+"; }
.frame.note-open .note-pm::before { content: "−"; }
@media (hover: hover) { .note-pm:hover { background: rgba(0, 0, 0, 0.85); } }

/* Tools: a way to try them, everywhere they appear. */
/* Try it, on the title's line, a little way after the title. */
.try-line { margin-left: 28px; display: inline-flex; gap: 20px; }
.try-line a { color: var(--fg); border-bottom: 1px solid var(--faint); }
.try-line a:hover { border-bottom-color: var(--fg); }
.tool-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; flex-wrap: wrap; margin: 0 0 24px; }
.tool-summary { margin: 0; font-size: 20px; line-height: 1.35; max-width: 36em; }
.sheet-text h2.sub { margin-top: 2.2em; }

/* Reposted writing reads as a column of text, not a project. */
.sheet.is-writing .sheet-text { grid-template-columns: minmax(0, 1fr); max-width: 680px; margin: 0 auto; border: 0; }

/* ── The newsletter popup (as on the coming-soon page) ──────────────── */

.panel-pop { position: relative; width: min(480px, calc(100vw - 48px)); outline: none; }
.pop-head { position: relative; display: flex; align-items: center; justify-content: center; min-height: 34px; margin-bottom: 12px; }
.pop-head .eyebrow { margin: 0; font-size: 13px; letter-spacing: 0.3em; text-indent: 0.3em; opacity: 0.75; }
.panel-pop iframe { display: block; width: 100%; height: var(--embed-height, 320px); border: 0; border-radius: 6px; background: #fff; }
.panel-pop .close {
  position: absolute; top: 50%; right: -4px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  opacity: 0.6; font-size: 24px; line-height: 1; transition: opacity 200ms ease;
}
.panel-pop .close:hover { opacity: 1; }
@media (max-width: 520px) { .panel-pop { --embed-height: 380px; } }
@media (max-height: 520px) { .panel-pop { --embed-height: calc(100dvh - 110px); } }

/* ── Narrow screens ──────────────────────────────────────────────────────
   One column. The panel becomes the top of the page and the index is
   dropped, as Nik's site does on a phone — the feed is the index there. */

@media (max-width: 860px) {
  :root { --pad: 14px; --mark: 79px; }

  .panel { position: static; width: auto; border: 0; padding-bottom: 0; }
  .spacer { display: none; }
  .menu { order: 10; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
          padding: 10px var(--pad) max(10px, env(safe-area-inset-bottom));
          background: linear-gradient(transparent, var(--bg) 45%); text-align: center; }
  .filters { margin-top: 22px; }

  .feed { margin: 0; grid-template-columns: minmax(0, 1fr); gap: 48px; padding-bottom: 90px; }
  .item, .item.is-small, .item.writing, .item.has-note { grid-column: auto; }
  /* A phone keeps the list shape with a smaller cover. */
  .writing a.card { grid-template-columns: 112px minmax(0, 1fr); column-gap: 14px; grid-template-areas: "meta meta" "cover title" "cover sub" "cover go"; }
  .writing .w-meta { margin-bottom: 10px; }
  .writing h2 { font-size: 19px; margin-top: 0; }
  .writing p { font-size: var(--t-small); }
  .with-note { flex-direction: column; gap: 12px; }
  .with-note .note { flex: none; }
  .with-note .frames { flex: none; width: 100%; }

  /* Three across is too small to read on a phone: a project's frames
     wrap, two to a row, each still at its own ratio. */

  .caption { grid-template-columns: minmax(0, 1fr) auto; }
  .caption .c-mid { display: none; }
  .item.image .caption { grid-template-columns: minmax(0, 1fr) auto auto; }
  .item.image .caption .c-mid:not(:empty) { display: block; }

  .sheet-text { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .about { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .about-text { position: static; }
  .about-text .lead { font-size: calc(var(--hero, 20px) * 0.85); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
