/* THE INCONVENIENCE — Issue 002 Spread Reader Styles
   Magazine-style two-page spread layout for desktop, vertical fallback for mobile */

:root {
  --ti-spread-width: min(1180px, calc(100vw - 48px));
  --ti-page-height: 820px;
  --ti-spread-transition: 320ms cubic-bezier(.22,.75,.18,1);
  --ti-spread-ink: #17130f;
  --ti-spread-ink-soft: #4a4037;
  --ti-spread-paper: #eee5d2;
  --ti-spread-paper-deep: #dfd2b8;
  --ti-spread-paper-light: #f7f1e5;
  --ti-spread-rule: #91816b;
  --ti-spread-accent: #6e1d18;
  --ti-spread-brass: #9b7139;
  --ti-spread-night: #15120f;
  --ti-spread-shadow: rgba(20, 14, 9, 0.28);
}

/* Spread toolbar */
.ti-spread-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 12px 0 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ti-ink-mute);
  border-bottom: 1px solid var(--ti-rule);
  margin-bottom: 1.5rem;
}

.ti-spread-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.ti-spread-meta span + span::before {
  content: '·';
  margin-right: 0.8rem;
  opacity: 0.45;
}

.ti-reader-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.ti-reader-button {
  border: 1px solid rgba(233,223,204,.34);
  color: var(--ti-ink);
  background: transparent;
  padding: 0.48rem 0.72rem;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  transition: background 0.2s ease;
}

.ti-reader-button:hover:not(:disabled) {
  background: rgba(255,255,255,.07);
}

.ti-reader-button:disabled {
  opacity: 0.32;
  cursor: default;
}

.ti-reader-progress {
  min-width: 9.5rem;
  text-align: center;
}

/* Spread shell */
.ti-spread-shell {
  width: 100%;
  padding: 0 0 36px;
  perspective: 2200px;
  position: relative;
}

.ti-spread-book {
  width: var(--ti-spread-width);
  margin: 0 auto;
  position: relative;
}

/* Page-turn arrows */
.ti-spread-arrows {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100vw - 48px);
  max-width: calc(1180px + 140px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.ti-spread-arrow {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 239, 230, 0.92);
  border: 2px solid rgba(110, 29, 24, 0.35);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
  color: var(--ti-ink);
}

.ti-spread-arrow:hover:not(:disabled) {
  background: rgba(244, 239, 230, 1);
  border-color: var(--ti-oxblood);
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), 0 3px 6px rgba(0, 0, 0, 0.2);
}

.ti-spread-arrow:focus-visible {
  outline: 2px solid var(--ti-oxblood);
  outline-offset: 3px;
}

.ti-spread-arrow:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

.ti-spread-arrow svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.5;
}

.ti-spread-arrow--prev {
  margin-left: -28px;
}

.ti-spread-arrow--next {
  margin-right: -28px;
}

/* Spread layout */
.ti-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  min-height: var(--ti-page-height);
  background: var(--ti-spread-paper);
  box-shadow: 0 30px 65px rgba(0,0,0,.46), 0 2px 5px rgba(0,0,0,.35);
  transform-style: preserve-3d;
  transform-origin: center center;
}

/* JavaScript-enhanced mode: hide all spreads except active */
.js-enabled .ti-spread {
  display: none;
}

.js-enabled .ti-spread.is-active {
  display: grid;
  animation: settle var(--ti-spread-transition) both;
}

.js-enabled .ti-spread.turn-next {
  animation: turnNext var(--ti-spread-transition) both;
}

.js-enabled .ti-spread.turn-prev {
  animation: turnPrev var(--ti-spread-transition) both;
}

@keyframes settle {
  from {
    opacity: 0.72;
    transform: rotateY(2deg) scale(.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes turnNext {
  to {
    opacity: 0;
    transform: translateX(-3%) rotateY(-8deg) scale(.985);
  }
}

@keyframes turnPrev {
  to {
    opacity: 0;
    transform: translateX(3%) rotateY(8deg) scale(.985);
  }
}

/* Page styling */
.ti-page {
  position: relative;
  min-width: 0;
  min-height: var(--ti-page-height);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(67,48,28,.05), transparent 7%, transparent 93%, rgba(67,48,28,.05)),
    var(--ti-spread-paper);
}

.ti-page--left {
  box-shadow: inset -18px 0 22px -24px rgba(35,23,12,.85);
  border-right: 1px solid rgba(63,46,30,.28);
}

.ti-page--right {
  box-shadow: inset 18px 0 22px -24px rgba(35,23,12,.85);
}

.ti-page::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(0deg, rgba(45,35,22,.055) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 30% 20%, rgba(120,90,50,.18), transparent 30%),
    radial-gradient(circle at 70% 82%, rgba(120,90,50,.12), transparent 26%);
}

/* Editorial pages */
.ti-editorial-page,
.ti-cover-copy {
  padding: 50px 54px 44px;
}

.ti-spread-kicker {
  margin: 0 0 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ti-oxblood);
}

.ti-cover-copy h1 {
  font-family: 'Times New Roman', Georgia, serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  font-size: clamp(4rem, 6vw, 6.4rem);
  line-height: 0.78;
  margin: 0.4rem 0 2rem;
}

.ti-cover-deck {
  font-size: 1.58rem;
  line-height: 1.12;
  margin: 0;
}

.ti-cover-rule {
  width: 62px;
  height: 4px;
  background: var(--ti-oxblood);
  margin: 2rem 0 1.5rem;
}

.ti-cover-lines {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.91rem;
  line-height: 1.5;
  columns: 2;
  column-gap: 1.5rem;
}

.ti-cover-lines li {
  break-inside: avoid;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(80,62,43,.22);
  margin-bottom: 0.35rem;
}

.ti-cover-footer {
  margin-top: auto;
  margin-bottom: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Article copy */
.ti-article-copy {
  font-size: 1rem;
  line-height: 1.46;
}

.ti-article-copy p {
  margin: 0 0 0.85rem;
}

.ti-article-copy--compact {
  font-size: 0.94rem;
}

.ti-article-copy strong {
  font-weight: 700;
}

/* Headings in spread context */
.ti-editorial-page h2 {
  font-family: 'Times New Roman', Georgia, serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  font-size: clamp(2.4rem, 4vw, 4.3rem);
  line-height: 0.91;
  margin: 0 0 1.8rem;
}

/* Folio marks */
.ti-folio-mark {
  position: absolute;
  bottom: 20px;
  right: 26px;
  z-index: 3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  opacity: 0.66;
}

.ti-page--left .ti-folio-mark {
  right: auto;
  left: 26px;
}

.ti-folio-mark--light {
  color: #f8eddb;
  text-shadow: 0 1px 3px #000;
  opacity: 0.88;
}

/* Full-bleed images */
.ti-full-bleed {
  background: #16120e;
}

.ti-full-bleed > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

/* Image-specific framing adjustments */

/* Build the Builder opener - show full image without cropping */
.ti-full-bleed.ti-image--opener > img {
  object-fit: contain !important;
  object-position: center center !important;
}

/* Labour Needs a Workshop - show full image without cropping */
.ti-full-bleed.ti-image--labour > img {
  object-fit: contain !important;
  object-position: center center !important;
}

/* Closing Inconvenient Truth - show walking figure and continuing workshop */
.ti-full-bleed.ti-image--closing > img {
  object-fit: contain !important;
  object-position: 40% center !important;
}

/* Memory Is Infrastructure - reframe toward records/evidence area */
.ti-image--memory > img {
  object-position: 40% center;
}

/* Autonomy Without Abdication - preserve full standing figure */
.ti-image--autonomy > img {
  object-position: center 30%;
}

/* Closing Inconvenient Truth - show walking figure and continuing workshop */
.ti-image--closing > img {
  object-position: 40% center;
}

/* Factory Must See Itself - slight refinement for oversight feel */
.ti-image--factory > img {
  object-position: center 45%;
}

/* Tools That Build Better Tools - give breathing room for workbench */
.ti-image--tools > img {
  object-position: center 40%;
}

.ti-image-caption {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  z-index: 2;
  margin: 0;
  color: #f7eddb;
  font-size: 0.72rem;
  line-height: 1.3;
  text-shadow: 0 1px 4px #000;
  padding-right: 48px;
}

.ti-full-bleed::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 68%, rgba(9,7,5,.62));
}

/* Question stack */
.ti-question-stack {
  border-top: 3px double var(--ti-ink);
  border-bottom: 3px double var(--ti-ink);
  padding: 1.25rem 0;
  margin-bottom: 2rem;
}

.ti-question-stack p {
  margin: 0;
  padding: 0.52rem 0;
  border-bottom: 1px solid rgba(55,42,27,.17);
  font-size: 1.35rem;
  font-style: italic;
}

.ti-question-stack p:last-child {
  border-bottom: 0;
}

.ti-question-final {
  color: var(--ti-oxblood);
  font-weight: 700;
  font-style: normal;
  font-size: 1.5rem;
}

/* Editor note end */
.ti-editor-note-end {
  font-size: 0.95rem;
  line-height: 1.45;
}

.ti-editor-note-end p {
  margin: 0 0 0.72rem;
}

.ti-display-line {
  font-size: 1.8rem;
  line-height: 1;
  color: var(--ti-oxblood);
}

.ti-signoff {
  margin-top: 1.3rem !important;
  font-style: italic;
}

/* Image overlay quote */
.ti-image-overlay-quote {
  position: absolute;
  left: 32px;
  top: 34px;
  z-index: 3;
  color: #f5ead7;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}

.ti-image-overlay-quote span {
  display: block;
  font: 700 0.72rem/1 ui-monospace, monospace;
  letter-spacing: 0.15em;
  margin-bottom: 0.7rem;
}

.ti-image-overlay-quote strong {
  font-size: clamp(3.2rem, 5.2vw, 5rem);
  line-height: 0.79;
  letter-spacing: -0.04em;
}

/* Margin note */
.ti-margin-note {
  margin-top: 1.4rem;
  border-left: 4px solid var(--ti-oxblood);
  padding: 0.75rem 0 0.75rem 1rem;
  color: var(--ti-ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Quote page */
.ti-quote-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ti-giant-quote {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 4.6rem);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.ti-giant-quote em {
  color: var(--ti-oxblood);
  font-style: normal;
}

.ti-ornament {
  font-size: 2rem;
  color: var(--ti-spread-brass);
  margin: 2rem 0 1rem;
}

.ti-small-note {
  max-width: 34ch;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ti-ink-soft);
}

/* Pull quote */
.ti-pullquote {
  margin: 1.4rem 0 0;
  padding: 1rem 0 0;
  border-top: 3px double var(--ti-ink);
  font-size: 1.34rem;
  line-height: 1.18;
  font-style: italic;
}

/* Final quote */
.ti-final-quote {
  margin: 1.4rem 0;
  padding: 1.2rem 0;
  border-top: 4px solid var(--ti-ink);
  border-bottom: 4px solid var(--ti-ink);
  font-size: 1.45rem;
  line-height: 1.15;
}

/* Closing line */
.ti-closing-line {
  font-size: 1.7rem;
  color: var(--ti-oxblood);
  margin: 1rem 0 0.6rem;
  font-family: 'Times New Roman', Georgia, serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.035em;
}

/* Filed under */
.ti-filed {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ti-ink-soft);
  font-family: var(--ti-sans);
}

/* No-JS reading mode: all spreads form a continuous editorial stack */
html:not(.js-enabled) .ti-spread {
  margin-bottom: 28px;
}

html:not(.js-enabled) .ti-reader-controls {
  display: none;
}

/* Mobile/tablet reading mode */
@media (max-width: 900px) {
  :root {
    --ti-spread-width: min(100% - 24px, 680px);
    --ti-page-height: auto;
  }

  .ti-spread-arrows {
    display: none;
  }

  .ti-spread-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .ti-reader-controls {
    width: 100%;
    justify-content: space-between;
  }

  .ti-reader-progress {
    min-width: 0;
  }

  .ti-spread,
  .js-enabled .ti-spread.is-active {
    display: block;
    min-height: 0;
    box-shadow: 0 20px 45px rgba(0,0,0,.36);
  }

  .js-enabled .ti-spread {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    margin-bottom: 18px;
  }

  .ti-reader-controls {
    display: none;
  }

  .ti-page {
    min-height: 0;
    overflow: visible;
  }

  .ti-full-bleed > img {
    position: static;
    min-height: 0;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .ti-editorial-page,
  .ti-cover-copy {
    padding: 38px 32px 48px;
  }

  .ti-page--left,
  .ti-page--right {
    box-shadow: none;
    border-right: 0;
    border-bottom: 1px solid rgba(63,46,30,.24);
  }

  .ti-cover-copy {
    min-height: 680px;
  }

  .ti-cover-copy h1 {
    font-size: clamp(3.7rem, 15vw, 6.2rem);
  }

  .ti-editorial-page h2 {
    font-size: clamp(2.6rem, 11vw, 4.4rem);
  }

  .ti-article-copy,
  .ti-article-copy--compact {
    font-size: 1.02rem;
    line-height: 1.55;
  }

  .ti-folio-mark {
    bottom: 16px;
  }
}

@media (max-width: 520px) {
  :root {
    --ti-spread-width: calc(100% - 12px);
  }

  .ti-spread-toolbar,
  .ti-shell {
    width: calc(100% - 24px);
  }

  .ti-cover-lines {
    columns: 1;
  }

  .ti-image-overlay-quote strong {
    font-size: 3rem;
  }

  .ti-image-caption {
    left: 16px;
    right: 16px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --ti-spread-transition: 1ms linear;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

/* Print styles for spread reader */
@media print {
  .ti-spread-toolbar,
  .ti-reader-controls,
  .ti-foot,
  .ti-skip {
    display: none !important;
  }

  .ti-spread-book {
    width: 100%;
  }

  .ti-spread,
  .js-enabled .ti-spread,
  .js-enabled .ti-spread.is-active {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    min-height: 0;
  }

  .ti-page {
    min-height: 250mm;
  }

  .ti-full-bleed > img {
    min-height: 250mm;
  }
}
