/* Shared by every page: reset, colours, header, menu, language switch and footer.
   Each page's own <style> (or home.css) comes after this and can override it. */

/* Scilla (titles), self-hosted. Syne and Figtree are in fonts/fonts.css. */
@font-face { font-family: 'Scilla'; src: url('../fonts/scilla-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Scilla'; src: url('../fonts/scilla-regularitalic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

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

:root {
  --margin-side: 8vw;
  --header-h: 96px;
  --bg:     #141414;
  --text:   #DDBCB8;
  --alt:    #D4831A;
  --accent: #C4B430;
  --link:   #FF7B68;
  --hover:  var(--text);
}

/* ── Header ── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0 var(--margin-side);
  background: var(--bg);
}

.logo-link { display: inline-flex; flex-shrink: 0; }

.logo {
  height: 68px;
  width: auto;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.logo-link:hover .logo {
  transform: scale(1.06);
  filter: sepia(1) saturate(0.6) hue-rotate(-40deg) /* same colour as 320deg, but animates the short way (no cyan flash) */ brightness(1.1);
}

nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  flex-wrap: wrap;
}

nav a {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  text-decoration: none;
  color: var(--link);
  letter-spacing: 0.03em;
  position: relative;
  padding-bottom: 3px;
  transition: color 0.2s ease;
  cursor: pointer;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--hover);
  transition: width 0.25s ease;
}

nav a:hover          { color: var(--hover); }
nav a:hover::after   { width: 100%; }
nav a.active         { color: var(--accent); }
nav a.active::after  { width: 100%; background: var(--accent); }

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-right: -1.2rem;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(0.8rem, 1.1vw, 0.9rem);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.lang-toggle button {
  background: none;
  border: none;
  padding: 0 0 3px;
  font: inherit;
  color: var(--link);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.lang-toggle button::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--link);
  transition: width 0.25s ease;
}

.lang-toggle button:hover           { color: var(--hover); }
.lang-toggle button.active          { color: var(--link); }
.lang-toggle button.active::after   { width: 100%; }

.lang-toggle .lang-divider {
  color: var(--text);
  opacity: 0.4;
}

/* ── Dropdowns under Portfolio / Contact: fade in on hover (or keyboard focus), fade out when the pointer leaves. */
.nav-item { position: relative; display: flex; }
.nav-sub {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 6px);
  padding-top: 0.6rem; /* invisible bridge so it doesn't close on the way down */
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  z-index: 5;
}
.nav-sub::before {
  content: '';
  position: absolute;
  inset: 0.6rem 0 0;
  background: rgba(20,20,20,0.92);
  border-radius: 12px;
  z-index: -1;
}
.nav-item:hover .nav-sub,
.nav-item:has(:focus-visible) .nav-sub { /* keyboard focus only — a mouse click doesn't keep it open */
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}
#nav .nav-sub a {
  color: var(--link);
  font-size: 0.85rem;
  padding: 0.45rem 1.1rem;
  white-space: nowrap;
}
#nav .nav-sub a:hover { color: var(--hover); }
#nav .nav-sub a::after { display: none; }
@media (max-width: 600px) {
  .nav-item { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
  .nav-sub {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 0 0 0 1rem;
    align-items: flex-start;
    gap: 0.7rem;
  }
  /* A tap counts as hover on phones: don't let the desktop dropdown's centring shift kick in */
  .nav-item:hover .nav-sub,
  .nav-item:has(:focus-visible) .nav-sub { transform: none; }
  .nav-sub::before { display: none; }
  #nav .nav-sub a { font-size: 0.95rem; padding: 0; }
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 26px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px)  rotate(45deg);  }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 600px) {
  :root { --margin-side: 5vw; --header-h: 64px; }

  .hamburger { display: flex; }

  nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 1.2rem var(--margin-side) 1.5rem;
    background: rgba(20,20,20,0.97);
    backdrop-filter: blur(12px);
    z-index: 99;
  }

  nav.open { display: flex; }
  nav a { font-size: 1.1rem; }
}
.site-footer::before {
  content: '';
  display: block;
  height: 1px;
  margin-bottom: 4vh;
  background: var(--text);
  opacity: 0.5; /* × the footer's own 0.5 → a soft line */
}

/* Footer: © line centred, contact links on the right (stacked on phones) */
.footer-row { position: relative; display: flex; justify-content: center; align-items: center; }
.footer-contact { position: absolute; right: 0; display: flex; align-items: center; gap: 1rem; }
.footer-contact a { display: inline-flex; color: inherit; text-decoration: none; transition: color 0.2s ease; }
.footer-contact a:hover { color: var(--link); }
.footer-icon { width: 16px; height: 16px; }
@media (max-width: 600px) {
  .footer-row { flex-direction: column; gap: 1rem; }
  .footer-contact { position: static; }
}
/* Phones: the language switch is the last item of the menu (moved there by i18n.js) */
@media (max-width: 600px) {
  #nav .lang-toggle { margin: 0.3rem 0 0; font-size: 0.95rem; }
  #nav .lang-toggle button,
  #nav .lang-toggle .lang-divider { color: var(--text); }
  #nav .lang-toggle button.active { color: var(--link); }
  #nav .lang-toggle button::after { background: var(--link); }
  /* Narrow phones: logo and menu button always fit side by side */
  .header-right { position: absolute; }
  .logo { max-width: calc(100vw - 2 * var(--margin-side) - 3.5rem); object-fit: contain; }
}

/* Visitors who ask their device for less motion get near-instant animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
