@font-face {
  font-family: Instrument;
  src: url('../remi-portfolio-studio/assets/instrument-sans.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

.rgh-header {
  --rgh-paper: #f6f4ee;
  --rgh-ink: #20231f;
  --rgh-muted: #65685f;
  --rgh-line: #d9dbd1;
  --rgh-accent: #db532e;
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  color: var(--rgh-ink);
  background: color-mix(in srgb, var(--rgh-paper) 96%, transparent);
  border-bottom: 1px solid var(--rgh-line);
  font-family: Instrument, Arial, sans-serif;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

html[data-theme="dark"] .rgh-header {
  --rgh-paper: #11151a;
  --rgh-ink: #f5efe8;
  --rgh-muted: #b7b2aa;
  --rgh-line: #2c3239;
  --rgh-accent: #ddb282;
}

body.admin-bar .rgh-header { top: 32px; }

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

.rgh-shell {
  width: min(1280px, calc(100% - 112px));
  margin-inline: auto;
}

.rgh-header__inner {
  position: relative;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.rgh-brand,
.rgh-brand:visited {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  color: var(--rgh-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}

.rgh-brand { order: 1; }

.rgh-brand__mark {
  position: relative;
  padding-right: 17px;
  font-size: 48px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.12em;
}

.rgh-brand__mark span {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--rgh-accent);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 0;
}

.rgh-brand__mark span svg {
  display: block;
  width: .75em;
  height: 1em;
}

.rgh-brand__caption {
  display: block;
  margin-top: 5px;
  color: var(--rgh-muted);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .035em;
}

.rgh-panel,
.rgh-panel nav { min-width: 0; }
.rgh-panel { order: 2; margin-left: auto; }

.rgh-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  font-weight: 500;
}

.rgh-nav__item { position: relative; }
.rgh-nav__parent-row { display: flex; align-items: center; gap: 5px; }

@media (min-width: 861px) {
  .rgh-nav__item--has-children::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 3;
    width: min(310px, 80vw);
    height: 12px;
    transform: translateX(-50%);
  }
}

.rgh-nav a,
.rgh-nav a:visited,
.rgh-nav__submenu-toggle {
  color: var(--rgh-ink);
  font: inherit;
  text-decoration: none;
}

.rgh-nav a:not(.rgh-nav__contact),
.rgh-nav__submenu-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
}

.rgh-nav a:not(.rgh-nav__contact)::after,
.rgh-nav__submenu-toggle::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 5px;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}

.rgh-nav a:hover::after,
.rgh-nav a:focus-visible::after,
.rgh-nav__submenu-toggle:hover::after,
.rgh-nav__submenu-toggle:focus-visible::after { transform: scaleX(1); }

.rgh-nav__submenu-toggle,
.rgh-menu-toggle,
.rgh-theme-toggle,
.rgh-drill__back {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.rgh-nav__submenu-toggle { padding: 10px 0; }
.rgh-nav__submenu-toggle::after { display: none; }

.rgh-nav__submenu-toggle svg { transition: transform .2s ease; }
.rgh-nav__submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.rgh-header .rgh-nav__contact,
.rgh-header .rgh-nav__contact:visited {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  border-radius: 3px;
  color: #fff;
  background: #000;
  transition: color .2s ease, background .2s ease;
}

.rgh-header .rgh-nav__contact:hover,
.rgh-header .rgh-nav__contact:focus-visible {
  color: #fff;
  background: #000;
}

.rgh-nav__contact-icon {
  display: block;
  flex: 0 0 auto;
}

.rgh-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 4;
  width: min(310px, 80vw);
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid var(--rgh-line);
  border-radius: 10px;
  color: var(--rgh-ink);
  background: var(--rgh-paper);
  box-shadow: 0 18px 45px rgba(13, 12, 34, .13);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .3s ease, transform .3s cubic-bezier(.22,.61,.36,1), visibility 0s linear .3s;
}

.rgh-nav__item--has-children:hover .rgh-submenu,
.rgh-nav__item--has-children:focus-within .rgh-submenu,
.rgh-nav__item--has-children.is-open .rgh-submenu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity .3s ease, transform .3s cubic-bezier(.22,.61,.36,1), visibility 0s;
}

.rgh-nav__item--has-children.is-suppressed .rgh-submenu,
.rgh-nav__item--has-children.is-suppressed:focus-within .rgh-submenu {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
}

.rgh-submenu a,
.rgh-submenu a:visited {
  display: block;
  padding: 11px 12px !important;
  border-radius: 6px;
  color: var(--rgh-ink);
  line-height: 1.35;
}

.rgh-submenu a::after { display: none; }
.rgh-submenu a:hover,
.rgh-submenu a:focus-visible { background: color-mix(in srgb, var(--rgh-accent) 10%, transparent); }

.rgh-header__actions {
  order: 3;
  display: flex;
  align-items: center;
  gap: 9px;
}

.rgh-theme-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rgh-line);
  border-radius: 50%;
  color: var(--rgh-ink);
}

.rgh-theme-toggle__moon { display: none; }
.rgh-theme-toggle[aria-pressed="true"] .rgh-theme-toggle__sun { display: none; }
.rgh-theme-toggle[aria-pressed="true"] .rgh-theme-toggle__moon { display: inline-flex; }

.rgh-menu-toggle {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 10px 13px;
  border: 1px solid var(--rgh-line);
  border-radius: 3px;
  color: var(--rgh-ink);
  font: 500 12px Instrument, Arial, sans-serif;
}

.rgh-menu-toggle__icon {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transition: transform .46s cubic-bezier(.22,.61,.36,1);
}

.rgh-menu-toggle[aria-expanded="true"] .rgh-menu-toggle__icon { transform: rotate(45deg); }
.rgh-drill { display: none; }

.rgh-header a:focus-visible,
.rgh-header button:focus-visible {
  outline: 3px solid var(--rgh-accent);
  outline-offset: 4px;
}

@media (max-width: 1100px) {
  .rgh-shell { width: calc(100% - 72px); }
  .rgh-nav { gap: 20px; font-size: 13px; }
  .rgh-brand__caption { font-size: 10px; }
}

@media (max-width: 860px) {
  .rgh-shell { width: calc(100% - 48px); }
  .rgh-header__inner { min-height: 92px; }
  .rgh-brand { font-size: 14px; }
  .rgh-brand__mark { font-size: 43px; }
  .rgh-header__actions,
  .rgh-menu-toggle { display: flex; }

  .rgh-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 100vw;
    max-height: calc(100vh - 92px);
    overflow: hidden auto;
    padding: 22px 24px 28px;
    border-bottom: 1px solid var(--rgh-line);
    color: var(--rgh-ink);
    background: var(--rgh-paper);
    box-shadow: 0 20px 40px rgba(13, 12, 34, .12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(-50%, -24px, 0);
    transition: opacity .52s ease, transform .52s cubic-bezier(.22,.61,.36,1), visibility 0s linear .52s;
  }

  .rgh-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(-50%, 0, 0);
    transition: opacity .52s ease, transform .52s cubic-bezier(.22,.61,.36,1), visibility 0s;
  }

  .rgh-panel nav { transition: opacity .56s ease, transform .56s cubic-bezier(.22,.61,.36,1); }
  .rgh-panel.is-drilled nav { opacity: .25; transform: translateX(-20px); pointer-events: none; }

  .rgh-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    width: min(100%, 680px);
    margin-inline: auto;
    font-size: 17px;
  }

  .rgh-nav__item { border-bottom: 1px solid var(--rgh-line); }
  .rgh-nav a:not(.rgh-nav__contact),
  .rgh-nav__parent-row {
    min-height: 52px;
  }

  .rgh-nav__parent-row {
    display: grid;
    grid-template-columns: 1fr 48px;
    align-items: stretch;
    gap: 0;
  }

  .rgh-nav__parent-row > a {
    display: flex !important;
    align-items: center;
    padding: 12px 2px !important;
  }

  .rgh-nav__submenu-toggle {
    width: 48px;
    min-height: 52px;
    justify-content: center;
    padding: 0;
  }

  .rgh-nav a::after,
  .rgh-nav__submenu-toggle::after { display: none; }
  .rgh-submenu { display: none; }

  .rgh-nav__contact,
  .rgh-nav__contact:visited {
    justify-content: space-between;
    margin-top: 18px;
    padding: 14px 16px;
  }

  .rgh-drill {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    min-height: 100%;
    padding: 22px 24px 28px;
    color: var(--rgh-ink);
    background: var(--rgh-paper);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(42px, 0, 0);
    transition: opacity .56s ease, transform .56s cubic-bezier(.22,.61,.36,1), visibility 0s linear .56s;
  }

  .rgh-drill.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    transition: opacity .56s ease, transform .56s cubic-bezier(.22,.61,.36,1), visibility 0s;
  }

  .rgh-drill__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100%, 680px);
    margin: 0 auto 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--rgh-line);
  }

  .rgh-drill__header p { margin: 0; font-weight: 600; }
  .rgh-drill__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--rgh-ink);
    font: inherit;
  }

  .rgh-drill ul {
    width: min(100%, 680px);
    margin: 0 auto;
    padding: 0;
    list-style: none;
  }

  .rgh-drill li { border-bottom: 1px solid var(--rgh-line); }
  .rgh-drill a,
  .rgh-drill a:visited {
    display: block;
    padding: 15px 2px;
    color: var(--rgh-ink);
    text-decoration: none;
  }

  body.rgh-menu-open { overflow: hidden; }
}

@media (max-width: 782px) {
  body.admin-bar .rgh-header { top: 0; }
}

@media (max-width: 600px) {
  .rgh-shell { width: calc(100% - 40px); }
  .rgh-header__inner { min-height: 83px; }
  .rgh-brand__mark { font-size: 39px; }
  .rgh-brand__mark span { font-size: 24px; }
  .rgh-brand__caption { font-size: 9px; }
  .rgh-panel { max-height: calc(100vh - 83px); padding-inline: 20px; }
  .rgh-theme-toggle { width: 39px; height: 39px; }
}

@media (max-width: 359px) {
  .rgh-shell { width: calc(100% - 32px); }
  .rgh-brand { gap: 9px; font-size: 12px; }
  .rgh-brand__mark { padding-right: 13px; font-size: 35px; }
  .rgh-brand__mark span { font-size: 21px; }
  .rgh-brand__caption { font-size: 8px; }
  .rgh-menu-toggle { gap: 8px; padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .rgh-header *,
  .rgh-header *::before,
  .rgh-header *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .rgh-header .rgh-menu-toggle__icon {
    transition: transform .46s cubic-bezier(.22,.61,.36,1) !important;
  }
  .rgh-header .rgh-panel {
    transition: opacity .52s ease, transform .52s cubic-bezier(.22,.61,.36,1), visibility 0s linear .52s !important;
  }
  .rgh-header .rgh-panel.is-open {
    transition: opacity .52s ease, transform .52s cubic-bezier(.22,.61,.36,1), visibility 0s !important;
  }
  .rgh-header .rgh-panel nav {
    transition: opacity .56s ease, transform .56s cubic-bezier(.22,.61,.36,1) !important;
  }
  .rgh-header .rgh-drill {
    transition: opacity .56s ease, transform .56s cubic-bezier(.22,.61,.36,1), visibility 0s linear .56s !important;
  }
  .rgh-header .rgh-drill.is-active {
    transition: opacity .56s ease, transform .56s cubic-bezier(.22,.61,.36,1), visibility 0s !important;
  }
}

/* Match the shared header to each template's established content shell. */
body.remi-portfolio-page:not(.remi-project-page):not(.remi-blog-page) .rgh-shell {
  width: min(1180px, calc(100% - clamp(28px, 5vw, 40px)));
}

body.remi-project-page .rgh-shell {
  width: min(1280px, calc(100% - clamp(28px, 10vw, 140px)));
}

body.remi-blog-page .rgh-shell {
  width: min(1140px, calc(100% - 40px));
}

body.remi-global-header-theme-page #masthead {
  display: none;
}

body.remi-global-header-theme-page .rgh-shell {
  width: min(
    var(--global-content-width, 1290px),
    calc(100% - (2 * var(--global-content-edge-padding, 1.5rem)))
  );
}
