/* Shared by every Metalworkers tab: tokens, page base, the tab bar, and the slide between tabs. */

:root {
  --umber: #1c140e;
  --umber-2: #2a1e15;
  --frame: #6e5842;
  --bronze: #b07a3c;
  --bronze-hi: #deae6f;
  --bronze-lo: #8e5d2d;
  --engrave: #4a2c12;
  --lamp: #ffd98a;
  --ember: #ff8a2a;
  --silver: #d8dad3;
  --parchment: #ead9bd;
  --muted: #b9a78e;
  --faint: #7d6c5a;
  --ink: #20160f;

  --display: "Goudy Bookletter 1911", "Goudy Old Style", Georgia, serif;
  --body: "Spectral", Georgia, serif;

  --tabs-h: 52px;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  touch-action: pan-y pinch-zoom;    /* horizontal swipes belong to the tab switcher */
  overscroll-behavior-x: none;       /* and not to the browser's back/forward gesture */
}
html, body { margin: 0; }
body {
  background: var(--umber);
  color: var(--silver);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--noise);
  opacity: .22;
  /* The grain is pure black, and on this dark palette "overlay" composites
     the same as normal blending, so no blend mode: a full-viewport blend layer
     makes every repaint underneath (and every scroll, in Safari) re-blend. */
  pointer-events: none;
  z-index: 50;
}

/* ── tab bar ── */
.mw-tabs {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--tabs-h);
  z-index: 40;
  display: flex;
  align-items: stretch;
  background: linear-gradient(rgba(20, 14, 10, .82), rgba(20, 14, 10, .55));
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 220, 170, .07);
  view-transition-name: mw-tabs;
}
.mw-tabs ol {
  display: flex;
  gap: 2px;
  margin: 0 auto;
  padding: 0 12px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  max-width: 100%;
}
.mw-tabs ol::-webkit-scrollbar { display: none; }
.mw-tabs li { display: flex; scroll-snap-align: center; }
.mw-tabs a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
  font-size: .95rem;
  color: #a8957c;
  text-decoration: none;
  transition: color .2s ease;
}
.mw-tabs a:hover { color: var(--parchment); }
.mw-tabs a:focus-visible { outline: 2px solid var(--lamp); outline-offset: -6px; border-radius: 8px; }
.mw-tabs a[aria-current="page"] { color: var(--parchment); }
.mw-tabs a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--bronze), var(--lamp), var(--bronze));
  box-shadow: 0 0 10px rgba(255, 200, 110, .6);
}
.mw-tabs svg { width: 20px; height: 20px; flex: none; }
.mw-tabs a.mw-acct {
  flex: none; align-self: center; height: 32px; margin: 0 12px 0 4px; padding: 0 12px; border-radius: 16px;
  border: 1px solid rgba(222, 174, 111, .35); color: var(--parchment); font-size: .9rem;
}
.mw-tabs a.mw-acct.in { color: var(--lamp); border-color: rgba(255, 217, 138, .45); }
.mw-tabs a.mw-acct:hover { background: rgba(255, 220, 170, .08); }
.mw-tabs a.mw-acct[aria-current="page"]::after { display: none; }

/* the swipe: the page follows the finger a little before it commits */
body.mw-swiping > *:not(.mw-tabs) { transition: none; }
.mw-page-nudge { will-change: transform; }

/* ── sliding between tabs (cross-document view transitions) ── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: mw-out-left .42s cubic-bezier(.4, 0, .2, 1) both; }
::view-transition-new(root) { animation: mw-in-right .42s cubic-bezier(.4, 0, .2, 1) both; }
html[data-dir="back"]::view-transition-old(root) { animation-name: mw-out-right; }
html[data-dir="back"]::view-transition-new(root) { animation-name: mw-in-left; }
@keyframes mw-out-left  { to   { transform: translateX(-28%); opacity: 0; } }
@keyframes mw-in-right  { from { transform: translateX(28%);  opacity: 0; } }
@keyframes mw-out-right { to   { transform: translateX(28%);  opacity: 0; } }
@keyframes mw-in-left   { from { transform: translateX(-28%); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* a page body for toy tabs: sits under the tab bar */
.mw-toy {
  min-height: 100svh;
  padding-top: var(--tabs-h);
}
