/* ==========================================================================
   Madison Ave Magazine — Shared Stylesheet
   Fonts · Design tokens · Header · Footer · Skip link · Container
   Enqueued on every MAM page (homepage, article, search).
   Page-specific styles live in homepage.css, article.css, search.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   @font-face — Self-hosted (served from /assets/fonts/)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/playfair-display-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/playfair-display-900.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/playfair-display-700-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-mono-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/source-serif-4-400-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   Design tokens — all pages
   -------------------------------------------------------------------------- */
:root {
  /* Palette */
  --mam-bg:           #f5f2ec;
  --mam-text:         #1a1a1a;
  --mam-text-muted:   #666260;
  --mam-text-body:    #3a3733;
  --mam-accent:       #c99e66;
  --mam-border:       #e0dbd2;
  --mam-border-light: #d4cfc8;
  --mam-black:        #0d0d0d;
  --mam-white:        #ffffff;
  --mam-sand:         #f0ece4;
  --mam-dark-bg:      #0d0d0d;

  /* Typography */
  --font-serif:  'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono:   'DM Mono', 'Courier New', monospace;
  --font-body:   'Source Serif 4', Georgia, serif;
  --font-sans:   system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing & layout */
  --mam-max-w:       1240px;
  --mam-gutter:      24px;
  --mam-content-w:   952px;
  --mam-sidebar-w:   280px;
  --mam-col-gap:     32px;
  --mam-section-v:   52px;
}

/* --------------------------------------------------------------------------
   Universal base reset — must come before all utility classes so that
   class-level specificity (0-1-0) always beats this (0-0-0).
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Skip link — accessibility
   -------------------------------------------------------------------------- */
.mam-skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--mam-black);
  color: var(--mam-white);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 0 0 4px 4px;
  transition: top .15s;
}
.mam-skip-link:focus { top: 0; text-decoration: none; }

/* --------------------------------------------------------------------------
   Shared utilities
   -------------------------------------------------------------------------- */
.mam-container {
  max-width: var(--mam-max-w);
  margin-inline: auto;
  padding-inline: var(--mam-gutter);
}
.mam-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--mam-text-muted);
  line-height: 1;
}
.mam-label--accent { color: var(--mam-accent); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.mam-header {
  background: var(--mam-bg);
  border-bottom: 1px solid var(--mam-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mam-header__inner {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  align-items: center;
  padding-block: 20px 0;
}
.mam-header__utility { display: flex; align-items: center; gap: 14px; }
.mam-header__utility--right { justify-content: flex-end; }
.mam-header__logo { text-align: center; }
.mam-header__logo .custom-logo-link,
.mam-header__logo a { display: inline-block; }
.mam-header__logo .custom-logo { max-height: 52px; width: auto; height: auto; }
.mam-header__logo-text {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--mam-text);
}
/* Search trigger button */
.mam-header__search-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--mam-text-muted);
  transition: color .2s;
}
.mam-header__search-btn:hover { color: var(--mam-text); }

/* --------------------------------------------------------------------------
   Header search — inline expand from the icon
   -------------------------------------------------------------------------- */
.mam-header__search {
  display: flex;
  align-items: center;
  position: relative;
}

/* The expanding form sits right after the icon button */
.mam-header__search-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: max-width .3s ease, opacity .2s ease;
}
.mam-header__search.is-open .mam-header__search-inline {
  max-width: 220px;
  opacity: 1;
  pointer-events: auto;
}
.mam-header__search-input {
  width: 180px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--mam-border);
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--mam-text);
  padding: 3px 0 3px 6px;
  outline: none;
  min-width: 0;
  transition: border-color .2s;
}
.mam-header__search-input:focus { border-color: var(--mam-accent); }
.mam-header__search-input::placeholder { color: var(--mam-text-muted); }
.mam-header__search-input::-webkit-search-decoration,
.mam-header__search-input::-webkit-search-cancel-button { display: none; }
.mam-header__search-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mam-text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .15s;
}
.mam-header__search-close:hover { color: var(--mam-text); }
.mam-header__subscribe {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: #000 !important;
  border: none;
  padding: 10px 20px;
  color: #fff !important;
  transition: background .2s;
  white-space: nowrap;
}
.mam-header__subscribe:hover { background: #222 !important; color: #fff !important; text-decoration: none; }

/* Hamburger — mobile only */
.mam-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mam-text);
  padding: 4px;
  line-height: 0;
}

/* Primary nav */
.mam-nav-wrap {
  border-top: 1px solid var(--mam-border);
  margin-top: 16px;
}
.mam-nav-wrap ul.mam-nav,
.mam-nav-wrap ul.menu {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 12px 0;
  list-style: none;
}
.mam-nav-wrap ul.mam-nav li a,
.mam-nav-wrap ul.menu li a {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--mam-text-muted);
  transition: color .2s;
}
.mam-nav-wrap ul.mam-nav li a:hover,
.mam-nav-wrap ul.menu li a:hover,
.mam-nav-wrap ul.menu li.current-menu-item > a { color: var(--mam-text); text-decoration: none; }
.mam-nav-wrap ul.menu .sub-menu { display: none; }

/* --------------------------------------------------------------------------
   Mobile navigation — backdrop
   -------------------------------------------------------------------------- */
.mam-mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
body.mam-nav-open .mam-mobile-nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Mobile navigation — drawer
   -------------------------------------------------------------------------- */
.mam-mobile-nav {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(340px, 88vw);
  background: #0d0d0d;
  z-index: 200;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition:
    transform  .38s cubic-bezier(0.4, 0, 0.2, 1),
    visibility  0s  linear .38s;
}
.mam-mobile-nav.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition:
    transform  .38s cubic-bezier(0.4, 0, 0.2, 1),
    visibility  0s  linear 0s;
}

/* Drawer header row */
.mam-mobile-nav__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 18px 20px 14px;
  flex-shrink: 0;
}

/* Close button */
.mam-mobile-nav__close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
  cursor: pointer;
  color: rgba(255, 255, 255, .7);
  width: 34px;
  height: 34px;
  padding: 0;
  flex-shrink: 0;
  line-height: 0;
  transition: background .15s, color .15s;
}
.mam-mobile-nav__close:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

/* Primary nav links — large editorial serif */
#mam-mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#mam-mobile-nav > ul {
  padding: 12px 0 4px;
  flex-shrink: 0;
}
#mam-mobile-nav > ul > li {
  border-bottom: none;
}
#mam-mobile-nav > ul > li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  color: rgba(255, 255, 255, .82);
  padding: 13px 28px;
  text-decoration: none;
  transition: color .18s;
}
#mam-mobile-nav > ul > li > a::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: .35;
  flex-shrink: 0;
  margin-left: 12px;
  transition: opacity .18s, transform .18s;
}
#mam-mobile-nav > ul > li > a:hover {
  color: var(--mam-accent);
  text-decoration: none;
}
#mam-mobile-nav > ul > li > a:hover::after {
  opacity: .8;
  transform: rotate(45deg) translate(2px, -2px);
}
#mam-mobile-nav > ul > li.current-menu-item > a,
#mam-mobile-nav > ul > li.current-menu-ancestor > a {
  color: var(--mam-accent);
}
#mam-mobile-nav ul .sub-menu { display: none; }

/* Divider */
.mam-mobile-nav__divider {
  width: calc(100% - 56px);
  height: 1px;
  background: rgba(255, 255, 255, .1);
  margin: 16px 28px 20px;
  flex-shrink: 0;
}

/* Secondary links — small muted mono */
.mam-mobile-nav__secondary {
  flex-shrink: 0;
  padding: 0 28px;
}
.mam-mobile-nav__secondary-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mam-mobile-nav__secondary-list li a {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
  padding: 8px 0;
  text-decoration: none;
  border-bottom: none;
  transition: color .15s;
}
.mam-mobile-nav__secondary-list li a:hover {
  color: rgba(255, 255, 255, .75);
  text-decoration: none;
}

/* Footer: copyright line */
.mam-mobile-nav__footer {
  margin-top: auto;
  padding: 28px 28px 24px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.mam-mobile-nav__footer-copy {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .2);
  margin: 0;
}

body.mam-nav-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.mam-footer {
  background: var(--mam-bg);
  border-top: 1px solid var(--mam-border);
  padding-block: 48px 32px;
}
.mam-footer__inner {
  max-width: var(--mam-max-w);
  margin-inline: auto;
  padding-inline: var(--mam-gutter);
}

/* Top row: Brand LEFT | Columns RIGHT */
.mam-footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--mam-border);
  margin-bottom: 28px;
}
.mam-footer__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
  width: 260px;
}
.mam-footer__monogram {
  display: flex;
  align-items: center;
  opacity: .9;
  transition: opacity .2s;
}
.mam-footer__monogram:hover { opacity: 1; text-decoration: none; }
.mam-footer__monogram-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--mam-black);
  border: 1px solid var(--mam-border);
  flex-shrink: 0;
}
.mam-footer__monogram-circle img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}
.mam-footer__tagline {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--mam-text-muted);
  line-height: 1.4;
}

/* Three-column link grid */
.mam-footer__columns {
  display: flex;
  gap: 48px;
  flex: 1;
  justify-content: flex-end;
}
.mam-footer__col { min-width: 0; }
.mam-footer__col-heading {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--mam-text-muted);
  margin-bottom: 16px;
}
.mam-footer__links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.mam-footer__links a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--mam-text-muted);
  transition: color .2s;
}
.mam-footer__links a:hover { color: var(--mam-text); text-decoration: none; }

/* Bottom bar: Copyright LEFT | Social RIGHT */
.mam-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.mam-footer__copyright {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--mam-text-muted);
}
.mam-footer__social { display: flex; gap: 14px; align-items: center; }
.mam-footer__social-link {
  display: flex;
  align-items: center;
  color: var(--mam-text-muted);
  transition: color .2s;
}
.mam-footer__social-link:hover { color: var(--mam-text); text-decoration: none; }

/* --------------------------------------------------------------------------
   WordPress admin bar compensation
   -------------------------------------------------------------------------- */
.admin-bar .mam-header { top: 32px; }
@media screen and (max-width: 782px) { .admin-bar .mam-header { top: 46px; } }

/* --------------------------------------------------------------------------
   Responsive — Tablet (≤ 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .mam-header__inner { grid-template-columns: 120px 1fr 120px; }
  .mam-header__subscribe { display: none; }
}

/* --------------------------------------------------------------------------
   Responsive — Mobile (≤ 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --mam-gutter: 16px;
  }

  /* Header */
  .mam-header__inner {
    position: relative; /* contains the search overlay */
    grid-template-columns: 48px 1fr 48px;
    padding-block: 14px 0;
  }
  .mam-hamburger { display: flex; }
  .mam-header__utility--right { display: none; }
  .mam-header__logo .custom-logo { max-height: 36px; }
  .mam-nav-wrap { display: none; }

  /* Mobile search — full-width takeover when open */
  .mam-header__search.is-open {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--mam-bg);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-inline: 14px;
  }
  .mam-header__search.is-open .mam-header__search-inline {
    max-width: none;
    width: 100%;
    flex: 1;
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
  }
  .mam-header__search.is-open .mam-header__search-input {
    width: 100%;
    flex: 1;
    font-size: 16px; /* prevent iOS auto-zoom on focus */
  }

  /* Footer */
  .mam-footer__top { flex-direction: column; gap: 32px; }
  .mam-footer__brand { width: 100%; }
  .mam-footer__columns { flex-wrap: wrap; gap: 24px; }
  .mam-footer__col { min-width: 120px; }
  .mam-footer__bottom { flex-direction: column; align-items: flex-start; gap: 20px; }
}

@media (max-width: 480px) {
  .mam-footer__columns { flex-direction: column; gap: 20px; }
}

/* --------------------------------------------------------------------------
   Generic MAM Page template (page-mam.php)
   Used for Advertise and any other plain branded page.
   -------------------------------------------------------------------------- */
.mam-generic__hero {
  background: var(--mam-bg);
  border-bottom: 1px solid var(--mam-border);
  padding-block: 56px 48px;
  text-align: center;
}
.mam-generic__hero .mam-label { margin-bottom: 14px; }
.mam-generic__title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--mam-text);
  line-height: 1.1;
}
.mam-generic__subtitle {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--mam-text-muted);
  max-width: 560px;
  margin-inline: auto;
  margin-top: 16px;
  line-height: 1.6;
}
.mam-generic__body {
  background: var(--mam-bg);
  padding-block: 52px;
}
.mam-generic__content {
  max-width: var(--mam-content-w);
  margin-inline: auto;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--mam-text-body);
}
.mam-generic__content h2,
.mam-generic__content h3 {
  font-family: var(--font-serif);
  color: var(--mam-text);
  margin-block: 1.5em .5em;
}
.mam-generic__content p     { margin-bottom: 1.25em; }
.mam-generic__content a     { color: var(--mam-accent); }
.mam-generic__content a:hover { text-decoration: underline; }
.mam-generic__content ul,
.mam-generic__content ol    { padding-left: 1.5em; margin-bottom: 1.25em; }
.mam-generic__content li    { margin-bottom: .4em; }

@media (max-width: 768px) {
  .mam-generic__hero { padding-block: 40px 32px; }
}
