/* MORARI showcase polish (v1, 2026-11-15). Selected Work list on the homepage + the 7 work-* case pages.
   Alignment, sizes and tap targets only: no colour, font, copy, image file or section-order change.
   Linked from index.html (after grid-fix-v1.css) and from the 7 work-*.html pages, nowhere else.
   Scoped by names those pages already use: #work .work-list = homepage list; .breadcrumb, .back-cta,
   .portrait-grid, .pair, .work-section = case pages. Each rule carries the measured "before" value.
   Measured with Playwright at 390x844, 768x1024, 1440x900 (+ 1024 and 1199 for block A1). */

/* ================= A. HOMEPAGE: #work .work-list ================= */

/* A1. Tablet 721-1199px (this range was left open by grid-fix-v1, which starts at 1200px).
   Before at 768: the tag column was `auto`, so each row sized it differently: title column 266.4..321.6px,
   tag left edge 405.1..460.3 (55px ragged), 6 of 7 titles wrapped to 2 lines with one orphan word, and rows
   were 113.4px x6 vs 85.2px x1. Fix: three fixed tracks, tags on a second line under the title (the Services
   list on this page already does this on phones). Every title is one line, rows are equal, tags share one edge.
   THIS IS THE ONE VISIBLE RE-ARRANGEMENT IN THE FILE. To drop it, delete this block only. */
@media (min-width: 721px) and (max-width: 1199px) {
  #work .work-list:not(.is-carousel) a { grid-template-columns: 60px minmax(0, 1fr) 56px; row-gap: 8px; }
  #work .work-list:not(.is-carousel) .num { grid-column: 1; grid-row: 1; }
  #work .work-list:not(.is-carousel) .title { grid-column: 2; grid-row: 1; }
  #work .work-list:not(.is-carousel) .tags { grid-column: 2; grid-row: 2; }
  #work .work-list:not(.is-carousel) .year { grid-column: 3; grid-row: 1; }
}

/* A2. Phone carousel (swipe-nav.js adds .is-carousel at max-width 760px).
   Before at 390: every card was 294.2 x 148.2, but the link inside was 146.2px tall only on the two cards
   with a 2-line title and 123.1px on the other five, so the bottom 23px of five cards was not clickable.
   The year sat at y 105.2 on 2-line cards and y 82.1 on 1-line cards (23px drift from card to card).
   Fix: the link fills the card, the title row takes the free space, the year sits on the card bottom. */
#work .work-list.is-carousel li { display: flex; }
#work .work-list.is-carousel li > a { flex: 1 1 auto; min-width: 0; grid-template-rows: auto 1fr; }
#work .work-list.is-carousel li > a .title { align-self: start; }
#work .work-list.is-carousel li > a .year { align-self: end; }

/* A3. Touch screens: after a tap, li:hover stayed on, so the tapped card kept its title shifted 8px right
   until the next tap elsewhere. No hover shift where there is no hover. */
@media (hover: none) {
  #work .work-list li:hover .title { transform: none; }
}

/* A4. Hover preview used `transition: all .4s`. Same duration and curve, named properties only. */
#work .work-list .preview { transition-property: opacity, transform; }

/* A5. Keyboard focus: the rows had no focus style of their own, and in the phone carousel the browser ring
   was cut by the scroll container. Ring drawn inside the row, existing accent token. Keyboard only. */
#work .work-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* A6. Reduced motion: before, 0 prefers-reduced-motion rules covered the list (tint .35s, number .3s,
   title slide .4s, preview .4s). */
@media (prefers-reduced-motion: reduce) {
  #work .work-list li,
  #work .work-list .num,
  #work .work-list .title,
  #work .work-list .preview { transition: none; }
  #work .work-list li:hover .title { transform: none; }
  #work .work-list.is-carousel { scroll-behavior: auto; }
}

/* ================= B. CASE PAGES: work-*.html ================= */

/* B1. Aya Mori portrait grids left orphan cells. Before: 8 portraits in 3 columns at 768 = rows 3,3,2;
   10 portraits = rows 3,3,3,1 at 768 and 4,4,2 at 1440. Fix: 8 portraits always 4 across (2 full rows),
   10 portraits 5 across (2 full rows). Phones keep 2 columns (8 = 4 rows, 10 = 5 rows, no orphan).
   Browsers without :has() keep the old columns. */
@media (min-width: 701px) {
  .portrait-grid:has(> .item:nth-child(8):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .portrait-grid:has(> .item:nth-child(10):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* B2. Portrait files are 4:5 (ratio 0.80) but the cell was 3:4 (0.75) with object-fit: cover, so 6.25% of
   each portrait's width was cut off. Cell ratio now equals the file ratio: full image, no crop. */
.portrait-grid .item { aspect-ratio: 4 / 5; }

/* B3. Two-up figure pairs used align-items: start. On Looma the two recolor figures ended 1.9px apart
   (620.1 vs 622.0 at 1440, 345 vs 346 at 768). Stretch makes both cards end on one line. Pairs that were
   already equal do not change. */
.work-section .pair { align-items: stretch; }

/* B4. Keyboard focus on the two "back" links (they had none of their own). */
.breadcrumb a:focus-visible,
.back-cta a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* B5. Reduced motion on the same links (colour fade .2s). */
@media (prefers-reduced-motion: reduce) {
  .breadcrumb a, .back-cta a { transition: none; }
}

/* B6. Phone tap targets. The case pages do not load grid-fix-v1.css, so they still had the sizes that file
   fixed elsewhere. Values below are the same as grid-fix-v1; on the homepage (which loads both files) they
   change nothing. Before at 390: burger 40x34, logo link 30.6x22, menu links 17px and submenu links 36px
   tall, breadcrumb link 121.1x16.5, back link 268.3x36. */
@media (max-width: 720px) {
  .nav-burger { width: 44px; height: 44px; }
  nav.top .nav-logo-link { min-height: 44px; min-width: 44px; }
  nav.top .theme-toggle { min-height: 44px; }
  nav.top .right ul, nav.top ul .submenu { gap: 0; }
  nav.top .right ul a { display: flex; align-items: center; min-height: 44px; }

  /* 16.5px link: 44px hit area, negative margin keeps the row height as it was. */
  .breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -13.75px; }
  /* 36px link: 44px hit area, -4px margin keeps the row height as it was. */
  .back-cta a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -4px; }
}
