/* Site chrome: type-only masthead + footer contact row. Shared by every page. */

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.masthead-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--measure);
  height: 4.5rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

@media (min-width: 640px) {
  .masthead-bar {
    height: 5.5rem;
    padding: 0 2rem;
  }
}

.masthead-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  white-space: nowrap;
}

/* Inner pages: "Home" with a handwritten note on hover */
.masthead-name {
  position: relative;
}

.masthead-note {
  position: absolute;
  top: calc(100% + 0.1rem);
  left: 0.55rem;
  display: flex;
  align-items: flex-end;
  gap: 0.15rem;
  pointer-events: none;
  color: var(--muted);
  white-space: nowrap;
}

.masthead-note-arrow {
  width: 1.9rem;
  height: 1.6rem;
  flex-shrink: 0;
  /* Hidden at rest: round line caps would otherwise leave a dot */
  opacity: 0;
  transition: opacity 0.12s ease;
}

.masthead-name:hover .masthead-note-arrow,
.masthead-name:focus-visible .masthead-note-arrow {
  opacity: 1;
}

.masthead-note-arrow path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.masthead-note-text {
  font-family: 'Reenie Beanie', 'Bradley Hand', 'Segoe Print', cursive;
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
  transform: translateY(0.55rem) rotate(-4deg);
  transform-origin: left bottom;
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .masthead-note-arrow path {
    transition: stroke-dashoffset 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .masthead-note-arrow path + path {
    transition-delay: 0s;
  }

  .masthead-note-text {
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .masthead-name:hover .masthead-note-arrow path,
  .masthead-name:focus-visible .masthead-note-arrow path {
    stroke-dashoffset: 0;
  }

  .masthead-name:hover .masthead-note-arrow path + path,
  .masthead-name:focus-visible .masthead-note-arrow path + path {
    transition-delay: 0.28s;
  }

  .masthead-name:hover .masthead-note-text,
  .masthead-name:focus-visible .masthead-note-text {
    opacity: 1;
    transform: translateY(0.35rem) rotate(-4deg);
    transition-delay: 0.18s;
  }
}

@media (hover: none), (pointer: coarse) {
  .masthead-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .masthead-note-arrow path,
  .masthead-note-text {
    transition: none !important;
  }
}

/* Avatar sized to the name's text height */
.masthead-avatar {
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  outline: 1px solid color-mix(in oklab, var(--fg) 12%, transparent);
  outline-offset: -1px;
}

.masthead-nav {
  display: none;
  align-items: center;
  gap: 1.75rem;
}

@media (min-width: 640px) {
  .masthead-nav { display: flex; }
}

.masthead-nav a,
.masthead-cta,
.masthead-toggle {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  white-space: nowrap;
  cursor: pointer;
}

.masthead-nav a {
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.masthead-nav a:hover,
.masthead-nav a[aria-current="page"] {
  color: var(--fg);
}

.masthead-cta {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.2s var(--ease);
}

.masthead-cta:hover {
  text-decoration-color: var(--accent);
}

.masthead-toggle {
  color: var(--fg);
  padding: 0.75rem 0;
}

@media (min-width: 640px) {
  .masthead-toggle { display: none; }
}

/* Mobile sheet */
.masthead-sheet {
  display: none;
}

.masthead.is-open {
  background: var(--bg);
}

.masthead.is-open .masthead-sheet {
  position: fixed;
  top: 4.5rem;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  /* Inline padding lines the sheet up with the masthead name and page text */
  padding: 1.5rem calc((100vw - var(--measure)) / 2 + 1.25rem) calc(2rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  overflow-y: auto;
  animation: sheet-in 0.28s var(--ease) both;
}

@media (min-width: 640px) {
  .masthead.is-open .masthead-sheet { display: none; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

html.is-sheet-open,
html.is-sheet-open body {
  overflow: hidden;
}

.sheet-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sheet-links a,
.sheet-links button {
  padding: 0.3rem 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--fg);
  cursor: pointer;
}

.sheet-links [data-book-call] {
  color: var(--accent);
}

.sheet-links a[aria-current="page"] {
  color: var(--muted);
}

.sheet-minor {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.sheet-minor a,
.sheet-minor button,
.footer-links a,
.footer-links button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.sheet-minor a:hover,
.sheet-minor button:hover,
.footer-links a:hover,
.footer-links button:hover {
  color: var(--fg);
}

/* Footer contact row */
.site-footer.site-footer {
  justify-content: space-between;
  align-items: baseline;
  text-align: left;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.footer-links a,
.footer-links button {
  font-size: 0.875rem;
}

/* Booking drawer slides the page left; keep the masthead with it */
html.is-book-open .masthead {
  transform: translateX(calc(-1 * var(--book-w)));
}

/* Portfolio case-study overlay hides the page chrome */
body.stage-open .masthead {
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .masthead { transition: none; }
  .masthead.is-open .masthead-sheet { animation: none; }
}
