/* Final polish layer: overrides the earlier prototype layers. */

/* Home: departments sit on one baseline, nothing is lit until it is hovered. */
.stage-layout:not(.stage-open) .department:before{content:none}
.stage-layout:not(.stage-open) .department.active:not(:hover):not(:focus-visible) .name{color:inherit;text-shadow:none}
@media(min-width:701px){
.stage-layout:not(.stage-open) .departments{display:flex!important;width:auto!important;align-items:flex-end;gap:clamp(4px,1.2vw,20px)}
.stage-layout:not(.stage-open) .department{flex:none!important;width:auto}
.stage-layout:not(.stage-open) .department .name{white-space:nowrap;font-size:clamp(40px,4.7vw,74px)!important}
.stage-layout:not(.stage-open) .department:first-child{padding-left:0!important}
.stage-layout:not(.stage-open) .personal-copy>.brand{left:-26px}
}
.stage-layout .heart-contact .heart-phrase{font-size:13px;color:#b3ada3}
.stage-layout .heart-contact .mail-address{font-size:13px}

/* YouTube: its own title bar and logo live in the cropped letterbox; a poster covers the first load. */
.player-stage .yt-frame{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.player-stage .yt-frame iframe{position:absolute!important;inset:auto!important;left:0!important;top:-72px!important;width:100%!important;height:calc(100% + 144px)!important}
.player-stage .yt-cover{position:absolute;inset:0;z-index:1;background:#050505 center/cover no-repeat;pointer-events:none;opacity:1;transition:opacity .7s cubic-bezier(.22,.8,.2,1)}
.player-stage.yt-started .yt-cover{opacity:0}
.player-stage:has(.yt-frame){cursor:pointer}

/* Transport */
.player .volume{transition:filter .35s ease}
.player:not(.sound-enabled) .volume{filter:grayscale(1) brightness(.75)}
.stage-content .transport-meta .title{font-size:14px;color:#e8e6dd;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stage-content .transport-meta .credit{font-size:11px;color:#8a857c}
.stage-content .fullscreen-toggle{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;color:#b4b4a9;transition:color .3s,transform .35s cubic-bezier(.22,.8,.2,1)}
.stage-content .fullscreen-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round;display:block}
.stage-content .fullscreen-toggle:hover,.stage-content .fullscreen-toggle:focus-visible{color:#ff755f;transform:scale(1.08)}

/* Selected works open beside the video: the video steps aside instead of being covered. */
@media(min-width:1000px){
.stage-content .media-layout.reel-first.floating-works,.stage-content .media-layout.reel-first.floating-works.browsing-works{grid-template-columns:minmax(0,1fr);--pw:min(100%,1200px,calc((100svh - 280px)*16/9));--po:min(calc(100% - 410px),1200px,calc((100svh - 280px)*16/9))}
.stage-content .floating-works .player,.stage-content .floating-works.browsing-works .player{justify-self:center!important;width:var(--pw)!important;margin:0!important;transition:width .55s cubic-bezier(.22,.8,.2,1),margin-right .55s cubic-bezier(.22,.8,.2,1)}
.stage-content .floating-works.browsing-works .player{width:var(--po)!important;margin-right:410px!important}
.stage-content .floating-works .track-list{top:0;bottom:auto;right:calc((100% - var(--po) - 410px)/2);width:386px;max-height:min(560px,calc(100svh - 300px));transform-origin:top left}
}
@media(prefers-reduced-motion:reduce){.stage-content .floating-works .player{transition:none}}

/* One left edge for the whole page, with room to breathe. Raleway capitals carry ~0.09em of side bearing; pull them onto the edge. */
.stage-layout{--gutter:clamp(28px,7vw,120px)}
.stage-layout header,.stage-layout main,.stage-layout footer{padding-left:var(--gutter)!important;padding-right:var(--gutter)!important}
.stage-layout .personal-copy h1{margin-left:-.09em}
.stage-layout:not(.stage-open) .department .name{margin-left:-.089em}

/* Social marks: one optical size and one centre line in every browser (CV is drawn, not typeset). */
.persistent-links,.personal-links,.creator-socials{display:flex;align-items:center;gap:20px!important}
.persistent-links a,.personal-links a,.creator-socials a{display:inline-flex!important;align-items:center;justify-content:center;width:auto!important;min-width:0!important;height:34px!important;margin:0!important;padding:0 1px!important;color:#a6a79d}
.persistent-links a svg,.personal-links a svg,.creator-socials a svg{display:block;flex:none}
a.social-icon[title=YouTube] svg{width:22px;height:22px}
a.social-icon[title=Instagram] svg{width:20px;height:20px}
a.social-icon[title=LinkedIn] svg{width:19px;height:19px;transform:translateY(.6px)}
.cv-link .cv-mark{width:25.7px;height:22px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round}

/* Page-to-page: no frozen cross-document transition; a quick fade out instead, the next page fades in. */
@view-transition{navigation:none}
html.page-leaving body{opacity:0;transition:opacity .26s ease}
body.stage-layout{animation:page-in .55s cubic-bezier(.22,.8,.2,1) both}
@keyframes page-in{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){body.stage-layout{animation:none}html.page-leaving body{transition:none}}

/* Audio tracks: the cover fills the stage and drifts slowly while playing; glow comes from the cover. */
.player-stage .audio-cover{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;cursor:pointer;transform:scale(1);transition:transform 16s cubic-bezier(.3,0,.3,1)}
.is-playing .player-stage.is-audio .audio-cover{transform:scale(1.045)}
.stage-content .player-stage .cinematics-glow.static-glow{opacity:0;transition:opacity 1s ease}
.stage-content .player-stage .cinematics-glow.static-glow.ready{opacity:1}
@media(prefers-reduced-motion:reduce){.player-stage .audio-cover{transition:none;transform:none!important}}

/* Track titles: the work first, its context in a quiet second line. */
.track-title .track-meta{display:block;margin-top:5px;font-size:11px;font-weight:200;letter-spacing:.05em;opacity:.6}

/* Selected credits: one quiet line of real projects under the subtitle. */
.personal-copy .credits{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 0;margin-top:26px;max-width:min(760px,100%);font:200 13px/1.6 Raleway,Arial,sans-serif;letter-spacing:.04em;color:#a6a79d}
.personal-copy .credits .credits-label{margin-right:18px;font-size:10px;letter-spacing:.2em;text-transform:uppercase;color:#77736e}
.personal-copy .credits a{color:inherit;text-decoration:none;transition:color .3s ease}
.personal-copy .credits a+a:before{content:'·';display:inline-block;margin:0 12px;color:#5d5a55}
.personal-copy .credits a:hover,.personal-copy .credits a:focus-visible{color:#fa402b}
.stage-layout.stage-open .personal-copy .credits{display:none}
@media(max-width:700px){.personal-copy .credits{margin-top:18px;font-size:12px}.personal-copy .credits .credits-label{flex-basis:100%;margin-bottom:2px}}
@media(min-width:901px){.personal-copy .credits{flex-wrap:nowrap;white-space:nowrap;max-width:none}}
/* Phone: the portrait bleeds past the right edge by design; never let it widen the page. */
html:has(body.stage-layout),body.stage-layout{overflow-x:clip}
@media(max-width:700px){.personal-copy .credits{gap:4px 14px}.personal-copy .credits a+a:before{content:none}}

/* Hover lights only the item under the cursor; neighbours stay as they are (no dimming filters, which Safari paints as a dark plate). */
.stage-layout:not(.stage-open) .departments:has(.department:hover) .department:not(:hover),
.stage-layout:not(.stage-open) .departments:has(.department:focus-visible) .department:not(:focus-visible){opacity:1;filter:none}
.stage-layout:not(.stage-open) .department{filter:none!important}

/* ---- Preview: best-works variants (works-preview.js) ---- */
.works-switch{position:fixed;z-index:30;left:50%;bottom:18px;transform:translateX(-50%);display:flex;align-items:center;gap:4px;padding:6px 8px;border:1px solid #ffffff1c;border-radius:30px;background:#151614f2;box-shadow:0 10px 30px #0007;font:300 11px Raleway,Arial,sans-serif}
.works-switch-label{margin:0 10px 0 6px;color:#77736e;letter-spacing:.08em}
.works-switch button{padding:7px 12px;border-radius:20px;color:#a6a79d;transition:background .3s,color .3s}
.works-switch button:hover{color:#e8e6dd}
.works-switch button[aria-pressed=true]{background:#e8e6dd;color:#111}
/* C */
.stage-layout:not(.stage-open) .department{overflow:visible}
.works-peek{position:absolute;left:0;bottom:calc(100% - 4px);display:flex;flex-direction:column;gap:5px;font:200 13px/1.3 Raleway,Arial,sans-serif;letter-spacing:.04em;color:#a6a79d;white-space:nowrap;opacity:0;transform:translateY(8px);transition:opacity .45s ease,transform .55s cubic-bezier(.22,.8,.2,1);pointer-events:none}
.department:hover .works-peek,.department:focus-visible .works-peek{opacity:1;transform:none}
.department:hover .works-peek span:nth-child(2){transition-delay:.04s}
.stage-layout.stage-open .works-peek{display:none}
@media(max-width:700px){.works-peek{display:none}.works-switch{bottom:10px;font-size:10px}.works-switch-label{display:none}}
@media(prefers-reduced-motion:reduce){.works-peek{transition:opacity .2s}}
.works-peek{left:16px}.department:first-child .works-peek{left:0}

/* Compact screens: work selection stays below the player, never above the viewport. */
@media(max-width:999px){
.stage-content .floating-works .track-list{position:relative;inset:auto;width:100%;max-height: min(440px,55svh);margin:16px 0 0;box-sizing:border-box;transform-origin:top center;overscroll-behavior:contain}
.stage-content .floating-works .works-heading{position:sticky;top:-8px;z-index:1;background:#111310;padding-top:14px}
.stage-content .transport-main{flex-wrap:wrap}
.stage-content .transport-meta{min-width:0;flex:1 1 160px}
.stage-content .transport-meta .title{max-width:100%}
}
@media(max-width:380px){
.stage-layout header,.plugin-surface .creator-shell{gap:8px}
.stage-layout .heart-contact{flex-wrap:wrap;gap:8px 16px}
.stage-layout .personal-copy h1{font-size:clamp(36px,12vw,47px)}
.library-filters{gap:12px;font-size:12px}
.stage-open .department .name{font-size:15px!important}
}
@media(hover:none){
.stage-layout .departments:has(.department:hover) .department:not(:hover){opacity:1;filter:none}
.stage-layout .department:hover{transform:none}
}
@media(max-height:500px) and (min-width:701px){
.stage-layout.stage-open header{min-height:60px}
.stage-layout.stage-open .departments{height:46px!important}
.stage-content .floating-works .player,.stage-content .floating-works.browsing-works .player{width:min(100%,680px)!important}
.stage-layout.stage-open footer{position:relative;margin-top:20px}
}
@media(max-width:999px){
.stage-content:has(.browsing-works){overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;padding-bottom:20px}
.stage-content .floating-works .track-list{max-height: min(360px,45svh)}
}
/* Short landscape windows need a document flow rather than a clipped one-screen layout. */
@media(max-height:500px){
body.stage-layout{height:auto;min-height:100svh;overflow-y:auto;overflow-x:hidden}
.stage-layout main{flex:none;min-height:0}
.stage-layout:not(.stage-open) .personal-intro{min-height:160px;margin-bottom:18px}
.stage-layout:not(.stage-open) .departments{flex:none;min-height:110px!important}
.stage-layout:not(.stage-open) .department{min-height:110px!important}
.stage-layout.stage-open .stage-content{flex:none;min-height:250px;height:auto}
.stage-layout.stage-open footer{margin-top:16px}
}
@media(min-width:1000px) and (max-width:1199px){
.stage-content .floating-works.browsing-works .player{width:var(--pw)!important;margin-right:0!important}
.stage-content .floating-works .track-list{position:relative;inset:auto;width:100%;max-height:360px;margin:16px 0 0;box-sizing:border-box;transform-origin:top center;overscroll-behavior:contain}
.stage-content:has(.browsing-works){overflow-y:auto;overflow-x:hidden;padding-bottom:20px}
}
@media(min-width:1000px) and (max-width:1399px){
.stage-content .browsing-works .transport-main{flex-wrap:wrap}
.stage-content .browsing-works .transport-meta{order:5;flex:1 0 100%;min-width:0}
.stage-content .browsing-works .transport-meta .credit{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}

/* Capture final layout, then animate the menu and content on one clock. */
.section-changing .departments,.section-changing .department,.section-changing .department .name,.section-changing .personal-intro{transition:none!important}
::view-transition-group(department-navigation),::view-transition-group(site-header),::view-transition-group(ek-brand){animation-duration:360ms;animation-timing-function:cubic-bezier(.22,.8,.2,1)}
::view-transition-new(selected-work){animation:section-arrive 280ms cubic-bezier(.22,.8,.2,1) 80ms both}
::view-transition-old(selected-work){animation:section-depart 160ms ease-out both}
@keyframes section-arrive{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes section-depart{to{opacity:0;transform:translateY(-4px)}}
@media(prefers-reduced-motion:reduce){::view-transition-new(selected-work),::view-transition-old(selected-work){animation:none!important}}

/* Section navigation is one scene, not independently travelling header/content layers. */
html[data-motion="section"].section-changing .stage-layout *{view-transition-name:none!important}
html[data-motion="section"]::view-transition-old(root){animation:scene-out 150ms ease-out both;mix-blend-mode:normal}
html[data-motion="section"]::view-transition-new(root){animation:scene-in 320ms cubic-bezier(.22,.8,.2,1) both;mix-blend-mode:normal}
@keyframes scene-out{to{opacity:0;transform:translateY(-5px)}}
@keyframes scene-in{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){html[data-motion="section"]::view-transition-old(root),html[data-motion="section"]::view-transition-new(root){animation:none!important}}


/* Keep all three destinations visible on a phone. */
@media (max-width: 700px) {
  body.stage-layout:not(.stage-open) { height: auto; min-height: 100svh; overflow-y: auto; }
  .stage-layout:not(.stage-open) main { flex: none; height: auto; padding-bottom: 0 !important; }
  .stage-layout:not(.stage-open) .personal-intro {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    margin: 0 0 14px;
  }
  .stage-layout:not(.stage-open) .personal-intro .portrait-frame {
    position: relative;
    inset: auto;
    width: min(100%, 290px);
    height: clamp(112px, 25svh, 225px);
    margin: 0 auto;
    z-index: auto;
  }
  .stage-layout:not(.stage-open) .personal-copy { max-width: 100%; padding-top: 0; }
  .stage-layout:not(.stage-open) .personal-copy h1 { font-size: clamp(34px, 10vw, 46px); }
  .stage-layout:not(.stage-open) .personal-copy p { margin-top: 8px; }
  .stage-layout:not(.stage-open) .departments {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 0 !important;
  }
  .stage-layout:not(.stage-open) .department {
    width: 100%;
    min-height: 46px !important;
    padding: 5px 0 !important;
    text-align: left;
  }
  .stage-layout:not(.stage-open) .department .name { font-size: clamp(25px, 7vw, 32px) !important; }
}

@keyframes section-content-enter {
  from { opacity: 0; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .stage-layout.stage-open .stage-content:not([hidden]) {
    animation: section-content-enter 300ms cubic-bezier(.22,.8,.2,1) both;
  }
}

@media (max-width: 700px) {
  .stage-layout:not(.stage-open) main {
    min-height: 0;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
  }
  .stage-layout:not(.stage-open) .personal-intro .portrait-frame {
    height: clamp(112px, 30svh, 260px);
  }
}

/* One scene transition controls entry, including browsers without View Transitions. */
.stage-layout.stage-open .stage-content:not([hidden]) { animation: none; }
.stage-layout .department .name {
  transition: color 180ms ease, opacity 180ms ease, transform 180ms cubic-bezier(.2,.8,.2,1);
  transform-origin: left center;
}
.stage-layout .department:active .name {
  transform: translateY(1px) scale(.975);
}
@media (prefers-reduced-motion: reduce) {
  .stage-layout .department .name { transition: none; }
  .stage-layout .department:active .name { transform: none; }
}

/* Small vector flight, no viewport snapshots or animated layout dimensions. */
html.scene-changing .stage-layout .brand > svg,
html.scene-changing .stage-layout .department {
  transition: none !important;
  transform: none !important;
  filter: none !important;
}
html.scene-changing .portrait-frame img,
html.scene-changing .energy-cloud i { animation-play-state: paused !important; }
.brand-flight { contain: layout style paint; }
.stage-layout:not(.stage-open) .personal-copy > .brand svg.original-ek-logo {
  color: #ff302b;
  opacity: .20;
}
@media(max-width:700px) {
  .stage-layout:not(.stage-open) .personal-copy > .brand {
    left: 50%; top: -28px;
    width: 190px; height: 190px;
    transform: translateX(-50%);
  }
  /* Static masked portrait avoids continuous compositing on phones. */
  .stage-layout .portrait-frame img { animation: none; will-change: auto; filter: none; }
  .stage-layout .energy-cloud { display: none; }
}

/* Mobile: center the visible text, not just its wider subtitle container. */
html.scene-changing .stage-layout .department .name { transition: none !important; filter: none !important; }
@media(max-width:700px) {
  body.stage-layout:not(.stage-open) .personal-copy,
  body.stage-layout:not(.stage-open) .personal-copy h1,
  body.stage-layout:not(.stage-open) .personal-copy p { text-align: center; }
  body.stage-layout:not(.stage-open) .personal-copy p { margin-left: auto; margin-right: auto; }
  body.stage-layout:not(.stage-open) .personal-copy > .brand { top: -42px; }
}

/* Prevent legacy layout transitions from competing with the explicit motion. */
html.scene-changing .stage-layout * { transition: none !important; }

/* A cleaner red keeps the monogram legible at both sizes. */
.stage-layout.stage-open .brand svg.original-ek-logo,
.creator-sign svg.original-ek-logo,
.maker-link svg.original-ek-logo { color: #ff302b; opacity: .9; }
.stage-layout.stage-open .brand:hover svg.original-ek-logo,
.stage-layout.stage-open .brand:focus-visible svg.original-ek-logo,
.creator-sign:hover svg.original-ek-logo { color: #ff594d; opacity: 1; }

/* Content determines the open section height; controls never overflow into the footer. */
body.stage-layout.stage-open { height: auto !important; min-height: 100svh; overflow-y: auto !important; }
body.stage-layout.stage-open main { flex: 1 0 auto !important; height: auto !important; overflow: visible; }
body.stage-layout.stage-open .stage-content { flex: 0 0 auto !important; height: auto !important; min-height: 0; overflow: visible; }
body.stage-layout.stage-open .stage-content #detail,
body.stage-layout.stage-open .stage-content .media-layout { height: auto !important; min-height: 0; }
body.stage-layout.stage-open footer { position: relative; inset: auto; flex: 0 0 auto; margin-top: 24px; }
