/* ==========================================================================
   ST. SEBASTIAN HOME — Дом Светог Севастијана
   One screen: header, map, footer. No scrolling.
   Header: the title lettering, traced from the artwork (images/title-*.svg)
   Type:   Helvetica Neue, light (labels, footer) — system font
   Background and rules follow the Milojević + Wilde site.
   ========================================================================== */

:root{
  --bg:       #F9F9F7;
  --ink:      #1C1B18;
  --ink-soft: #6B6A62;
  --line:     #DFDFDB;
  --red:      #9E3729;   /* the red of the title artwork */

  --f-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --pad: clamp(20px, 5vw, 64px);
  --header-h: clamp(64px, calc(3.4vw + 48px), 88px);
  --lang-speed: .7s;
}

*, *::before, *::after{ box-sizing: border-box; }

html, body{
  height: 100%;
  margin: 0;
  overflow: hidden;              /* one screen, no scrolling */
  overscroll-behavior: none;
}
html{ background: var(--bg); -webkit-text-size-adjust: 100%; }
body{
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible{ outline: 1.5px solid var(--ink); outline-offset: 4px; }
::selection{ background: var(--ink); color: var(--bg); }

/* ==========================================================================
   TWO LANGUAGES — both versions sit in the same spot; one fades into the other
   ========================================================================== */
.bi{ display: inline-grid; }
.bi > [data-l]{
  grid-area: 1 / 1;
  transition: opacity var(--lang-speed) ease, filter var(--lang-speed) ease;
}
.lang-en .bi > [data-l="sr"],
.lang-sr .bi > [data-l="en"]{
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header{
  flex: none;
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand{
  /* one unit = one pixel of the original artwork; both lines share it,
     so English and Serbian are drawn at exactly the same letter size */
  --u: min(.56px, calc((100vw - 2 * var(--pad) - 60px) / 858));
  align-items: start;
}
.brand img{ display: block; width: auto; }
.brand .t-en{ height: calc(var(--u) * 64); }
.brand .t-sr{ height: calc(var(--u) * 78); margin-top: calc(var(--u) * -1); }

/* language button: a small flag, same footprint as the M+W menu icon */
.lang-btn{
  position: relative;
  flex: none;
  width: 26px;
  height: 17px;
}
.flag{
  position: absolute;
  inset: 0;
  width: 26px;
  height: 17px;
  border-radius: 1.5px;
  box-shadow: 0 0 0 .5px rgba(28, 27, 24, .22);
  transition: opacity var(--lang-speed) ease, transform .3s ease;
}
.lang-en .flag-us,
.lang-sr .flag-rs{ opacity: 0; pointer-events: none; }
.lang-btn:hover .flag{ transform: translateY(-1px); }

/* ==========================================================================
   MAP
   ========================================================================== */
.stage{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.stage canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.map-coast{
  opacity: 0;
  transition: opacity 2.4s cubic-bezier(.4,0,.2,1);
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 10%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 10%, #000 90%, transparent 100%);
          mask-composite: intersect;
}
.map-coast.is-on{ opacity: 1; }
.map-coast.is-late{ transition-duration: 1.2s; }

.map-label{
  position: absolute;
  left: 0; top: 0;
  z-index: 2;
  font-size: 12px;
  line-height: 1;
  letter-spacing: .05em;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0;
  transition: opacity .9s ease;
  pointer-events: none;
}
.map-label.is-on{ opacity: 1; }
.map-label.is-red{ color: var(--red); font-weight: 500; font-size: 12.5px; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer{
  flex: none;
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding: 20px var(--pad) calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: .72rem;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
}
.f-right{ justify-items: end; }

@media (max-width: 600px){
  .site-footer{ font-size: .64rem; letter-spacing: .06em; padding-top: 16px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .map-label{ font-size: 10.5px; }
  .map-label.is-red{ font-size: 11px; }
  .site-footer{ flex-direction: column; }
  .f-right{ justify-items: start; }
}

/* ==========================================================================
   INTRO — header text, flag and footer arrive once the line reaches Jackson
   ========================================================================== */
.js .brand,
.js .lang-btn,
.js .site-footer > *{
  opacity: 0;
  transition: opacity 1.1s cubic-bezier(.33,0,.2,1), transform 1.1s cubic-bezier(.2,.7,.2,1);
}
.js .brand{ transform: translateY(-5px); }
.js .site-footer > *{ transform: translateY(5px); }
.chrome-in .brand,
.chrome-in .lang-btn,
.chrome-in .site-footer > *{ opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce){
  .js .brand, .js .lang-btn, .js .site-footer > *{ transition: none; }
  .map-label{ transition: none; }
  .bi > [data-l]{ transition-duration: .2s; }
}
