/* ==========================================================================
   Site menu (October 2026)
   --------------------------------------------------------------------------
   "MENU" in the header's top right corner opens a panel that slides in from
   the right on a computer and fills the screen on a phone. Loaded on every
   page after style.css; the markup is written into every page by
   build/apply-site-menu.py, never by hand.

   Works without JavaScript: the button is a link to #site-menu and the panel
   shows when it is the :target (only while menu.js has not run: once it has,
   html carries .has-menu-js and the .is-open class alone decides). menu.js turns that into a proper dialog
   (no jump, focus kept inside, Esc closes, the page behind does not scroll).
   No text below 12px, the site's floor.
   ========================================================================== */

/* ---- the button in the header ------------------------------------------- */
.menu-open {
  position: absolute;
  top: 10px;                         /* level with the flags, and clear of the wordmark below */
  right: 6px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 24px;
  padding: 0 10px;
  color: var(--ivory);
  font-family: var(--serif-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
}
.menu-open::before { content: ""; position: absolute; inset: -10px -4px 0; }   /* a taller target, upwards only */
.menu-open .menu-arrow { font-size: 22px; letter-spacing: 0; line-height: .5; }
.menu-open .menu-bars { display: none; }
.menu-open:hover { color: var(--gold-soft); }
.menu-open:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: -2px; }

/* the language flags move left to make room for the button */
.header-inner .lang-switch { right: 152px; }

@media (max-width: 700px) {
  .menu-open { top: 0; right: 0; min-height: 38px; gap: 9px; padding: 0 10px; font-size: 13px; letter-spacing: .18em; }
  .menu-open::before { content: none; }
  .menu-open .menu-arrow { display: none; }
  .menu-open .menu-bars { display: block; width: 22px; height: 15px; }
  .header-inner .lang-switch { right: 122px; }
}
/* a narrow phone: the bars alone, the word kept for screen readers */
@media (max-width: 374px) {
  .menu-open { min-width: 44px; justify-content: center; padding: 0 10px; }
  .menu-open .menu-word {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
  .header-inner .lang-switch { right: 58px; }
}

/* ---- the panel ------------------------------------------------------------ */
.site-menu {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  pointer-events: none;
}
html:not(.has-menu-js) .site-menu:target,
.site-menu.is-open {
  visibility: visible;
  pointer-events: auto;
}

.site-menu-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 37, 27, .62);
  opacity: 0;
  transition: opacity .3s ease;
}
html:not(.has-menu-js) .site-menu:target .site-menu-scrim,
.site-menu.is-open .site-menu-scrim { opacity: 1; }

.site-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 30px 40px 36px;
  background: #f7f4ec;
  color: var(--ink);
  box-shadow: -18px 0 48px rgba(15, 37, 27, .22);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
html:not(.has-menu-js) .site-menu:target .site-menu-panel,
.site-menu.is-open .site-menu-panel { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .site-menu-scrim, .site-menu-panel { transition: none; }
}

.site-menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(169, 133, 72, .75);
}
.site-menu-title {
  margin: 0;
  font-family: var(--serif-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .3em;
  text-transform: uppercase;
}
.site-menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  color: var(--ink);
}
.site-menu-close svg { width: 26px; height: 26px; }
.site-menu-close:hover { color: var(--gold-ink); }

.site-menu a:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }

/* the six main places, numbered as on the magazine's own contents page */
.site-menu-main {
  margin: 0;
  padding: 18px 0 20px;
  list-style: none;
  border-bottom: 1px solid rgba(169, 133, 72, .75);
}
.site-menu-main a {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: baseline;
  gap: 0 8px;
  padding: 13px 0;
  color: var(--ink);
  text-decoration: none;
}
.site-menu-main .n {
  color: var(--gold-ink);
  font-family: var(--serif-display);
  font-size: 22px;
  font-variant-numeric: lining-nums;
}
.site-menu-main .t {
  font-family: var(--serif-display);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.site-menu-main small {
  display: block;
  margin-top: 6px;
  color: var(--paper-ink);
  font-size: max(13px, 12px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .16em;
}
.site-menu-main .arr,
.site-menu-more .arr { font-size: 22px; line-height: 1; transition: transform .2s ease; }
.site-menu-main a:hover .t,
.site-menu-more a:hover { color: var(--gold-ink); }
.site-menu-main a:hover .arr,
.site-menu-more a:hover .arr { transform: translateX(4px); }
.site-menu a[aria-current="page"] .t,
.site-menu-more a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* the "about" pages */
.site-menu-more {
  margin: 0;
  padding: 18px 0 20px;
  list-style: none;
  border-bottom: 1px solid rgba(169, 133, 72, .75);
}
.site-menu-more a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 0 0 10px;
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .18em;
  text-decoration: none;
  text-transform: uppercase;
}
.site-menu-more .arr { font-size: 19px; }

/* Instagram, LinkedIn, write to us */
.site-menu-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 18px;
  margin: 0;
  padding: 18px 0 0;
  list-style: none;
}
.site-menu-social a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .16em;
  text-decoration: none;
  text-transform: uppercase;
}
.site-menu-social a:hover { color: var(--gold-ink); }
.site-menu-social svg { width: 12px; height: 12px; }

/* the page behind stays still while the panel is open */
html.menu-is-open,
html.menu-is-open body { overflow: hidden; }

@media (max-width: 374px) {
  .site-menu-main a { grid-template-columns: 36px 1fr auto; }
  .site-menu-main .t { font-size: 18px; letter-spacing: .02em; }
  .site-menu-main .n { font-size: 18px; }
}
.site-menu-main .t { overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .site-menu-panel { padding: 22px 22px 30px; box-shadow: none; }
  .site-menu-main a { grid-template-columns: 44px 1fr auto; padding: 11px 0; }
  .site-menu-main .n { font-size: 20px; }
  .site-menu-main .t { font-size: 22px; }
  .site-menu-more a { padding-left: 0; font-size: 14px; letter-spacing: .14em; }
  .site-menu-social { justify-content: flex-start; gap: 0 22px; }
}

@media print {
  .menu-open, .site-menu { display: none !important; }
}
