/* Motion: one quiet system for the whole site, driven by js/motion.js. Loaded after every other stylesheet.
   Everything that moves sits under html.m, which the small script in each page's <head> adds only when JavaScript
   runs and the visitor has not asked for reduced motion. Without it every element is simply visible and still.
   One easing, 0.9–1.4s, at most 24px of movement (16px on phones), 120ms between siblings; only transform (translate,
   scale), opacity and clip-path animate, apart from the display name's letter-spacing and the map's arcs. */
:root { --m-ease: cubic-bezier(0.22, 0.61, 0.36, 1); --m-d: 24px; }
@media (max-width: 767px) { :root { --m-d: 16px; } }

/* ── Between pages: a soft crossfade where the browser supports it; an ordinary load elsewhere ── */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.5s; animation-timing-function: var(--m-ease); }
html:not(.m)::view-transition-group(*), html:not(.m)::view-transition-old(*), html:not(.m)::view-transition-new(*) { animation: none !important; }

/* ── The older scripts' starting states, now handled here: visible by default ── */
html.js :is(.hero-title, .hero-tagline, .reach-label, .reach-text, .form-field, .submit-btn) { opacity: 1; }
html.js .form-field { transform: none; }
html.js .reach-map .cdot { opacity: 0.72; }

/* ── Paragraphs, labels, notes, card text and form fields: fade up, once ── */
html.m:root :is(main p, main li, main dt, main dd, main blockquote, main h3:not(.ep-title), main .ep-label, main .ep-link, main .step-num,
  main .dest-card-name, main .dest-card-line, main .form-field, main .submit-btn, main .dest-enquire, main .dest-related):not(:is(.hero, .dest-arrival, .reach-map, .reach-globe) *):not(.sr-only):not(.enquire-error):not(.enquire-success):not(.m-in) {
  opacity: 0 !important;
  translate: 0 var(--m-d);
}
html.m .m-t { transition: opacity 0.9s var(--m-ease), translate 0.9s var(--m-ease), transform 0.9s var(--m-ease); }

/* ── Headings: the text rises from behind its own baseline ── */
html.m:root :is(main h1, main h2, main .ep-title):not(.hero-heading):not(.dest-h1):not(.sr-only):not(:is(.hero, .dest-arrival) *):not(.m-h) {
  visibility: hidden !important;
}
/* the mask clips above and below only, so an italic letter's overhang at either side is never cut; the room above and
   below keeps accents and descenders whole */
.m-mask { display: block; clip-path: inset(0 -1em); padding: 0.2em 0; margin: -0.2em 0; }
.m-mask > .m-inner { display: block; }
html.m .m-h:not(.m-in) .m-inner { translate: 0 105%; }
html.m .m-h .m-inner { transition: translate 1.1s var(--m-ease); }

/* ── Photographs: a curtain opens from the top while the image settles from 1.08 to 1 ── */
html.m:root :is(.dest figure, .ep-photo):not(.m-in) { clip-path: inset(0 0 100% 0); }
html.m :is(.dest figure, .ep-photo) { transition: clip-path 1.4s var(--m-ease), scale 1.4s var(--m-ease); }
html.m .dest figure img { scale: 1.08; transition: scale 1.4s var(--m-ease); }
html.m .dest figure.m-in img { scale: 1; }
html.m .ep-photo { scale: 1.08; }
html.m .ep-photo.m-in { scale: 1; }

/* The homepage panels: the photograph is its own layer so it can open and settle (index.html, .ep-photo) */
.ep { isolation: isolate; overflow: clip; }   /* the photograph starts larger than its panel */
.ep-photo { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; background-repeat: no-repeat; pointer-events: none; }
.ep--corporate .ep-photo {
  background-image: url('../images/corporate-panel.jpg');
  background-image: image-set(url('../images/corporate-panel.webp') type('image/webp'), url('../images/corporate-panel.jpg') type('image/jpeg'));
}
.ep--bespoke .ep-photo {
  background-image: url('../images/bespoke-bg.jpg');
  background-image: image-set(url('../images/bespoke-bg.avif') type('image/avif'), url('../images/bespoke-bg.webp') type('image/webp'), url('../images/bespoke-bg.jpg') type('image/jpeg'));
}
@media (max-width: 767px) {
  .ep--corporate .ep-photo {
    background-image: url('../images/corporate-panel-1000.jpg');
    background-image: image-set(url('../images/corporate-panel-1000.webp') type('image/webp'), url('../images/corporate-panel-1000.jpg') type('image/jpeg'));
  }
  .ep--bespoke .ep-photo {
    background-image: url('../images/bespoke-bg-1200.jpg');
    background-image: image-set(url('../images/bespoke-bg-1200.avif') type('image/avif'), url('../images/bespoke-bg-1200.webp') type('image/webp'), url('../images/bespoke-bg-1200.jpg') type('image/jpeg'));
  }
}
html.m:root .ep:has(> .ep-photo) { background-image: none !important; }

/* ── Hairlines and dividers draw outward from the centre (js/motion.js adds .m-rule) ── */
.m-rule { position: relative; }
.m-rule::before, .m-rule::after { pointer-events: none; }
html.m .m-rule:is(.dest-place-col, .dest-notes-list > li) { border-top-color: transparent !important; }
html.m .m-rule:is(.dest-place-col, .dest-notes-list, .ed-section h2, .ed-list li, .policy-section h2) { border-bottom-color: transparent !important; }
html.m .m-rule:is(.dest-place-col, .dest-notes-list > li)::before,
html.m .m-rule:is(.dest-place-col, .dest-notes-list, .ed-section h2, .ed-list li, .policy-section h2)::after {
  content: ''; position: absolute; left: 0; right: 0; height: 1px; background: var(--m-c, var(--hair));
  scale: 0 1; transition: scale 1.2s var(--m-ease);
}
html.m .m-rule::before { top: -1px; }
html.m .m-rule::after { bottom: -1px; }
html.m:root .m-rule.m-in::before, html.m:root .m-rule.m-in::after { scale: 1 1; }
.dest .m-rule { --m-c: rgba(26, 26, 26, 0.2); }
/* the vertical hairline beside "Also by private arrangement" (a horizontal one below it where the cards stack) */
html.m .m-rule.dest-also-head { border-right-color: transparent !important; }
html.m .m-rule.dest-also-head::after { content: ''; position: absolute; top: 0; bottom: 0; right: -1px; width: 1px; background: var(--m-c); scale: 1 0; transition: scale 1.2s var(--m-ease); }
html.m .m-rule.dest-also-head.m-in::after { scale: 1 1; }
@media (max-width: 1179px) {
  html.m .m-rule.dest-also-head { border-bottom-color: transparent !important; }
  html.m .m-rule.dest-also-head::after { top: auto; bottom: -1px; left: 0; right: 0; width: auto; height: 1px; scale: 0 1; }
}

/* ── Footer: a fade only ── */
html.m:root .site-footer .ending-inner > :not(.m-in) { opacity: 0 !important; }
html.m .site-footer .ending-inner > * { transition: opacity 1.2s var(--m-ease); }

/* ── Reach map: the arcs draw from Sydney (js/motion.js), then the cities and their names fade in ── */
html.m:root .reach-map :is(.cdot, text):not(.m-in) { opacity: 0 !important; }
html.m .reach-map :is(.cdot, text) { transition: opacity 0.9s var(--m-ease); }

/* ── Openings: the photograph settles from 1.06 to 1 (never hidden); the name follows as its spacing settles,
   and the line under it 300ms later ── */
.hero { isolation: isolate; }
.hero-photo { position: absolute; inset: 0; z-index: -1; background-image: inherit; background-size: cover; background-position: center; background-repeat: no-repeat; pointer-events: none; }
html.m .hero-photo, html.m .dest-hero img { animation: m-settle 2.4s var(--m-ease) both; }
@keyframes m-settle { from { scale: 1.06; } to { scale: 1; } }
html.m:root .hero-title:not(.m-in) { opacity: 0 !important; letter-spacing: 0.4em !important; }
html.m .hero-title { transition: opacity 1.6s var(--m-ease), letter-spacing 1.6s var(--m-ease); }
html.m:root .dest-display:not(.m-in) { opacity: 0 !important; }
/* the opening text waits, out of sight, until its typefaces have loaded, so the swap moves nothing (js/motion.js) */
html.m:root :is(.dest-arrival-text, .hero-content):not(.m-ready) { visibility: hidden; }
html.m:root .dest-display.m-wide:not(.m-in) { letter-spacing: 0.06em !important; }   /* only where its line breaks stay the same */
html.m .dest-display { transition: opacity 1.6s var(--m-ease), letter-spacing 1.6s var(--m-ease); }
html.m:root :is(.ed-line, .dest-h1, .dest-arc):not(.m-in) { opacity: 0 !important; translate: 0 var(--m-d); }
html.m :is(.ed-line, .dest-h1, .dest-arc) { transition: opacity 1.2s var(--m-ease), translate 1.2s var(--m-ease); }
/* the scroll cue: the line draws slowly downward, every 3s — the only thing that repeats */
html.m .hero-scroll-line { transform-origin: top; animation: m-cue 3s var(--m-ease) infinite; }
@keyframes m-cue { 0% { scale: 1 0; opacity: 1; } 60% { scale: 1 1; opacity: 1; } 90%, 100% { scale: 1 1; opacity: 0; } }
html:not(.m) .hero-scroll-cue { animation: none; opacity: 1; }
html:not(.m) .hero-scroll-line { animation: none; }
html:not(.m) .dest-arc path { animation: none; stroke-dashoffset: 0; }

/* ── Header: slides away when scrolling down past 120px, back on any upward scroll ── */
html.m .site-header { transition: transform 0.5s var(--m-ease), background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; }
html.m .site-header.m-away { transform: translateY(-100%); }

/* ── Menu: the ground fades in, then the links rise one by one; closing reverses quickly ── */
html.m .site-menu[open] { animation: none; }
html.m .site-menu, html.m .site-menu::backdrop { opacity: 0; transition: opacity 0.3s var(--m-ease), display 0.3s allow-discrete, overlay 0.3s allow-discrete; }
html.m .site-menu[open], html.m .site-menu[open]::backdrop { opacity: 1; transition-duration: 0.5s; }
@starting-style { html.m .site-menu[open], html.m .site-menu[open]::backdrop { opacity: 0; } }
html.m .site-menu-body li { opacity: 0; translate: 0 var(--m-d); transition: opacity 0.3s var(--m-ease), translate 0.3s var(--m-ease); }
html.m .site-menu[open] .site-menu-body li { opacity: 1; translate: none; transition-duration: 0.9s; transition-delay: calc(0.15s + var(--i, 0) * 80ms); }
@starting-style { html.m .site-menu[open] .site-menu-body li { opacity: 0; translate: 0 var(--m-d); } }
.site-menu-body li:nth-child(2) { --i: 1; } .site-menu-body li:nth-child(3) { --i: 2; } .site-menu-body li:nth-child(4) { --i: 3; }
.site-menu-body li:nth-child(5) { --i: 4; } .site-menu-body li:nth-child(6) { --i: 5; } .site-menu-body li:nth-child(7) { --i: 6; }

/* ── Form: each field's line draws in Ink on focus (js/motion.js adds .m-line); the thank-you line fades up ── */
.m-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--ink); scale: 0 1; transform-origin: left; transition: scale 0.9s var(--m-ease); pointer-events: none; }
.form-field:focus-within .m-line { scale: 1 1; }
html.m:root body .form-field :is(input, textarea):focus { border-bottom-color: var(--grey) !important; }

/* ── Hover, on screens with a mouse only ── */
@media (hover: hover) and (pointer: fine) {
  /* links in running text: the underline lifts and draws again from the left */
  html.m main :is(p, li, dd) a { background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1px no-repeat; transition: background-size 0.9s var(--m-ease), text-decoration-color 0.3s ease; }
  html.m main :is(p, li, dd) a:hover { text-decoration-color: transparent; background-size: 100% 1px; }
  html.m .ep-link:hover { transform: translateX(6px); }
  html.m .contact-form .submit-btn { position: relative; isolation: isolate; overflow: hidden; }
  html.m .contact-form .submit-btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--grey); scale: 0 1; transform-origin: left; transition: scale 0.9s var(--m-ease); }
  html.m .contact-form .submit-btn:hover::before { scale: 1 1; }
}
