/* =========================================================
   Prototype 25: site navigation, new Homepage, About the Artist, Contact.
   Palette: near-white + brown, bold dark-brown outlines (the same illustrated look as the Portfolio mirror).
   ========================================================= */
:root { --ink-brown: #2b1a12; --brown: #6b4423; --cream: #fffaf0; --caramel: #c98a5a; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- which page is showing ---- */
#home, #contact { display: none; position: fixed; inset: 0; overflow: hidden; }
body.show-home #home { display: block; }
body.show-contact #contact { display: block; }
body.show-home, body.show-contact { overflow: hidden; }
body:not(.show-intro) #intro { display: none; }
body.show-intro #intro { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; z-index: 1; }

/* ---- top-right navigation (not inside the Studio) ---- */
#siteNav {
  position: fixed; top: clamp(12px, 2vw, 26px); right: clamp(12px, 2.4vw, 34px); z-index: 30;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
body.show-gallery #siteNav, body.file-mode #siteNav { display: none; }
#siteNav button {
  font-family: var(--font-body); font-size: clamp(11px, 1vw, 13px); letter-spacing: .1em; text-transform: uppercase;
  color: var(--brown); background: rgba(255,250,240,.94);
  border: 2.5px solid var(--ink-brown); border-radius: 999px; padding: .7em 1.35em; cursor: pointer;
  box-shadow: 3px 4px 0 rgba(43,26,18,.18);
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
#siteNav button:hover, #siteNav button:focus-visible { background: var(--brown); color: var(--cream); transform: translateY(-1px); outline: none; }
body.show-home #siteNav [data-page="home"], body.show-intro #siteNav [data-page="about"], body.show-contact #siteNav [data-page="contact"] { background: var(--ink-brown); color: var(--cream); }
@media (max-width: 520px) { #siteNav { gap: 5px; } #siteNav button { padding: .6em .9em; letter-spacing: .05em; } }

#fade.quick { transition-duration: .22s; }

/* ---- the new Homepage: the PORTFOLIO mirror illustration, never stretched ---- */
/* Prototype 29: the picture always fills the width (only the far-left/right trees and wall are trimmed on narrower windows; the mirror, Portfolio, the cat and the girl are never cut); phones show it whole */
/* Prototype 28: the whole picture, undistorted and uncropped; no blurred side panels (the sky and the wall simply continue) */
#home { background: linear-gradient(#7fb6e3 0 49%, #a8723f 49% 100%); }
.home-art { position: absolute; inset: 0; overflow: hidden; }
.home-stage { position: absolute; left: 50%; top: 50%; width: max(100vw, calc(100vh * 1672 / 941)); aspect-ratio: 1672 / 941; transform: translate(-50%, -50%); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
@media (max-aspect-ratio: 117/100) { .home-stage { width: 100vw; } }
@media (min-aspect-ratio: 245/100) { .home-stage { width: calc(100vh * 1672 / 941); } }                 /* extremely wide windows: show it whole instead of trimming the top and bottom */
.home-front { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; }
.home-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.home-cat { position: absolute; left: 34.6%; top: 42.2%; width: 5.2%; height: 8.8%; border-radius: 42%; }
#home .explore-btn {
  z-index: 5; color: var(--brown); background: rgba(255,250,240,.95); border: 2.5px solid var(--ink-brown);
  box-shadow: 4px 5px 0 rgba(43,26,18,.25); font-weight: 700;
}
#home .explore-btn:hover, #home .explore-btn:focus-visible { background: var(--brown); color: var(--cream); }

/* ---- About the Artist (Prototype 27): the Prototype 24 page, plain background, with the text in a box ---- */
.intro-text {
  border: 2.5px solid var(--ink-brown); border-radius: 22px; background: var(--cream);
  padding: clamp(20px, 3vw, 44px); box-shadow: 3px 4px 0 rgba(43,26,18,.18);          /* the same shadow as the navigation buttons */
}
@media (max-width: 760px) { .intro-hero { padding-top: 76px; } }

/* ---- Contact: the supplied 3D desk image; its four keys are the buttons ---- */
#contact { background: #7a4a2c; }
.contact-back { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(26px); transform: scale(1.14); }
.contact-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ckey { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.ckey-patch { opacity: 0; }
.ckey-glow { opacity: 0; transition: opacity .15s ease; pointer-events: none; }
.ckey-sym { transition: transform .12s ease; }
.ckey:hover .ckey-glow, .ckey:focus-visible .ckey-glow { opacity: .13; }
.ckey:focus-visible .ckey-cap { stroke: #fff6e8; stroke-width: 4; }
.ckey.pressed .ckey-patch { opacity: 1; }                                         /* the key cap sinks into the case */
.ckey.pressed .ckey-sym { transform: translateY(7px); transition-duration: .05s; }
.ckey.pressed .ckey-glow { opacity: 0; }
.contact-hint { position: absolute; right: clamp(16px, 3vw, 44px); bottom: clamp(14px, 2.6vw, 34px); margin: 0; z-index: 4; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #fbeedc; opacity: .85; }
#contactTip, #pageToast {
  position: fixed; z-index: 40; pointer-events: none; opacity: 0; transition: opacity .18s ease;
  font-family: var(--font-body); color: var(--brown); background: rgba(255,250,240,.97);
  border: 2.5px solid var(--ink-brown); border-radius: 999px; padding: .55em 1.2em; font-size: 14px; white-space: nowrap;
  box-shadow: 3px 4px 0 rgba(43,26,18,.22);
}
#contactTip { transform: translate(-50%, -100%); }
#contactTip.on, #pageToast.on { opacity: 1; }
#pageToast { left: 50%; bottom: clamp(60px, 9vh, 110px); transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { .ckey-sym { transition: none; } }

/* ---- About the Artist: the Stickers button gets the same outline + shadow as the other buttons ---- */
#intro .stk-toggle { color: var(--brown); background: rgba(255,250,240,.95); border: 2.5px solid var(--ink-brown); box-shadow: 4px 5px 0 rgba(43,26,18,.25); font-weight: 700; }
#intro .stk-toggle:hover, #intro .stk-toggle:focus-visible, #intro .stk-dock.open .stk-toggle { background: var(--brown); color: var(--cream); }

/* Prototype 28: subtle life in the contact illustration (the picture itself is untouched underneath) */
.st { opacity: 0; stroke-dasharray: 160; animation: steamUp 5.4s ease-in-out infinite; transform-box: fill-box; }
.st.s2 { animation-delay: -1.8s; } .st.s3 { animation-delay: -3.6s; }
@keyframes steamUp { 0% { opacity: 0; transform: translateY(18px); stroke-dashoffset: 160; } 30% { opacity: .5; } 100% { opacity: 0; transform: translateY(-26px); stroke-dashoffset: 0; } }
.lid { transform-box: fill-box; transform-origin: center; transform: scaleY(0); animation: blinkLid 5.6s infinite; }
.blink-line { opacity: 0; animation: blinkLine 5.6s infinite; }
@keyframes blinkLid { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } }
@keyframes blinkLine { 0%, 93.5%, 100% { opacity: 0; } 95.5% { opacity: 1; } 96.5% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .st, .lid, .blink-line { animation: none; } }
/* tall windows / phones: the picture stays whole; its top and bottom edges melt into the matching sky / wall colour */
@media (max-aspect-ratio: 117/100) { .home-front { -webkit-mask-image: linear-gradient(transparent 0, #000 7%, #000 93%, transparent 100%); mask-image: linear-gradient(transparent 0, #000 7%, #000 93%, transparent 100%); } }

/* Prototype 29: only the cat can be petted; its eyes turn into happy arcs for a moment */
.cat-happy { opacity: 0; transition: opacity .14s ease; }
.cat-happy.on { opacity: 1; }
/* the little petting hand: only while the cursor is over the cat */
.home-cat { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><g fill='%23f7d9bd' stroke='%232a1c16' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'><path d='M9 17 V10.5 a1.9 1.9 0 0 1 3.8 0 V15 V8 a1.9 1.9 0 0 1 3.8 0 V15 V9 a1.9 1.9 0 0 1 3.8 0 V15.5 V12 a1.9 1.9 0 0 1 3.8 0 V20.5 C23.4 25.5 21 28.5 16.5 28.5 C12 28.5 10 26 8.2 22.5 L5.6 18.4 a1.8 1.8 0 0 1 3-2 Z'/></g></svg>") 14 6, pointer; }
.cat-blink { opacity: 0; }
.cat-blink.on { opacity: 1; }
#catG { transform-origin: 626px 466px; }
#catG { transform-box: view-box; }
#catHead { visibility: hidden; }
#catG.pet #catHead { visibility: visible; }
#catG.pet { animation: catPet 1.5s ease-in-out infinite; }
@keyframes catPet { 0%, 100% { transform: scale(1) rotate(0deg); } 30% { transform: scale(1.025) rotate(-1.1deg) translateY(0.5px); } 65% { transform: scale(1.025) rotate(0.9deg) translateY(0.3px); } }
@media (prefers-reduced-motion: reduce) { #catG.pet { animation: none; transform: scale(1.02); } }

/* ===== Responsive framing =====
   Desktop / landscape: the landscape pictures, cat and keys exactly as before. Portrait (phones held upright): the supplied portrait pictures are used,
   scaled to fill the screen without distortion (centre kept), with the same cat and contact keys rebuilt on top of them. */
.contact-back { display: none; }
.contact-scene { inset: auto; left: 50%; top: 50%; width: max(100vw, calc(100vh * 1672 / 941)); height: auto; aspect-ratio: 1672 / 941; transform: translate(-50%, -50%); }
.home-front-p, .home-fx-p, .home-cat-p, .contact-scene-p { display: none; }
@media (orientation: portrait) {
  /* home */
  .home-stage { width: max(100vw, calc(100svh * 941 / 1672)); aspect-ratio: 941 / 1672; }
  .home-front, #homeFx, #homeCat { display: none; }
  .home-front-p { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; }
  .home-fx-p { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
  .home-cat-p { position: absolute; display: block; left: 15.7%; top: 43.9%; width: 18.4%; height: 6.2%; border-radius: 42%; }
  /* contact */
  .contact-scene { display: none; }
  .contact-scene-p { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
}
/* very tall phones: the picture is cropped at the sides - keep the "Portfolio" lettering centred in the view */
@media (orientation: portrait) and (max-aspect-ratio: 563/1000) { .home-stage { transform: translate(calc(-50% - 2.1%), -50%); } }
/* the cat in the portrait picture: same petting nudge, blink and hand cursor */
#catGP { transform-origin: 233px 834px; transform-box: view-box; }
#catHeadP { visibility: hidden; }
#catGP.pet #catHeadP { visibility: visible; }
#catGP.pet { animation: catPet 1.5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #catGP.pet { animation: none; transform: scale(1.02); } }
.home-cat-p { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><g fill='%23f7d9bd' stroke='%232a1c16' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'><path d='M9 17 V10.5 a1.9 1.9 0 0 1 3.8 0 V15 V8 a1.9 1.9 0 0 1 3.8 0 V15 V9 a1.9 1.9 0 0 1 3.8 0 V15.5 V12 a1.9 1.9 0 0 1 3.8 0 V20.5 C23.4 25.5 21 28.5 16.5 28.5 C12 28.5 10 26 8.2 22.5 L5.6 18.4 a1.8 1.8 0 0 1 3-2 Z'/></g></svg>") 14 6, pointer; }
