/* Gatehouse letter page — progressive enhancement: readable without JavaScript. */
.gh-letter-page{background:#f6f1e9}
.gh-letter-scene{padding:clamp(60px,8vw,140px) 20px clamp(90px,10vw,160px);overflow:clip;background:radial-gradient(ellipse at 52% 30%,#fffaf0 0%,#f6f1e9 70%)}
.gh-letter-stage{max-width:920px;margin:0 auto;perspective:1400px}
.gh-letter-sheet{max-width:780px;margin:auto;transform:rotate(-2deg);transform-origin:50% 20%;transition:transform 1s cubic-bezier(.22,1,.36,1)}
.gh-letter-paper{position:relative;background:#fffdf7;box-shadow:0 28px 65px rgba(27,48,50,.16),0 2px 8px rgba(27,48,50,.08);padding:clamp(35px,6vw,85px);color:#203734;line-height:1.85;min-height:320px;border:1px solid #e7ded1}
.gh-letter-paper:before{content:"";position:absolute;inset:13px;border:1px solid rgba(146,127,105,.14);pointer-events:none}
.gh-letter-fold{height:110px;background:#f3e9d9;border:1px solid #e7ded1;box-shadow:0 8px 15px rgba(0,0,0,.05);transform-origin:bottom center;transition:transform 1s cubic-bezier(.22,1,.36,1),opacity .5s ease;position:relative;z-index:2;margin-bottom:-2px;clip-path:polygon(0 0,100% 0,50% 100%)}
.gh-letter-emblem{font-family:Georgia,serif;font-size:38px;line-height:1;color:#a82632;margin-bottom:25px}
.gh-letter-heading{font-size:clamp(1.7rem,3vw,2.6rem);line-height:1.2;color:#203734;margin:0 0 25px}
.gh-letter-body>*:first-child{margin-top:0}.gh-letter-body>*:last-child{margin-bottom:0}
.gh-letter-signoff{margin:35px 0 0}.gh-letter-signature{font-family:Georgia,serif;font-style:italic;font-size:1.45rem;margin:5px 0 0}
.gh-letter-page--nursery .gh-letter-sheet{transform:rotate(2deg)}
.gh-letter-page--nursery .gh-letter-emblem{color:#bc3443}
/* Only apply concealed entry state when JavaScript has attached the observer. */
.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed){transform:translateY(85px) rotate(-6deg) scale(.93)}
.gh-letter-js .gh-letter-page--nursery .gh-letter-sheet:not(.gh-letter-revealed){transform:translateY(85px) rotate(6deg) scale(.93)}
.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-fold{transform:rotateX(-10deg)}
.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-paper{opacity:.5;transition:opacity .8s ease}
.gh-letter-js .gh-letter-sheet.gh-letter-revealed .gh-letter-fold{transform:rotateX(-175deg);opacity:0;pointer-events:none}
.gh-letter-js .gh-letter-sheet.gh-letter-revealed .gh-letter-paper{opacity:1;transition:opacity .7s ease .25s}
@media(max-width:650px){.gh-letter-scene{padding:45px 8px 80px}.gh-letter-paper{padding:35px 28px}.gh-letter-fold{height:65px}.gh-letter-sheet,.gh-letter-page--nursery .gh-letter-sheet{transform:rotate(0deg)}}
@media(prefers-reduced-motion:reduce){.gh-letter-sheet,.gh-letter-fold,.gh-letter-paper{transition:none!important;animation:none!important}.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed){transform:none!important}.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-paper{opacity:1!important}}

.gh-letter-stage{position:relative;max-width:1100px;padding-right:clamp(0px,8vw,110px)}
.gh-letter-portrait{position:absolute;right:-1%;top:20%;z-index:4;width:clamp(155px,25vw,300px);margin:0;pointer-events:none;transform:rotate(7deg);filter:drop-shadow(0 16px 20px rgba(25,34,30,.18))}
.gh-letter-portrait img{width:100%;height:auto;display:block;object-fit:cover}
.gh-letter-portrait--polaroid{background:#fff;padding:11px 11px 35px;box-shadow:0 13px 36px rgba(0,0,0,.17)}
.gh-letter-portrait--polaroid img{aspect-ratio:4/5}
.gh-letter-portrait--crest img{aspect-ratio:4/5;clip-path:polygon(50% 0%,91% 12%,91% 65%,80% 82%,50% 100%,20% 82%,9% 65%,9% 12%);border-radius:8%}
.gh-letter-emblem img{display:block;width:auto;max-width:88px;max-height:92px;object-fit:contain}
.gh-letter-followup{background:#fff;padding:clamp(50px,7vw,110px) 24px}.gh-letter-followup-inner{max-width:960px;margin:auto}
@media(max-width:750px){.gh-letter-stage{padding-right:0}.gh-letter-portrait{position:relative;top:auto;right:auto;width:min(52%,235px);margin:-25px 4% 10px auto;transform:rotate(5deg)}.gh-letter-paper{padding:35px 28px}.gh-letter-portrait--polaroid{padding:8px 8px 25px}}

/* Extra photographs: naturally scattered around the sheet, without hiding text on mobile. */
.gh-letter-extra{width:clamp(110px,17vw,195px);top:auto;right:auto}.gh-letter-extra--1{left:-3%;top:5%;transform:rotate(-11deg)}.gh-letter-extra--2{right:-5%;top:56%;transform:rotate(12deg)}.gh-letter-extra--3{left:-4%;top:62%;transform:rotate(8deg)}.gh-letter-extra--4{right:2%;top:3%;transform:rotate(-8deg)}.gh-letter-extra--5{left:18%;bottom:-35px;transform:rotate(-5deg)}
@media(max-width:850px){.gh-letter-extra{position:relative!important;display:inline-block;width:clamp(105px,30%,175px);inset:auto!important;margin:12px 2%;vertical-align:top}.gh-letter-stage{overflow:visible}}

/* v8.0 — keep photos in the available column and prevent letter text occlusion */
.gh-letter-scene{overflow:hidden}
.gh-letter-stage{box-sizing:border-box;padding-right:0!important;padding-left:0!important;width:100%;max-width:100%}
.gh-letter-sheet{box-sizing:border-box;width:min(100%,780px);max-width:100%;margin-inline:auto}
.gh-letter-portrait:not(.gh-letter-extra){right:0;top:16%;width:clamp(120px,20%,210px);transform:translateX(0) rotate(7deg)}
.gh-letter-paper{padding-right:clamp(55px,14%,125px)}
.gh-letter-extra--1{left:0}.gh-letter-extra--2{right:0}.gh-letter-extra--3{left:0}.gh-letter-extra--4{right:0}
@media(min-width:851px){.gh-info-layout--with-sidebar .gh-letter-portrait:not(.gh-letter-extra){width:clamp(115px,20%,185px);right:0;top:10%}.gh-info-layout--with-sidebar .gh-letter-paper{padding-right:clamp(90px,22%,175px)}}
@media(max-width:850px){.gh-letter-portrait:not(.gh-letter-extra){position:relative;inset:auto;width:min(48%,215px);margin:-12px 3% 10px auto;transform:rotate(5deg)}.gh-letter-paper{padding-right:28px}}

/* v8.1 — no clipping of Polaroid frames or drop shadows */
.gh-letter-page .gh-letter-scene{overflow:visible!important;overflow-x:visible!important;isolation:isolate}
.gh-letter-page .gh-letter-stage{overflow:visible!important;isolation:isolate}
.gh-letter-page .gh-letter-portrait{filter:none!important;box-shadow:0 15px 34px rgba(25,34,30,.18),0 5px 12px rgba(25,34,30,.09)}
.gh-letter-page .gh-letter-portrait--crest{box-shadow:none;filter:drop-shadow(0 12px 16px rgba(25,34,30,.15))!important}
.gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){right:clamp(16px,3vw,44px)!important}
/* Mobile: retain warm background, but show readable text rather than a paper object. */
@media(max-width:750px){
 .gh-letter-page,.gh-letter-page .gh-letter-scene,.gh-letter-page .gh-info-layout{background:#f6f1e9!important}
 .gh-letter-page .gh-letter-scene{padding:22px 0 32px!important;background-image:none!important}
 .gh-letter-page .gh-letter-stage{padding:0!important;perspective:none!important}
 .gh-letter-page .gh-letter-sheet,.gh-letter-page--nursery .gh-letter-sheet,.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed){transform:none!important;transition:none!important;width:100%!important;max-width:100%!important}
 .gh-letter-page .gh-letter-fold{display:none!important}
 .gh-letter-page .gh-letter-paper,.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-paper{background:transparent!important;border:0!important;box-shadow:none!important;opacity:1!important;transition:none!important;min-height:0!important;padding:16px 10px 22px!important}
 .gh-letter-page .gh-letter-paper:before{display:none!important}
 .gh-letter-page .gh-letter-emblem{margin-bottom:22px}
 .gh-letter-page .gh-letter-heading{font-size:clamp(1.85rem,7vw,2.55rem);line-height:1.2}
 .gh-letter-page .gh-letter-body{font-size:1rem;line-height:1.75}
 .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){right:auto!important;margin:20px auto 26px!important;transform:rotate(3deg)!important}
 .gh-letter-page .gh-letter-extra{margin:14px 3%!important}
}

/* v8.2 — letter aligned with sidebar, tighter stationery and a visible unfolding sequence */
@media (min-width:851px){
 .gh-info-layout--letter{padding-top:36px!important;align-items:start}
 .gh-info-layout--letter .gh-letter-scene{padding:0 28px 58px 12px!important}
 .gh-info-layout--letter .gh-letter-stage{margin-top:0!important}
 .gh-info-layout--letter .gh-letter-sheet{margin-top:0!important}
 .gh-info-layout--letter .gh-letter-paper{padding:clamp(34px,3.5vw,54px) clamp(46px,5vw,74px)!important;padding-right:clamp(115px,19%,180px)!important}
 .gh-info-layout--letter .gh-letter-emblem{margin-bottom:16px}
 .gh-info-layout--letter .gh-letter-heading{margin-bottom:20px}
 .gh-info-layout--letter .gh-letter-signoff{margin-top:22px}
}
/* The fold overlays the sheet rather than reserving a blank 110px strip. */
.gh-letter-sheet{position:relative;transition:transform 2.3s cubic-bezier(.18,.78,.22,1)!important}
.gh-letter-fold{position:absolute;top:0;left:0;width:100%;height:95px;margin:0;z-index:3;transition:transform 2.2s cubic-bezier(.2,.72,.22,1) .25s,opacity .8s ease 1.6s!important;backface-visibility:hidden}
.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-fold{transform:rotateX(0deg)!important;opacity:1}
.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed){transform:translateY(46px) rotate(-5deg) scale(.97)}
.gh-letter-js .gh-letter-page--nursery .gh-letter-sheet:not(.gh-letter-revealed){transform:translateY(46px) rotate(5deg) scale(.97)}
.gh-letter-js .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-paper{opacity:.55;transition:opacity 1.3s ease!important}
.gh-letter-js .gh-letter-sheet.gh-letter-revealed .gh-letter-paper{opacity:1;transition:opacity 1.5s ease .65s!important}
@media(max-width:850px){.gh-info-layout--letter .gh-letter-scene{padding-top:8px!important}}
@media(max-width:750px){.gh-letter-sheet,.gh-letter-fold,.gh-letter-paper{transition:none!important}}
@media(prefers-reduced-motion:reduce){.gh-letter-sheet,.gh-letter-fold,.gh-letter-paper{transition:none!important}}

/* v8.3 — paper turns and grows instead of unfolding; stronger portrait presence. */
.gh-letter-page .gh-letter-fold{display:none!important}
@media(min-width:851px){
 .gh-letter-page .gh-letter-sheet{transform:rotate(-1.5deg) scale(1);transform-origin:50% 10%;transition:transform 2.7s cubic-bezier(.16,.75,.18,1)!important}
 .gh-letter-page--nursery .gh-letter-sheet{transform:rotate(1.5deg) scale(1)}
 .gh-letter-js .gh-letter-page .gh-letter-sheet:not(.gh-letter-revealed){transform:translateY(28px) rotate(-9deg) scale(.78)!important}
 .gh-letter-js .gh-letter-page--nursery .gh-letter-sheet:not(.gh-letter-revealed){transform:translateY(28px) rotate(9deg) scale(.78)!important}
 .gh-letter-js .gh-letter-page .gh-letter-sheet:not(.gh-letter-revealed) .gh-letter-paper{opacity:.8!important}
 .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra),.gh-info-layout--with-sidebar .gh-letter-portrait:not(.gh-letter-extra){width:clamp(195px,28%,295px)!important;right:clamp(2px,2vw,22px)!important;top:9%!important}
 .gh-info-layout--letter .gh-letter-paper{padding-right:clamp(125px,24%,215px)!important}
}
@media(min-width:751px) and (max-width:850px){.gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){width:clamp(180px,27%,260px)!important}}
@media(prefers-reduced-motion:reduce){.gh-letter-page .gh-letter-sheet{transform:none!important;transition:none!important}}

/* v8.4 — reliable, visible turn-and-grow entrance; no envelope folding. */
@media (min-width:751px) and (prefers-reduced-motion:no-preference) {
  .gh-letter-page .gh-letter-sheet.gh-letter-awaiting {
    transform:translateY(55px) rotate(-10deg) scale(.78)!important;
    opacity:.72!important;
    transition:none!important;
  }
  .gh-letter-page--nursery .gh-letter-sheet.gh-letter-awaiting {
    transform:translateY(55px) rotate(10deg) scale(.78)!important;
  }
  .gh-letter-page .gh-letter-sheet.gh-letter-animating {
    animation:gh-letter-turn-grow 3.1s cubic-bezier(.19,.7,.22,1) both!important;
    transition:none!important;
  }
  .gh-letter-page--nursery .gh-letter-sheet.gh-letter-animating {
    animation-name:gh-letter-turn-grow-nursery!important;
  }
  @keyframes gh-letter-turn-grow {
    0%{transform:translateY(55px) rotate(-10deg) scale(.78);opacity:.72}
    45%{opacity:1}
    100%{transform:translateY(0) rotate(-1.5deg) scale(1);opacity:1}
  }
  @keyframes gh-letter-turn-grow-nursery {
    0%{transform:translateY(55px) rotate(10deg) scale(.78);opacity:.72}
    45%{opacity:1}
    100%{transform:translateY(0) rotate(1.5deg) scale(1);opacity:1}
  }
}
/* Place the portrait OUTSIDE the paper's right edge, rather than over the text.
   Reserve a right-side photo gutter so shadows remain visible in the viewport. */
@media (min-width:851px) {
  .gh-info-layout--letter .gh-letter-scene{padding-right:clamp(90px,12vw,170px)!important;overflow:visible!important}
  .gh-info-layout--letter .gh-letter-stage{position:relative;overflow:visible!important}
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra),
  .gh-info-layout--with-sidebar .gh-letter-portrait:not(.gh-letter-extra){
    width:clamp(205px,25vw,295px)!important;
    right:clamp(-130px,-9vw,-75px)!important;
    top:8%!important;
    transform:rotate(7deg)!important;
    z-index:5;
  }
  .gh-info-layout--letter .gh-letter-paper{padding-right:clamp(46px,5vw,74px)!important}
}
@media (min-width:751px) and (max-width:850px){
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){right:-38px!important;top:8%!important}
}
@media (max-width:750px){
  .gh-letter-page .gh-letter-sheet{animation:none!important;opacity:1!important}
}

/* v8.5: reserve a genuine photo rail OUTSIDE the paper, never above body copy.
   Previous right:-130px was relative to the full-width stage, not the paper edge. */
@media(min-width:851px){
 .gh-letter-page .gh-letter-stage{
   display:grid!important;grid-template-columns:minmax(0,1fr) clamp(220px,23vw,310px)!important;
   align-items:start!important;column-gap:0!important;
   padding:0!important;max-width:none!important;overflow:visible!important;
 }
 .gh-letter-page .gh-letter-sheet{grid-column:1!important;grid-row:1!important;
   width:100%!important;max-width:none!important;margin:0!important;min-width:0!important;}
 .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){
   position:relative!important;grid-column:2!important;grid-row:1!important;
   width:clamp(220px,23vw,310px)!important;max-width:100%!important;
   top:clamp(50px,7vw,105px)!important;right:auto!important;left:auto!important;
   margin:0 0 0 -18px!important;transform:rotate(7deg)!important;z-index:6!important;
 }
 .gh-letter-page .gh-letter-paper{padding-right:clamp(38px,4vw,65px)!important;}
 .gh-letter-page .gh-letter-extra{grid-column:2;grid-row:1;}
}
/* On mid-size screens, avoid forcing the portrait across the narrower text. */
@media(min-width:751px) and (max-width:850px){
 .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){position:relative!important;inset:auto!important;display:block!important;margin:18px 0 10px auto!important;width:min(38%,240px)!important;transform:rotate(5deg)!important;}
}

/* v8.6 — full-width paper, portrait anchored to the browser's right edge.
   The portrait is a decorative viewport-edge accent, NOT a grid column. */
@media (min-width: 851px) {
  .gh-letter-page .gh-info-layout--letter .gh-info-main,
  .gh-letter-page .gh-info-layout--letter .gh-letter-scene {
    min-width: 0!important;
    overflow: visible!important;
  }
  .gh-letter-page .gh-info-layout--letter .gh-letter-scene {
    padding: 0 0 58px 0!important;
  }
  .gh-letter-page .gh-letter-stage {
    display: block!important;
    position: relative!important;
    width: 100%!important;
    max-width: none!important;
    padding: 0!important;
    margin: 0!important;
    overflow: visible!important;
  }
  .gh-letter-page .gh-letter-sheet {
    display: block!important;
    width: 100%!important;
    max-width: none!important;
    margin: 0!important;
    grid-column: auto!important;
    grid-row: auto!important;
  }
  .gh-letter-page .gh-letter-paper,
  .gh-info-layout--with-sidebar .gh-letter-page .gh-letter-paper {
    padding: clamp(34px,3.5vw,54px) clamp(42px,5vw,76px)!important;
  }
  /* The picture is pushed out to the right edge of the VIEWPORT.
     Its leftmost edge stays at or beyond the right edge of the letter. */
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra) {
    position: absolute!important;
    grid-column: auto!important;
    grid-row: auto!important;
    top: clamp(95px,11vw,175px)!important;
    left: max(calc(100% + 18px), calc(100vw - 165px - (100vw - 100%)))!important;
    right: auto!important;
    width: clamp(260px,25vw,360px)!important;
    max-width: none!important;
    margin: 0!important;
    transform: rotate(7deg)!important;
    z-index: 6!important;
  }
}
/* At narrower desktop widths, keep the photo fully outside the paper. */
@media (min-width: 751px) and (max-width: 850px) {
  .gh-letter-page .gh-letter-sheet{width:100%!important;max-width:none!important}
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){position:absolute!important;left:calc(100% + 12px)!important;right:auto!important;top:110px!important;width:265px!important;margin:0!important;transform:rotate(7deg)!important}
}
/* Crop only the decorative overflow at the viewport, not at the letter edge. */
@media(min-width:751px){body:has(.gh-letter-page){overflow-x:clip}}

/* v8.7 — balanced desktop composition: generous letter + visible viewport-edge portrait.
   Keep the paper wide, reserve a narrow right rail for the photo, and allow the
   photograph to extend beyond the browser edge without sitting on body copy. */
@media (min-width: 1151px) {
  .gh-letter-page .gh-letter-stage {
    display:block!important;
    position:relative!important;
    width:100%!important;
    max-width:none!important;
    overflow:visible!important;
    padding:0!important;
    margin:0!important;
  }
  .gh-letter-page .gh-letter-sheet {
    display:block!important;
    box-sizing:border-box!important;
    width:calc(100% - clamp(165px, 14vw, 230px))!important;
    max-width:none!important;
    min-width:0!important;
    margin:0!important;
  }
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra) {
    position:absolute!important;
    top:clamp(105px,11vw,165px)!important;
    left:calc(100% - clamp(145px, 11.5vw, 190px))!important;
    right:auto!important;
    width:clamp(275px,24vw,355px)!important;
    max-width:none!important;
    margin:0!important;
    transform:rotate(6deg)!important;
    z-index:6!important;
  }
  .gh-letter-page .gh-letter-paper {
    padding:clamp(34px,3.5vw,54px) clamp(40px,4vw,65px)!important;
  }
}
/* When there is not enough horizontal room for both elements, move the portrait
   below the letter rather than cover the text. */
@media (min-width:751px) and (max-width:1150px) {
  .gh-letter-page .gh-letter-stage{display:flex!important;flex-direction:column!important;align-items:stretch!important;overflow:visible!important;padding:0!important}
  .gh-letter-page .gh-letter-sheet{width:100%!important;max-width:none!important;min-width:0!important;margin:0!important}
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra){position:relative!important;inset:auto!important;align-self:flex-end!important;width:min(45%,310px)!important;max-width:100%!important;margin:-10px 10px 30px 0!important;transform:rotate(5deg)!important}
}
/* v8.8 — Polaroid overlaps only the paper's outer margin, never the text.
   Keep the v8.7 letter width; draw the portrait about 45px into the paper,
   while reserving a clear inner margin for the rotation and shadow. */
@media (min-width:1151px) {
  .gh-letter-page .gh-letter-portrait:not(.gh-letter-extra) {
    left:calc(100% - clamp(165px, 14vw, 230px) - 42px)!important;
  }
  .gh-letter-page .gh-letter-paper {
    padding-right:clamp(100px, 9vw, 135px)!important;
  }
}
