/* Share controls and the share dialog (js/share.js). share.js links this file
   on any page that lacks it.

   .share-btn is the one "Share" button in a page header's top-right corner,
   lettered like the header's source links. The Daily Record's "Copy link" /
   "Share" text pair (.share-ctl) and the dialog are also in styles.css, for
   the pages that load it; keep the two in step. */

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--wsj-border, #d4c8b8);
  border-radius: 2px;
  background: #fff;
  color: var(--wsj-nav, #352a21);
  font: 600 12.5px/1 var(--font-sans);
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.share-btn svg { width: 13px; height: 13px; flex: 0 0 auto; }
.share-btn:hover { border-color: var(--wsj-gold); color: var(--accent); }
.share-btn:focus-visible { outline: 2px solid var(--wsj-gold); outline-offset: 1px; }

/* A static page's header: the button in the header's top-right corner, out of
   the way of the heading, which starts at the top as if it weren't there. The
   heading keeps clear of the corner: on both sides when it is centered, so it
   stays centered, and on the right only where it is set left (In Focus). On a
   phone the button is its icon alone. */
:has(> .share-corner) { position: relative; }
.share-corner { position: absolute; top: 0; right: 0; z-index: 2; }
:has(> .share-corner) h1 { padding-left: 100px; padding-right: 100px; }
.fx-section-head > .share-corner ~ h1,
.fx-hero-main > .share-corner ~ h1 { padding-left: 0; }
@media (max-width: 700px) {
  .share-corner .share-btn { width: 34px; padding: 0; justify-content: center; }
  .share-corner .share-btn span { display: none; }
  :has(> .share-corner) h1 { padding-left: 44px; padding-right: 44px; }
  .fx-section-head > .share-corner ~ h1,
  .fx-hero-main > .share-corner ~ h1 { padding-left: 0; }
}

.share-ctl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 0 1px;
  border: none;
  border-bottom: 1.5px solid var(--wsj-gold);
  background: none;
  color: var(--wsj-nav);
  font: 600 var(--fact-size, 14px)/1.2 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}
.share-ctl svg { width: 14px; height: 14px; flex: 0 0 auto; }
.share-ctl:hover { color: var(--accent); border-bottom-color: var(--accent); }
.share-ctl.is-copied { color: var(--wsj-green); border-bottom-color: currentColor; cursor: default; }

.share-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background-color: rgba(26, 26, 26, 0.6);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.share-modal .modal-content--share {
  position: relative;
  width: min(520px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  padding: 26px 28px 28px;
  background-color: var(--wsj-cream);
  border: 1px solid var(--wsj-border);
  border-top: 4px solid var(--wsj-gold);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.share-modal h2 {
  margin: 0 0 14px;
  padding-right: 32px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
}
.share-modal .modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  color: var(--wsj-brown);
  cursor: pointer;
}
.share-modal .modal-close:hover { color: var(--wsj-dark, #1a1a1a); }
.share-what { border-left: 3px solid var(--wsj-gold); background: #fff; padding: 10px 14px; margin-bottom: 20px; }
.share-what-title { font-family: var(--font-serif); font-size: 15px; line-height: 1.35; color: var(--text); }
.share-what-meta { margin-top: 4px; font-family: var(--font-sans); font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted, #6b5b4f); }
.share-field-label { font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted, #6b5b4f); margin-bottom: 8px; }
.share-url-row { display: flex; margin-bottom: 20px; }
.share-url-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--wsj-border);
  border-right: none;
  background: #fff;
  padding: 10px 12px;
  font: 400 12px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #4a4038;
}
.share-url-row input:focus { outline: none; border-color: var(--wsj-gold); }
.share-url-row button {
  flex: 0 0 auto;
  border: 1px solid var(--wsj-nav);
  background: var(--wsj-nav);
  color: var(--wsj-cream);
  padding: 10px 18px;
  font: 600 13px/1.4 var(--font-sans);
  cursor: pointer;
}
.share-url-row button:hover { background: #241c15; }
.share-dests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-dest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 6px;
  border: 1px solid var(--wsj-border);
  background: #fff;
  color: var(--wsj-nav);
  text-decoration: none;
  font: 600 12px/1.2 var(--font-sans);
}
.share-dest:hover { border-color: var(--wsj-gold); color: var(--accent); }
.share-dest svg { width: 19px; height: 19px; }
