.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.15rem }

/* ---------- header ---------- */
.site-head {
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(var(--paper-2), var(--paper));
  position: sticky; top: 0; z-index: 20;
}
.site-head .wrap { display: flex; align-items: center; gap: 1rem; padding-block: .7rem; flex-wrap: wrap }
.brand { display: flex; align-items: baseline; gap: .5rem; font-size: 1.35rem; font-weight: 700;
         color: var(--maroon); text-decoration: none; margin-inline-end: auto }
.brand .om { color: var(--saffron); font-size: 1.5em; line-height: 1 }
.brand small { font-weight: 400; font-size: .58em; color: var(--ink-soft); letter-spacing: .08em;
               text-transform: uppercase }

/* ---------- controls ---------- */
.controls { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden;
       background: var(--paper) }
.seg button {
  font: inherit; font-size: var(--fs-small); color: var(--ink-soft);
  background: none; border: 0; padding: .3rem .68rem; cursor: pointer; white-space: nowrap;
}
.seg button + button { border-inline-start: 1px solid var(--rule) }
.seg button:hover { background: var(--paper-2); color: var(--ink) }
.seg button[aria-pressed="true"] { background: var(--saffron); color: #fff }
html[data-theme="dark"] .seg button[aria-pressed="true"] { color: #17120d }

.icon-btn {
  font: inherit; background: var(--paper); color: var(--ink-soft); cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .6rem;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink) }

/* ---------- home ---------- */
.hero { text-align: center; padding: 2.2rem 0 1.4rem }
.hero p { color: var(--ink-soft); max-width: 34rem; margin-inline: auto }

.search { display: flex; align-items: center; gap: .6rem; justify-content: center;
          margin: 0 0 1.6rem; flex-wrap: wrap }
.search label { font-size: var(--fs-small); color: var(--ink-soft) }
.search input {
  font: inherit; font-size: var(--fs-body); color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 999px;
  padding: .42rem .95rem; min-width: 15rem;
}

.grid { display: grid; gap: 1.15rem; padding-bottom: 3rem;
        grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)) }
.card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgb(80 50 20 / 12%), 0 14px 30px rgb(80 50 20 / 14%) }
.card figure { margin: 0; background: var(--paper); border-bottom: 1px solid var(--rule) }
.card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top center }
.card-body { padding: .7rem .85rem .9rem }
.card-name { font-size: 1.15rem; font-weight: 700; color: var(--maroon); margin: 0 0 .1rem }
.card-epithet { font-size: var(--fs-small); color: var(--ink-soft); margin: 0 }
.card-texts { margin: .5rem 0 0; display: flex; gap: .35rem; flex-wrap: wrap }
.tag { font-size: .72em; border: 1px solid var(--rule); border-radius: 999px;
       padding: .1rem .5rem; color: var(--ink-soft); background: var(--paper) }

.empty { text-align: center; color: var(--ink-soft); padding: 2rem 0 4rem }

/* ---------- deity page ---------- */
.deity-head { display: grid; gap: 1.5rem; padding: 1.4rem 0 .6rem;
              grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); align-items: start }
@media (max-width: 40rem) { .deity-head { grid-template-columns: 1fr } }
.deity-head figure { margin: 0 }
.deity-head img { border-radius: var(--radius); border: 1px solid var(--rule); box-shadow: var(--shadow) }
.deity-head figcaption, .attribution { font-size: .74em; color: var(--ink-soft); margin-top: .5rem;
                                       line-height: 1.5 }
.crumb { font-size: var(--fs-small); color: var(--ink-soft); text-decoration: none }

/* screen-hidden; print.css turns it on so a printed page identifies itself */
.print-head, .print-only { display: none }

.tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--rule); margin: 1.2rem 0 0 }
.tabs button {
  font: inherit; font-weight: 700; background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); padding: .55rem .9rem; border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--maroon); border-bottom-color: var(--saffron) }
.tabs button:hover { color: var(--ink) }

.text-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin: 1.5rem 0 .3rem }
.text-head h2 { margin: 0 }
.text-meta { font-size: var(--fs-small); color: var(--ink-soft); margin: 0 0 1rem }

.notice {
  border: 1px solid var(--gold); border-inline-start: 4px solid var(--gold);
  border-radius: 6px; background: color-mix(in srgb, var(--gold) 10%, var(--paper));
  padding: .7rem .9rem; font-size: var(--fs-small); margin: 0 0 1.4rem;
}

.site-foot { border-top: 1px solid var(--rule); margin-top: 2rem; padding: 1.4rem 0 2.5rem;
             font-size: var(--fs-small); color: var(--ink-soft) }
.site-foot a { color: var(--ink-soft) }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: .55rem 1.1rem; border-radius: 999px;
  font-size: var(--fs-small); box-shadow: var(--shadow); z-index: 50;
}

.fatal { max-width: 34rem; margin: 4rem auto; padding: 1.2rem 1.4rem; border: 1px solid var(--gold);
         border-radius: var(--radius); background: var(--paper-2) }
.fatal code { background: var(--paper); padding: .15rem .4rem; border-radius: 4px }

/* ---------- about ---------- */
.about section { margin: 0 0 2rem; max-width: 46rem }
.about section p { color: var(--ink-soft) }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-small) }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--rule);
         vertical-align: top }
th { color: var(--ink); font-weight: 700 }
td { color: var(--ink-soft) }

/* ---------- top nav ---------- */
.site-nav { display: flex; gap: .15rem; margin-inline-end: auto; flex-wrap: wrap }
.site-nav a {
  font-size: var(--fs-small); font-weight: 700; text-decoration: none;
  color: var(--ink-soft); padding: .35rem .7rem; border-radius: 999px;
}
.site-nav a:hover { background: var(--paper-2); color: var(--ink) }
.site-nav a[aria-current] { color: var(--maroon); background: color-mix(in srgb, var(--saffron) 16%, transparent) }

/* ---------- breadcrumbs ---------- */
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap;
          font-size: var(--fs-small); color: var(--ink-soft); padding: .9rem 0 .2rem }
.crumbs a { color: var(--ink-soft); text-decoration: none }
.crumbs a:hover { color: var(--maroon); text-decoration: underline }
.crumbs span[aria-hidden] { opacity: .5 }

/* ---------- one-line context under a text title ---------- */
.text-intro { color: var(--ink-soft); font-size: var(--fs-small); margin: -.2rem 0 1.1rem;
              max-width: 46rem }

/* ---------- category listing (texts.html) ---------- */
.text-list { list-style: none; margin: 0; padding: 0 0 3rem;
             display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)) }
.text-list > li { display: flex }          /* so every card fills its grid row */
.text-row {
  display: flex; align-items: center; gap: .85rem; width: 100%;
  text-decoration: none; color: inherit;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: .6rem .8rem; transition: transform .15s, box-shadow .15s;
}
.text-row:hover { transform: translateY(-2px); box-shadow: var(--shadow) }
/* A square crop of a tall portrait: anchoring to the top shows only the empty
   sky/border above the figure, so sit just below it where the face actually is. */
.text-row img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
                object-position: center 18%; flex: 0 0 auto; border: 1px solid var(--rule) }
.text-row-title { margin: 0; font-weight: 700; color: var(--maroon); line-height: 1.4 }
.text-row-sub { margin: .1rem 0 0; font-size: var(--fs-small); color: var(--ink-soft) }

/* ---------- "Also read" cross-links ---------- */
.also {
  margin: 2.2rem 0 1rem; padding: 1.1rem 1.2rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: color-mix(in srgb, var(--gold) 7%, var(--paper-2));
}
.also h3 { margin: 0 0 .7rem; font-size: var(--fs-h2); color: var(--maroon) }
.also-primary {
  display: inline-block; font-weight: 700; text-decoration: none;
  background: var(--saffron); color: #fff; padding: .48rem 1rem; border-radius: 999px;
}
html[data-theme="dark"] .also-primary { color: #17120d }
.also-primary:hover { filter: brightness(1.08); color: #fff }
html[data-theme="dark"] .also-primary:hover { color: #17120d }
.also-label { margin: 1.1rem 0 .45rem; font-size: var(--fs-small); font-weight: 700;
              color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em }
.also-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem }
.also-list a {
  display: inline-block; font-size: var(--fs-small); text-decoration: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: .28rem .7rem;
  background: var(--paper); color: var(--ink);
}
.also-list a:hover { border-color: var(--saffron); color: var(--maroon) }
.also-all { display: inline-block; margin-top: .9rem; font-size: var(--fs-small); font-weight: 700 }
