/* OIIOIII motion trial v1. No content reveal, image effects, or permanent layers. */
html[data-motion="on"] {
  --motion-press: 120ms;
  --motion-feedback: 180ms;
  --motion-change: 240ms;
  --motion-ease: cubic-bezier(.2,.7,.2,1);
  --motion-step: 4px;
}

/* Existing focus outlines remain instantaneous and independent of animation. */
html[data-motion="on"] :is(.button,.ed-button,.footer-wechat,.theme-picker summary,.pagination a):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 5px;
}

@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] :is(.button,.ed-button,.footer-wechat,.theme-picker summary,.pagination a,.banner-page-buttons button) {
    transition: transform var(--motion-press) var(--motion-ease);
  }
  html[data-motion="on"] :is(.button,.ed-button,.footer-wechat,.theme-picker summary,.pagination a,.banner-page-buttons button):active {
    transform: scale(.98);
  }

  /* Persistent underline keeps links identifiable before interaction. */
  html[data-motion="on"] :is(.text-link,.footer-platform-links a,.site-header nav a) {
    position: relative;
  }
  html[data-motion="on"] .text-link { text-decoration: none; }
  html[data-motion="on"] .text-link::after,
  html[data-motion="on"] :is(.text-link,.footer-platform-links a,.site-header nav a)::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 5px;
    height: 1px;
    background: var(--link-line);
    pointer-events: none;
  }
  html[data-motion="on"] :is(.text-link,.footer-platform-links a,.site-header nav a)::before {
    z-index: 1;
    background: var(--blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--motion-feedback) var(--motion-ease);
  }
  html[data-motion="on"] .site-header nav a::before { bottom: -1px; height: 3px; }
  html[data-motion="on"] :is(.text-link,.footer-platform-links a,.site-header nav a):focus-visible::before {
    transform: scaleX(1);
  }

  /* Use only the arrow that is already a separate, decorative element. */
  html[data-motion="on"] .channel-entries i {
    transition: transform var(--motion-feedback) var(--motion-ease);
  }
  html[data-motion="on"] .channel-entries a:focus-visible i { transform: translate(2px,-2px); }

  html[data-motion="on"] .theme-picker[open] .theme-panel {
    animation: oiioiii-panel-in var(--motion-feedback) var(--motion-ease);
  }
  html[data-motion="on"] .original-toc button { position: relative; }
  html[data-motion="on"] .original-toc button::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: 5px;
    width: 20px;
    height: 2px;
    background: var(--blue);
    opacity: 0;
    transform: scaleX(.25);
    transform-origin: left;
    transition: transform var(--motion-feedback) var(--motion-ease), opacity var(--motion-feedback) var(--motion-ease);
    pointer-events: none;
  }
  html[data-motion="on"] .original-toc button[aria-current]::after {
    opacity: 1;
    transform: scaleX(1);
  }
  /* The existing banner changes indicator width; never animate its layout. */
  html[data-motion="on"] .banner-page-buttons i { transition: none; }

  @media (hover: hover) and (pointer: fine) {
    html[data-motion="on"] :is(.text-link,.footer-platform-links a,.site-header nav a):hover::before {
      transform: scaleX(1);
    }
    html[data-motion="on"] .channel-entries a:hover i { transform: translate(2px,-2px); }
  }
}

@keyframes oiioiii-panel-in {
  from { opacity: 0; transform: translateY(var(--motion-step,4px)); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  /* Includes the legacy stylesheet's smooth scrolling and existing transitions. */
  html, .original-toc nav { scroll-behavior: auto !important; }
  html[data-motion="on"] { --motion-press: 0ms; --motion-feedback: 0ms; --motion-change: 0ms; }
  html[data-motion="on"] :is(.site-header nav a,.editorial .ed-button,.card-picture img,.banner-page-buttons i,.theme-panel,.original-toc nav) {
    transition: none !important;
    animation: none !important;
  }
}

@media (forced-colors: active) {
  html[data-motion="on"] .text-link { text-decoration: underline; }
  html[data-motion="on"] .text-link::before,
  html[data-motion="on"] .text-link::after { content: none; }
}

/* Compact footer trial. Applied independently of the motion preference. */
.site-footer {
  padding: 28px max(48px,calc((100vw - 1504px)/2)) 16px;
}
.site-footer .footer-top {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1.1fr) minmax(0,.85fr);
  align-items: start;
  gap: 24px 32px;
}
.site-footer .footer-top > p {
  grid-column: auto;
  margin: 0;
  font-size: 22px;
  line-height: 1.65;
}
.site-footer .footer-top > .footer-platforms {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 8px;
  min-width: 0;
}
.site-footer .footer-platforms h2,
.site-footer .footer-contact h2 {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
}
.site-footer .footer-platform-links {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  align-items: center;
  gap: 0 8px;
}
.site-footer .footer-platform-links a {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  justify-self: start;
}
.site-footer .footer-contact {
  grid-column: auto;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}
.site-footer .footer-contact-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.site-footer .footer-wechat,
.site-footer .footer-email {
  min-height: 44px;
  padding: 8px 0;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.site-footer .footer-contact-status {
  min-height: 22px;
  margin: 0;
  font-size: 12px;
  line-height: 22px;
}
.site-footer .footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 12px;
  font-size: 11px;
  line-height: 1.6;
}
.site-footer .footer-bottom > span:last-child { width: auto; }

@media (min-width:600px) and (max-width:1099px) {
  .site-footer { padding: 24px 32px 16px; }
  .site-footer .footer-top {
    grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
    gap: 18px 28px;
  }
  .site-footer .footer-top > p { grid-column: 1 / -1; font-size: 21px; }
  .site-footer .footer-platform-links { gap: 0 5px; }
  .site-footer .footer-platform-links a { font-size: 13px; }
}

@media (max-width:599px) {
  .site-footer { padding: 22px 22px 14px; }
  .site-footer .footer-top { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .site-footer .footer-top > p { grid-column: auto; font-size: 20px; line-height: 1.6; }
  .site-footer .footer-top > .footer-platforms { grid-template-columns: minmax(0,1fr); gap: 6px; }
  .site-footer .footer-platform-links { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0 6px; }
  .site-footer .footer-platform-links a { font-size: 13px; }
  .site-footer .footer-bottom { margin-top: 14px; padding-top: 10px; font-size: 11px; }
}

@media (max-width:359px) {
  .site-footer { padding-left: 16px; padding-right: 16px; }
  .site-footer .footer-platform-links { gap: 0 4px; }
}

/* Local layout refinements: keep original words, covers and image proportions. */

/* The existing editor-picks grid has two columns only from 761 to 1100px. */
@media (min-width:761px) and (max-width:1100px) {
  .editor-picks > .editor-pick:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .editor-picks > .editor-pick:last-child:nth-child(odd) > .card {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    align-items: start;
    gap: 28px;
  }
  .editor-picks > .editor-pick:last-child:nth-child(odd) .card-picture {
    margin-bottom: 0;
    align-self: start;
  }
  .editor-picks > .editor-pick:last-child:nth-child(odd) .card-picture img {
    object-fit: contain;
  }
  .editor-picks > .editor-pick:last-child:nth-child(odd) > .card > .card-copy {
    align-self: stretch;
    min-width: 0;
  }
  .editor-picks > .editor-pick:last-child:nth-child(odd) > .card .bottom {
    padding-top: 16px;
  }
}

/* Only the homepage contains this direct child; other pages keep their spacing. */
main:has(> .closing-statement) { padding-bottom: 56px; }
main > .closing-statement {
  margin-top: 64px;
  padding: 32px 0 0;
}

@media (min-width:761px) {
  main > .closing-statement {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-rows: auto auto auto;
    gap: 14px clamp(28px,4vw,64px);
    align-items: start;
  }
  main > .closing-statement > .eyebrow {
    grid-column: 1 / -1;
    margin: 0 0 4px;
  }
  main > .closing-statement > h2 {
    grid-column: 1;
    grid-row: 2 / span 2;
    margin: 0;
    font-size: clamp(30px,3.1vw,43px);
    line-height: 1.5;
  }
  main > .closing-statement > p:not(.eyebrow) {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    line-height: 1.85;
  }
  main > .closing-statement > .text-link {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
    align-self: start;
    margin: 0;
  }
}

@media (max-width:760px) {
  .editor-picks { display: grid; grid-template-columns: minmax(0,1fr); gap: 28px; }
  .editor-picks > .editor-pick { margin-bottom: 0; }
  .editor-picks > .editor-pick > .pick-question { margin-bottom: 16px; padding-bottom: 12px; }
  .editor-picks > .editor-pick > .card .bottom { padding-top: 16px; }
  main:has(> .closing-statement) { padding-bottom: 32px; }
  main > .closing-statement { margin-top: 40px; padding-top: 24px; }
  main > .closing-statement > .eyebrow { margin-bottom: 14px; }
  main > .closing-statement > h2 { font-size: 30px; line-height: 1.5; }
  main > .closing-statement > p:not(.eyebrow) { margin: 16px 0 8px; }
}

/* Homepage recommendations: equal content rows, original covers, compact reading. */
.home-work-grid,
.home-podcast-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 16px 32px;
}
.home-work-card,
.home-podcast-card,
.home-podcast-copy { min-width: 0; }
.home-work-card {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 14px;
}
.home-work-cover,
.home-podcast-cover {
  display: block;
  min-width: 0;
  overflow: hidden;
  background: transparent;
}
.home-work-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: color-mix(in srgb,var(--ink) 5%,var(--paper));
  margin-bottom: 6px;
}
.home-work-cover img,
.home-podcast-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.home-work-card > .meta,
.home-podcast-copy > .eyebrow {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}
.home-work-card > h3,
.home-podcast-copy > h3 {
  margin: 0;
  font-weight: 550;
  letter-spacing: -.015em;
  line-height: 1.5;
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.home-work-card > h3 { font-size: clamp(23px,2.1vw,29px); }
.home-work-card > h3 > a,
.home-podcast-copy > h3 > a {
  display: block;
  min-height: 44px;
}
.home-work-section .home-card-deck,
.home-podcast-section .home-card-deck {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: break-word;
}
.home-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  margin: 0;
}
.home-card-actions > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 14px;
  line-height: 1.65;
}

/* Five shared rows align metadata, headings, decks and actions at every width. */
@media (min-width:761px) {
  @supports (grid-template-rows: subgrid) {
    .home-work-card {
      grid-row: span 5;
      grid-template-rows: subgrid;
      row-gap: 14px;
    }
  }
  /* The wrapper has no visual box; older browsers share the same five tracks. */
  @supports not (grid-template-rows: subgrid) {
    .home-work-card { display: contents; }
    .home-work-card:nth-child(1) > * { grid-column: 1; }
    .home-work-card:nth-child(2) > * { grid-column: 2; }
    .home-work-card > :nth-child(1) { grid-row: 1; }
    .home-work-card > :nth-child(2) { grid-row: 2; }
    .home-work-card > :nth-child(3) { grid-row: 3; }
    .home-work-card > :nth-child(4) { grid-row: 4; }
    .home-work-card > :nth-child(5) { grid-row: 5; }
  }
}

.home-series-link {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 4px 28px;
  margin-top: 28px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
.home-series-link > .meta { grid-column: 1; font-size: 12px; }
.home-series-link > strong { grid-column: 1; font-size: 22px; font-weight: 500; line-height: 1.5; }
.home-series-action {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 14px;
  white-space: nowrap;
}

.home-podcast-grid { align-items: stretch; }
.home-podcast-card {
  display: grid;
  grid-template-columns: clamp(100px,10.5vw,140px) minmax(0,1fr);
  align-items: start;
  gap: 20px;
}
.home-podcast-cover { width: 100%; aspect-ratio: 1; }
.home-podcast-copy {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 12px;
}
.home-podcast-copy > h3 { font-size: clamp(21px,1.8vw,25px); }
.home-podcast-copy > .home-card-actions { margin-top: auto; padding-top: 2px; gap: 0 20px; }
.home-podcast-recent {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 0 32px;
  border-top: 1px solid var(--line);
  margin-top: 28px;
}
.home-podcast-recent > a {
  display: grid;
  grid-template-columns: minmax(0,1fr) 20px;
  align-content: start;
  gap: 7px 16px;
  min-width: 0;
  min-height: 44px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.home-podcast-recent > a > .meta { grid-column: 1; font-size: 12px; }
.home-podcast-recent h3 { grid-column: 1; font-size: 18px; font-weight: 500; line-height: 1.6; }
.home-podcast-recent i { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-size: 20px; }

@media (min-width:761px) and (max-width:1099px) {
  .home-work-grid,
  .home-podcast-grid,
  .home-podcast-recent { column-gap: 28px; }
  .home-podcast-card { grid-template-columns: clamp(100px,11vw,120px) minmax(0,1fr); gap: 16px; }
  .home-podcast-copy > h3 { font-size: 21px; }
  .home-podcast-section .home-card-deck { font-size: 14px; }
}

@media (max-width:760px) {
  .home-work-grid,
  .home-podcast-grid { grid-template-columns: minmax(0,1fr); gap: 30px; }
  .home-work-card { gap: 12px; }
  .home-work-cover { margin-bottom: 3px; }
  .home-work-card > h3 { font-size: 23px; line-height: 1.55; }
  .home-work-section .home-card-deck,
  .home-podcast-section .home-card-deck { font-size: 16px; }
  .home-card-actions { gap: 2px 22px; }
  .home-series-link { margin-top: 24px; gap: 4px 16px; padding: 16px 0; }
  .home-series-link > strong { font-size: 19px; }
  .home-series-action { font-size: 13px; }

  /* Title sits beside the small cover; the full-width deck avoids a narrow column. */
  .home-podcast-card {
    grid-template-columns: clamp(100px,28vw,120px) minmax(0,1fr);
    gap: 10px 18px;
  }
  .home-podcast-card + .home-podcast-card { border-top: 1px solid var(--line); padding-top: 24px; }
  .home-podcast-copy { display: contents; }
  .home-podcast-cover { grid-column: 1; grid-row: 1 / span 2; }
  .home-podcast-copy > .eyebrow { grid-column: 2; grid-row: 1; align-self: end; }
  .home-podcast-copy > h3 { grid-column: 2; grid-row: 2; font-size: 22px; line-height: 1.5; }
  .home-podcast-copy > .home-card-deck { grid-column: 1 / -1; grid-row: 3; margin-top: 4px; }
  .home-podcast-copy > .home-card-actions { grid-column: 1 / -1; grid-row: 4; margin: 0; padding: 0; }
  .home-podcast-recent { grid-template-columns: minmax(0,1fr); margin-top: 24px; }
  .home-podcast-recent > a { padding: 16px 0; }
}

@media (max-width:359px) {
  .home-podcast-card { column-gap: 14px; }
  .home-podcast-copy > h3 { font-size: 20px; }
  .home-series-link { grid-template-columns: minmax(0,1fr); }
  .home-series-action { grid-column: 1; grid-row: auto; margin-top: 4px; }
}
