/*
 * Desktop layout-only prototype for the plant detail page.
 * Remove the debug block at the end when the Stamp Zone is implemented.
 */
#main.detail-page {
  --nav-zone-width: 80px;
  --stamp-zone-width: 230px;
  --zone-gap: 28px;
  --bookmark-width: 146px;
  --bookmark-height: 438px;
  --bookmark-scale: 1.37;
  --normal-bookmark-sage: #899779;
  --archival-frame-outline-width: 1px;
}

@media (min-width: 768px) and (max-width: 1199px) {
  #main.detail-page {
    --nav-zone-width: clamp(46px, calc(-22px + 8.5vw), 80px);
    --stamp-zone-width: clamp(112px, calc(-98px + 27.4vw), 230px);
    --zone-gap: clamp(8px, calc(-27.5px + 4.63vw), 28px);
    --bookmark-scale: clamp(.7, calc(-.49 + 15.5vw), 1.37);
  }
}

#main.detail-page .detail-stamp-zone-placeholder {
  display: none;
}

@media (min-width: 768px) {
  #main.detail-page .detail-content-column {
    display: grid;
    grid-template-columns:
      var(--nav-zone-width) minmax(0, 1fr) var(--stamp-zone-width);
    column-gap: var(--zone-gap);
    align-items: stretch;
  }

  #main.detail-page .detail-nav-space {
    grid-column: 1;
  }

  #main.detail-page .detail-page-content {
    grid-column: 2;
    min-width: 0;
  }

  #main.detail-page .detail-stamp-zone-placeholder {
    display: flex;
    grid-column: 3;
    min-width: 0;
    justify-content: center;
    align-items: flex-start;
    padding-top: 84px;
  }

  #main.detail-page .bookmark-sticky-wrapper {
    position: relative;
    width: var(--bookmark-width);
    height: var(--bookmark-height);
    flex: 0 0 var(--bookmark-width);
    transform: scale(var(--bookmark-scale));
    transform-origin: top center;
  }

  #main.detail-page .specimen-bookmark {
    position: relative;
    width: var(--bookmark-width);
    height: var(--bookmark-height);
    overflow: hidden;
    isolation: isolate;
    color: #27372e;
    background:
      radial-gradient(circle at 26% 18%, rgba(115, 92, 53, .045) 0 .6px, transparent .8px) 0 0 / 9px 9px,
      #f6f0e2;
    border: 1px solid rgba(105, 91, 61, .22);
    box-shadow:
      0 18px 34px rgba(45, 42, 31, .16),
      0 4px 10px rgba(45, 42, 31, .1);
    font-family: 'Cormorant Garamond', Georgia, serif;
    transform: translate3d(0, var(--bookmark-motion-y, 0px), 0);
    will-change: transform;
    --bookmark-edge-accent: #536b54;
    --bookmark-edge-line-x: 9px;
  }

  #main.detail-page .specimen-bookmark.is-type {
    --bookmark-edge-accent: #80633c;
  }

  #main.detail-page.is-bookmark-fixed-ready .bookmark-sticky-wrapper {
    position: fixed;
    z-index: 20;
    top: var(--bookmark-fixed-top);
    left: var(--bookmark-fixed-left);
    transform: translateX(-50%) scale(var(--bookmark-fixed-scale, var(--bookmark-scale)));
  }


  #main.detail-page .bookmark-edge-block,
  #main.detail-page .bookmark-edge-line {
    position: absolute;
    z-index: 7;
    display: block;
    pointer-events: none;
  }

  #main.detail-page .bookmark-edge-block {
    top: 0;
    left: 0;
    width: 16px;
    height: 24px;
    background: var(--bookmark-edge-accent);
  }

  #main.detail-page .bookmark-edge-line {
    left: var(--bookmark-edge-line-x);
    width: 1px;
  }

  #main.detail-page .bookmark-edge-line--upper {
    top: 24px;
    height: 84px;
    background: rgba(250, 244, 226, .78);
  }

  #main.detail-page .bookmark-edge-line--lower {
    top: 318px;
    height: 54px;
    background: var(--bookmark-edge-accent);
    opacity: .88;
  }

  #main.detail-page .bookmark-top {
    position: relative;
    height: 57%;
    overflow: hidden;
    background: var(--normal-bookmark-sage);
  }

  #main.detail-page .specimen-bookmark.is-type .bookmark-top {
    background: #D2B98C;
  }

  #main.detail-page .bookmark-top-texture {
    position: absolute;
    z-index: 0;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
  }

  /* Large, low-frequency pigment density variation. */
  #main.detail-page .bookmark-top-texture::before {
    content: '';
    position: absolute;
    inset: -12%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='300' viewBox='0 0 180 300' preserveAspectRatio='none'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008 .014' numOctaves='3' seed='17' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='1.45' intercept='-.2'/%3E%3CfeFuncG type='linear' slope='1.45' intercept='-.2'/%3E%3CfeFuncB type='linear' slope='1.45' intercept='-.2'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    opacity: .20;
    mix-blend-mode: soft-light;
    transform: rotate(-2deg) scale(1.08);
  }

  /* Medium, irregular cloudy pigment pooling. */
  #main.detail-page .bookmark-top-texture::after {
    content: '';
    position: absolute;
    inset: -8%;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='280' viewBox='0 0 170 280' preserveAspectRatio='none'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.026 .041' numOctaves='3' seed='41'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E") center / 100% 100% no-repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='260' viewBox='0 0 160 260' preserveAspectRatio='none'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.48 .62' numOctaves='2' seed='73'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    background-blend-mode: soft-light;
    opacity: .12;
    mix-blend-mode: soft-light;
    transform: rotate(1.5deg) scale(1.06);
  }

  #main.detail-page .bookmark-ghost-botanical {
    position: absolute;
    z-index: 1;
    left: -42px;
    bottom: -54px;
    width: 228px;
    max-width: none;
    opacity: .065;
    mix-blend-mode: multiply;
    filter: saturate(.48) brightness(.72) hue-rotate(8deg);
    transform: rotate(-3deg);
    transform-origin: center;
    pointer-events: none;
    user-select: none;
  }

  #main.detail-page .specimen-bookmark.is-type .bookmark-ghost-botanical {
    opacity: .06;
    filter: sepia(.34) saturate(.58) brightness(.76) hue-rotate(350deg);
  }

  #main.detail-page .bookmark-top::before,
  #main.detail-page .bookmark-top::after {
    --diagonal-left: 100%;
    --diagonal-right: 2%;
    content: '';
    position: absolute;
    left: 0;
    right: -1px;
    bottom: -1px;
    height: 70px;
    background: #f6f0e2;
    backface-visibility: hidden;
    transform: translateZ(0);
  }

  #main.detail-page .bookmark-top::before {
    z-index: 3;
    clip-path: polygon(0 calc(var(--diagonal-left) - 4px),
        100% max(0px, calc(var(--diagonal-right) - 4px)),
        100% 100%,
        0 100%);
  }

  #main.detail-page .bookmark-top::after {
    z-index: 4;
    clip-path: polygon(0 calc(var(--diagonal-left) - 2px),
        100% max(0px, calc(var(--diagonal-right) - 2px)),
        100% 100%,
        0 100%);
  }

  #main.detail-page .bookmark-heading {
    position: absolute;
    z-index: 6;
    top: 27px;
    left: 18px;
    text-transform: uppercase;
  }

  #main.detail-page .bookmark-heading--normal {
    display: grid;
    gap: 2px;
    color: rgba(255, 255, 255, .9);
    font-size: 12px;
    line-height: 1.25;
    letter-spacing: .18em;
  }

  #main.detail-page .bookmark-heading--type {
    display: none;
    right: 27px;
    color: #332715;
  }

  #main.detail-page .specimen-bookmark.is-type .bookmark-heading--normal {
    display: none;
  }

  #main.detail-page .specimen-bookmark.is-type .bookmark-heading--type {
    display: grid;
  }

  #main.detail-page .bookmark-type-label {
    font-size: 9px;
    line-height: 1;
    letter-spacing: .16em;
    white-space: nowrap;
  }

  #main.detail-page .bookmark-type-status {
    max-width: none;
    margin-top: 9px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .015em;
    white-space: nowrap;
  }

  #main.detail-page .bookmark-status-rule {
    width: 31px;
    height: 1px;
    margin-top: 11px;
    background: rgba(75, 55, 29, .58);
  }

  #main.detail-page .bookmark-number-vertical {
    position: absolute;
    z-index: 6;
    top: 17px;
    right: 0;
    color: rgba(255, 249, 229, .55);
    font-size: 46px;
    font-weight: 400;
    line-height: 1;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }

  #main.detail-page .bookmark-botanical {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    user-select: none;
  }

  #main.detail-page .bookmark-botanical--top {
    left: -74px;
    bottom: -72px;
    width: 218px;
    max-width: none;
  }

  #main.detail-page .bookmark-center {
    position: absolute;
    z-index: 6;
    top: 170px;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  #main.detail-page .bookmark-small-divider {
    display: block;
    width: 24px;
    height: 1px;
    margin: 4px auto 0;
    background: #b68b3d;
  }

  #main.detail-page .bookmark-bottom {
    position: absolute;
    z-index: 3;
    inset: 57% 0 0;
  }

  #main.detail-page .bookmark-quote {
    margin: 16px 0 0;
    color: #4a554b;
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: .12em;
    text-transform: uppercase;
    width: 180%;
    transform: scale(.56);
    transform-origin: top center;
  }

  #main.detail-page .bookmark-botanical--bottom {
    z-index: 2;
    left: -20px;
    bottom: -62px;
    width: 176px;
    max-width: none;
  }
}
@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  #main.detail-page .bookmark-motion-layer {
    transform: none !important;
    will-change: auto;
  }
}
