/* Fantom Set List Buddy — Handbook (phone + laptop) */
:root {
  --bg: #f3f1ee;
  --bg-deep: #ebe7e1;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #cfc9c2;
  --accent: #2f6f6a;
  --accent-soft: #e4f0ee;
  --card: #ffffff;
  --tip: #f7f3e8;
  --tip-border: #e2d6b8;
  --rail: 260px;
  --prose: 42rem;
  --bar-h: 3.25rem;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  line-height: 1.55;
  font-size: 1.05rem;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
code {
  font-size: 0.9em;
  background: rgba(26, 26, 26, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 40;
  background: var(--card);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
}

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--bar-h);
  padding: calc(0.55rem + var(--safe-t)) 1rem 0.55rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar-brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  text-decoration: none;
}
.bar-brand:hover { text-decoration: none; color: var(--accent); }
.bar-brand span { color: var(--muted); font-weight: 500; }
.toc-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  min-height: 2.5rem;
}
.toc-btn:hover { border-color: var(--accent); color: var(--accent); }

.shell {
  display: block;
  max-width: 72rem;
  margin: 0 auto;
}
.toc-rail { display: none; }
.main {
  padding: 1.25rem 1.15rem calc(3rem + var(--safe-b));
  max-width: var(--prose);
  margin: 0 auto;
}
.main-inner { max-width: var(--prose); }

.crumb {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0 0 1rem;
}
.crumb a { color: var(--muted); }
.crumb strong { color: var(--ink); font-weight: 600; }

h1 {
  font-size: clamp(1.55rem, 5vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.45rem;
}
.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
}
h2 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.65rem;
  letter-spacing: -0.01em;
}
h3 {
  font-size: 1.02rem;
  margin: 1.35rem 0 0.5rem;
}
p { margin: 0 0 0.95rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin: 0.35rem 0; }
.menu-label { font-weight: 700; color: var(--ink); }

.ui-ref {
  display: inline;
  white-space: nowrap;
}
.ui-more,
.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin: 0 0.12rem;
  vertical-align: -0.2em;
  border-radius: 0.4rem;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 1px 0 rgba(26, 26, 26, 0.04);
}
.ui-more img,
.ui-icon img {
  width: 0.95rem;
  height: 0.95rem;
  max-width: none;
  object-fit: contain;
  display: block;
}

/* Prominent toolbar / Details icons in handbook sections */
.control-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0 0 1.35rem;
}
.control-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 4.75rem;
  padding: 0.75rem 0.65rem 0.65rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.05);
  text-align: center;
}
.control-icon .glyph {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.65rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
}
.control-icon .glyph img {
  width: 1.55rem;
  height: 1.55rem;
  object-fit: contain;
  display: block;
}
.control-icon .glyph.muted-glyph {
  background: #f0eeea;
  color: var(--ink);
}
.control-icon .label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  max-width: 5.5rem;
  line-height: 1.25;
}
.control-icon .hint {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  max-width: 5.5rem;
  line-height: 1.2;
}

.step {
  margin: 1.35rem 0 1.75rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}
.step-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.step-num {
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
  margin-top: 0.1rem;
}
.step-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.2rem;
}
.step-body { margin: 0; }

.shot {
  margin: 0.85rem 0 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.65rem;
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.06);
  max-width: 22rem;
}
.shot img {
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: #f7f5f2;
}
.shot figcaption {
  margin: 0.55rem 0.25rem 0.15rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.shot-flow {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.85rem;
}
.shot-flow .shot { margin: 0; max-width: 22rem; }
.shot.wide { max-width: min(100%, 42rem); }
.shot.wide img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
}
.shot-flow .shot.wide { max-width: min(100%, 42rem); }

.tip {
  margin: 1.5rem 0;
  padding: 0.95rem 1rem;
  background: var(--tip);
  border: 1px solid var(--tip-border);
  border-radius: 0.75rem;
}
.tip strong {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6840;
  margin-bottom: 0.35rem;
}
.tip p { margin: 0; }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0 1.75rem;
}
.card {
  display: block;
  padding: 1rem 1.05rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  min-height: 3.5rem;
}
.card:hover {
  border-color: var(--accent);
  text-decoration: none;
  background: var(--accent-soft);
}
.card strong {
  display: block;
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
  color: var(--accent);
}
.card span {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.pager a {
  display: block;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  min-height: 3.25rem;
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .dir {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.pager .title { font-weight: 700; font-size: 0.95rem; }
.pager .next { text-align: right; }
.pager .disabled {
  opacity: 0.45;
  pointer-events: none;
}

.presence {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.presence p { margin: 0 0 0.75rem; }
.presence .social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  font-weight: 600;
}
.presence .copy {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { background: var(--accent-soft); font-weight: 700; }
tr:last-child td { border-bottom: 0; }

table.with-shots th:last-child,
table.with-shots td.shot-cell {
  width: 9.5rem;
  padding: 0.65rem;
  vertical-align: middle;
}
table.with-shots td:first-child {
  white-space: nowrap;
  width: 8.5rem;
}
table.with-shots td.nav-item {
  white-space: nowrap;
}
.nav-item-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
  border-radius: 0.55rem;
}
.nav-item-link:hover strong {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.nav-item-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.nav-item-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.6rem;
  background: var(--accent-soft);
}
.nav-item-icon img {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
  display: block;
}
.shot.in-table {
  margin: 0;
  max-width: 8.5rem;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(26, 26, 26, 0.12);
  border: 1px solid var(--line);
  background: #111;
}
.shot.in-table img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 639px) {
  table.with-shots thead { display: none; }
  table.with-shots,
  table.with-shots tbody,
  table.with-shots tr,
  table.with-shots td {
    display: block;
    width: 100%;
  }
  table.with-shots tr {
    padding: 0.85rem 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  table.with-shots tr:last-child { border-bottom: 0; }
  table.with-shots td {
    border: 0;
    padding: 0.2rem 0;
  }
  table.with-shots td.shot-cell {
    width: auto;
    padding-top: 0.65rem;
  }
  table.with-shots .shot.in-table {
    max-width: 14rem;
    margin: 0 auto;
  }
}

.process-steps {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
}
.process-steps li { margin: 0.55rem 0; }

.toc-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  visibility: hidden;
}
.toc-overlay.open {
  pointer-events: auto;
  visibility: visible;
}
.toc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.toc-overlay.open .toc-backdrop { opacity: 1; }
.toc-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(20rem, 88vw);
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: calc(0.85rem + var(--safe-t)) 1rem calc(1rem + var(--safe-b));
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  overflow: auto;
}
.toc-overlay.open .toc-panel { transform: none; }
.toc-panel h2,
.toc-rail h2 {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc-close {
  float: right;
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0.15rem 0.35rem;
}
.toc-list, .toc-rail nav {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-list a, .toc-rail a {
  display: block;
  padding: 0.45rem 0.35rem;
  color: var(--muted);
  border-radius: 0.4rem;
  font-size: 0.92rem;
}
.toc-list a:hover, .toc-rail a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}
.toc-list .chapter, .toc-rail .chapter {
  margin-top: 0.85rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 0.35rem 0.35rem 0.15rem;
}
.toc-list .active, .toc-rail .active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.hub-hero {
  margin: 0 0 1.25rem;
}

@media (min-width: 640px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .toc-btn { display: none; }
  .shell {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    gap: 0;
    align-items: start;
  }
  .toc-rail {
    display: block;
    position: sticky;
    top: var(--bar-h);
    height: calc(100dvh - var(--bar-h));
    overflow: auto;
    padding: 1.25rem 1rem 2rem 1.25rem;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
  }
  .main {
    max-width: none;
    padding: 1.75rem 2rem 3.5rem;
  }
  .shot-flow {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .shot-flow .shot { flex: 1 1 14rem; max-width: 18rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
