/* =========================================================
   Fragments of Becoming — main.css
   Unified fragment mark A = FragmentGlyph (font), no SVG mask
   House + Shandy glyphs remain SVG
   ========================================================= */

/* =========================================================
   1) Ground / body / rhythm
   ========================================================= */

:root{
  --bg: #ffeedd;
  --ink: #111;
  --muted: rgba(0,0,0,0.62);
  --hair: rgba(0,0,0,0.10);
  --hair2: rgba(0,0,0,0.16);
  --paper: #fff;
}

/* Unified glyph font (A: fragment mark = unie001 / U+E001) */
@font-face{
  font-family: "FragmentGlyph";
  src: url("/assets/fonts/FragmentGlyph.woff2") format("woff2");
  font-display: swap;
}

*{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main.page{
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Safe global image defaults (prevents “mystery breakage”) */
img{ max-width: 100%; height: auto; }
svg{ max-width: 100%; height: auto; }

/* Links — keep default “web” behavior unless overridden */
a{ color: inherit; }
a:visited{ color: inherit; }

/* Concept links (general): dotted “trace” underline */
a.concept-link{
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(0,0,0,0.45);
}

a.concept-link:hover{
  text-decoration-color: rgba(0,0,0,0.7);
}

/* Paragraph rhythm */
p{ margin: 0 0 1.1em 0; }

/* =========================================================
   2) Fragment mark (triangle with slash)
   ========================================================= */

/*
  IMPORTANT:
  - For the unified (font) glyph, templates should output the char:
      <span class="fragmark fragmark--link" aria-hidden="true">&#xE001;</span>
  - Do NOT use <img src="/assets/fragment-mark.svg"> anywhere for frag marks now.
*/

.fragmark{
  display: inline-block;
  vertical-align: -0.18em; /* slightly recessive inline settle */
  width: 1em;
  height: 1em;
}

/* If any inline SVG marks exist elsewhere, keep them sane */
.fragmark svg{
  width: 100% !important;
  height: 100% !important;
  display: block;
  max-width: none !important;
  stroke: currentColor;
  fill: none;
}

/* Canonical fragment glyph orientation (avoid accidental transforms) */
.fragmark,
.fragmark svg{
  transform: none !important;
}

/* Inline/header SVG mark sizing (kept for compatibility) */
.fragmark--inline{
  width: 1em;
  height: 1em;
  margin-right: 0.25em;
}

/* Link-sized mark (FONT GLYPH — unified) */
.fragmark--link{
  width: auto;
  height: auto;
  vertical-align: -0.12em;

  font-family: "FragmentGlyph";
  font-size: 0.88em;    /* default: recessive in-body */
  line-height: 1;

  opacity: 0.60;
  display: inline-block;
}

/* Hover affordance */
.concept-link:hover .fragmark--link{ opacity: 0.78; }

/* Solo usage (rare; if you ever place the glyph alone) */
.fragmark--solo{
  width: auto;
  height: auto;
  display: block;
  margin: 0 0 0.75em 0;

  font-family: "FragmentGlyph";
  font-size: 2.2em;
  line-height: 1;
  opacity: 0.9;
}

/* Keep glyph + first word together (when needed) */
.fragglue{ white-space: nowrap; }

/* Keep glyph + ID together (prevents awkward line breaks) */
.fragid{
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 0.22em;
  margin-left: 0.15em;
  font-size: 0.88em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   3) Section & fragment typography
   ========================================================= */

.fragment__markline{
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.35em;
}

.fragment__id{
  font-weight: 400;
  font-size: 0.85em;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

/* If header mark uses same classes, make it a bit stronger */
.fragment__markline .fragmark{ opacity: 0.9; }

.fragment__header{ margin-bottom: 1.25rem; }

.fragment__title{
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.05;
  margin: 0.6rem 0 0.6rem 0;
  font-weight: 700;
}

.fragment__title--section{
  font-size: clamp(2.8rem, 4.5vw, 4.4rem);
  line-height: 1.02;
  margin-top: 0.9rem;
}

.fragment__meta{
  font-size: 0.85rem;
  color: rgba(0,0,0,0.55);
  letter-spacing: 0.02em;
}

.fragment__tags{
  display: inline-flex;
  gap: 0.5em;
  margin-left: 0.5em;
}

.fragment__tags .tag{
  font-style: italic;
  opacity: 0.65;
  white-space: nowrap;
}

.fragment__body{
  max-width: 42em;
  line-height: 1.55;
}

.fragment__body p:last-child{ margin-bottom: 0; }

/* Sections */
.section__markline{
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.8rem;
}

.sectionmark{ font-weight: 700; opacity: 0.9; }

.section__id{
  font-weight: 600;
  letter-spacing: 0.04em;
}

.section__title{
  font-size: clamp(2.4rem, 4vw, 3.8rem);
  line-height: 1.05;
}

.section__desc{
  opacity: 0.6;
  font-size: 0.95rem;
  margin-top: -0.25rem;
}

.section__body > p:first-child{ margin-top: 1.2rem; }

/* =========================================================
   4) Navigation, lists, links
   ========================================================= */

/* Vector field (bottom links) */
.vectorfield{
  margin-top: 3rem;
  padding-top: 0.5rem;
  font-size: 0.9em;
  opacity: 0.85;
}

.vectorfield__link{
  display: inline-flex;
  align-items: baseline;
  gap: 0.25em;
  text-decoration: none;
  margin-right: 0.75em;
}

.vectorfield__link:hover{ text-decoration: underline; }

.vectorfield__sym{
  opacity: 0.7;
  margin-right: 0.25em;
}

.vectorfield .fragmark{ opacity: 0.6; }
.vectorfield__link:hover .fragmark{ opacity: 0.85; }

/* Index list */
.indexlist{
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0 0;
}

.indexlist__item{
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.indexlist__link{
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  gap: 0.6rem;
  align-items: baseline;
}

.indexlist__mark{
  opacity: 0.9;
  vertical-align: -0.1em;
  margin-right: 0.35em;
}

.indexlist__id{
  letter-spacing: 0.03em;
  font-weight: 600;
  opacity: 0.85;
}

.indexlist__title{ opacity: 0.95; }

.indexlist__desc{
  margin-left: 2.2rem;
  margin-top: 0.25rem;
  opacity: 0.65;
  font-size: 0.95rem;
}

/* =========================================================
   Home glyph (SVG house stays as-is)
   ========================================================= */

.home-glyph-wrap{
  display:flex;
  justify-content:flex-end;
  margin-top: 3rem;
}

.home-glyph{
  display:inline-flex;
  align-items: center;
  line-height:0;
  text-decoration:none;
  opacity:.55;
}

.home-glyph:hover{ opacity:.95; }

/* SVG house variant */
.home-glyph svg{
  width: 19px;
  height: auto;
}

/* =========================================================
   Home layout
   ========================================================= */

.home{
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.home__header{
  text-align: center;
  margin-bottom: 1.5rem;
}

.home__glyph,
.shandy-glyph2{
  width: 72px !important;
  height: auto !important;
  display: block;
  margin: 0.75rem auto 1.25rem;
  max-width: none;
}

.home__title{
  font-size: 1.9rem;
  letter-spacing: 0.035em;
  font-weight: 700;
  margin: 0;
}

.home__subtitle{
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-top: 0.6rem;
}

.home__h2{
  font-size: 1rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem 0;
}

.sections{
  list-style: none;
  padding: 0;
  margin: 0;
}

.sections__item + .sections__item{ margin-top: 0.35rem; }

.sections__link{
  text-decoration: none;
  display: inline-flex;
  gap: 0.7rem;
  align-items: baseline;
  color: inherit;
}

.sections__id{
  opacity: 0.85;
  white-space: nowrap;
}

.sections__id::before{
  content: "§ ";
  opacity: 0.85;
}

.sections__title{
  text-decoration: none;
  border-bottom: 1px solid rgba(0,0,0,0.25);
  padding-bottom: 1px;
}

.sections__link:hover .sections__title{
  border-bottom-color: rgba(0,0,0,0.6);
}

.home__grow{ height: 2rem; }

/* Recessive index block */
.indexblock{
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 6px;
  padding: 0.8rem 0.9rem;
  background: rgba(0,0,0,0.03);
}

.indexblock__head{
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  opacity: 0.85;
}

.kwgrid{
  column-count: 4;
  column-gap: 1rem;
}

.kwentry{
  break-inside: avoid;
  margin: 0 0 0.55rem 0;
}

.kwentry__kw{
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

/* ✅ UPDATED: make glyph + ID readable in keyword index */
.kwentry__ids{
  font-size: 0.90rem;   /* bigger: fixes “too small” */
  line-height: 1.38;
  opacity: 0.92;
}

/* ✅ NEW: keyword index glyph tuning (cancels global 0.88em shrink) */
.kwentry__ids .fragmark--link{
  font-size: 1.05em;
  opacity: 0.78;
  vertical-align: -0.10em;
}

.kwentry__ids .fraglink{
  gap: 0.22em;
}

/* =========================================================
   4b) Fraglink (rendered by {% fraglink ... %})
   ========================================================= */

.concept-link.fraglink{
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(0,0,0,0.18);
}

.concept-link.fraglink:hover{
  border-bottom-color: rgba(0,0,0,0.45);
}

.fraglink{
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  text-decoration: none;
}

/* “Kerning” between glyph and ID/text */
.fraglink .fragmark--link{ margin-right: -0.08em; }

/* Optional ID style */
.fraglink .fragid{
  font-weight: 400;
  opacity: 0.62;
  letter-spacing: 0.02em;
}

.fragtext{ opacity: 1; }

.fraglink--missing{
  border-bottom-style: dotted;
  opacity: 0.7;
}

/* =========================================================
   4c) Stacked fraglinks (Markdown lists without bullets)
   ========================================================= */

.fragment-list,
.fragment__body ul{
  list-style: none;
  padding-left: 0;
  margin: 0.4rem 0 1.1rem;
}

.fragment__body li{ margin: 0.25rem 0; }

/* =========================================================
   Fragstack — boxed, stacked fragment references
   ========================================================= */

.fragstack{
  margin: 0.75rem 0 1.25rem;
  padding: 0.9rem 1rem;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;

  border-left: none;
  box-shadow: none;

  position: relative;
}

.fragstack::before,
.fragstack::after{ pointer-events: none; }

.fragstack a{
  position: relative;
  z-index: 1;
}

.fragstack .fraglink{
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  margin: 0.35rem 0;
  padding: 0.1rem 0;
  line-height: 1.35;
}

.fragstack .concept-link.fraglink{
  border-bottom: none;
  text-decoration: none;
}

.fragstack .concept-link.fraglink:hover{
  background: rgba(0,0,0,0.04);
  border-radius: 6px;
}

.fragstack .fragmark--link{ opacity: 0.55; }
.fragstack .fragid{ opacity: 0.70; }

@media (max-width: 640px){
  .fragstack{ padding: 0.8rem 0.85rem; }
  .fragstack .fraglink{ gap: 0.45em; }
}

/* =========================================================
   5) Archival plates (Option 3 refinements)
   ========================================================= */

.archival-plate{
  margin: 2.5rem auto;
  max-width: 56rem;
}

.archival-plate__link{
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: zoom-in;
}

.archival-plate__img{
  display: block;
  width: 100%;
  height: auto;

  background: var(--paper);
  padding: 0.75rem;

  border-radius: 14px;

  box-shadow:
    0 0 0 1px var(--hair),
    0 12px 34px rgba(0,0,0,0.10);

  filter: saturate(0.98) contrast(1.02);

  transition: transform 140ms ease, box-shadow 140ms ease;
}

.archival-plate__link:hover .archival-plate__img{
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.14),
    0 16px 46px rgba(0,0,0,0.14);
}

.archival-plate__caption{
  margin-top: 0.65rem;
  font-size: 0.9rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
  opacity: 0.78;
}

.archival-plate__title{
  display: block;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

.archival-plate__meta{
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  opacity: 0.72;
}

.archival-plate__link:focus-visible{
  outline: 2px solid rgba(0,0,0,0.35);
  outline-offset: 4px;
  border-radius: 16px;
}

@media (prefers-reduced-motion: reduce){
  .archival-plate__img{ transition: none; }
  .archival-plate__link:hover .archival-plate__img{ transform: none; }
}

.section-pause{ height: clamp(1rem, 2.5vh, 1.75rem); }

/* =========================================================
   Mobile tuning for keyword index block
   ========================================================= */

@media (max-width: 820px){
  .kwgrid{ column-count: 3; column-gap: 1rem; }
}

@media (max-width: 640px){
  .kwgrid{ column-count: 2; column-gap: 1.1rem; }

  .indexblock{ padding: 0.9rem 0.95rem; }

  .kwentry__kw{
    font-size: 0.84rem;
    letter-spacing: 0.045em;
  }

  /* ✅ UPDATED: keep keyword IDs readable on phones */
  .kwentry__ids{
    font-size: 0.95rem;
    line-height: 1.38;
  }

  .kwentry__ids .fragmark--link{ opacity: 0.82; }

  .kwentry__ids .fraglink{
    gap: 0.18rem;
    margin-right: 0.7rem;
  }
}

@media (max-width: 420px){
  .kwgrid{ column-count: 1; column-gap: 0; }
  .indexblock{ border-radius: 8px; }
}

/* =========================================================
   6) Exceptions / notes
   ========================================================= */

/* Keep any future global img/svg rules ABOVE the plate block,
   or you’ll accidentally override the plate presentation. */
