:root {
  --ink: #363536;
  --muted-ink: #5e5a56;
  --paper: #f8f1e8;
  --paper-strong: #fffaf3;
  --gold: #b18743;
  --gold-deep: #8e692f;
  --line: rgba(76, 65, 52, 0.2);
  --shadow: 0 14px 36px rgba(64, 47, 31, 0.2);
  --serif: Baskerville, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", Avenir, Montserrat, "Helvetica Neue", Arial, sans-serif;
  --script: "Snell Roundhand", "Apple Chancery", "Segoe Script", cursive;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #eee4d8;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 60%, rgba(195, 153, 95, 0.16), transparent 32rem),
    linear-gradient(180deg, #f8f0e6 0%, #f6ede3 68%, #e8ded1 100%);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-180%);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  color: #fff;
  background: #2f2d2a;
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  position: relative;
  min-height: clamp(42rem, 80vh, 56rem);
  overflow: hidden;
  isolation: isolate;
  background-image: url("images/background.png");
  background-position: center center;
  background-size: cover;
}

.hero-shade {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 250, 243, 0.92) 0%, rgba(255, 250, 243, 0.7) 31%, rgba(255, 250, 243, 0.04) 62%),
    linear-gradient(180deg, rgba(249, 241, 231, 0.16) 42%, rgba(40, 31, 24, 0.12) 100%);
}

.brand-lockup {
  position: absolute;
  z-index: 2;
  top: clamp(2.2rem, 5vw, 4.2rem);
  left: clamp(1.5rem, 7vw, 7rem);
}

.brand-name {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.brand-name span {
  color: var(--gold);
}

.brand-tagline {
  margin-top: 0.75rem;
  font-size: clamp(0.68rem, 1.05vw, 0.98rem);
  font-weight: 500;
  letter-spacing: 0.32em;
  color: #67635f;
}

.hero-copy {
  position: absolute;
  z-index: 1;
  top: 29%;
  left: clamp(1.5rem, 7vw, 7rem);
}

.hero-copy h1 {
  margin: 0;
  max-width: 11ch;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 6vw, 6.4rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.hero-copy p {
  margin: clamp(1.7rem, 3vw, 2.8rem) 0 0;
  font-size: clamp(0.78rem, 1.2vw, 1.08rem);
  font-weight: 500;
  line-height: 1.48;
  letter-spacing: 0.3em;
  color: #625e59;
}

.gold-rule {
  display: block;
  width: clamp(3.8rem, 5vw, 5.8rem);
  height: 2px;
  margin-top: 1.6rem;
  background: var(--gold);
}

.hero-verse {
  position: absolute;
  right: clamp(2rem, 8vw, 10rem);
  bottom: clamp(8rem, 18vh, 12rem);
  margin: 0;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 16px rgba(20, 17, 14, 0.52);
}

.hero-verse p {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(2.2rem, 4.2vw, 4.3rem);
  font-weight: 400;
  line-height: 0.84;
  transform: rotate(-6deg);
}

.hero-verse span,
.footer-verse span {
  display: block;
  width: 2.5rem;
  height: 2px;
  margin: 1.3rem auto 1rem;
  background: #c19a59;
}

.hero-verse cite {
  font-size: clamp(0.62rem, 1vw, 0.86rem);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.24em;
}

.explorer-shell {
  position: relative;
  z-index: 3;
  width: min(92vw, 78rem);
  margin: clamp(-8.5rem, -12vh, -5.5rem) auto 0;
  padding-bottom: clamp(3.5rem, 8vw, 7rem);
}

.category-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.7vw, 1.3rem);
}

.category-card {
  position: relative;
  min-height: clamp(15rem, 25vw, 21rem);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: clamp(0.95rem, 1.8vw, 1.45rem);
  padding: 0;
  color: #fff;
  background: #6e675e;
  box-shadow: var(--shadow);
  cursor: pointer;
  isolation: isolate;
  transition: transform 260ms cubic-bezier(.2,.7,.2,1), box-shadow 260ms ease, border-color 260ms ease;
}

.category-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(16, 18, 18, 0.02) 18%, rgba(19, 23, 24, 0.18) 49%, rgba(26, 27, 27, 0.92) 100%),
    var(--card-image);
  background-position: center;
  background-size: cover;
  transition: transform 600ms cubic-bezier(.2,.75,.25,1), filter 260ms ease;
}

.category-card::after {
  content: "";
  position: absolute;
  inset: 0.45rem;
  border: 1px solid transparent;
  border-radius: calc(clamp(0.95rem, 1.8vw, 1.45rem) - 0.35rem);
  pointer-events: none;
  transition: border-color 260ms ease;
}

.category-card:hover,
.category-card:focus-visible {
  transform: translateY(-4px);
  outline: none;
  box-shadow: 0 18px 44px rgba(57, 43, 28, 0.3);
}

.category-card:hover::before,
.category-card:focus-visible::before {
  transform: scale(1.045);
}

.category-card:focus-visible::after,
.category-card.is-active::after {
  border-color: rgba(255, 244, 220, 0.9);
}

.category-card.is-active {
  transform: translateY(-3px);
  border-color: rgba(185, 139, 64, 0.95);
  box-shadow: 0 19px 48px rgba(57, 43, 28, 0.35), 0 0 0 2px rgba(177, 135, 65, 0.42);
}

.card-content {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  min-height: 57%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem clamp(0.5rem, 1vw, 1rem) clamp(1.1rem, 2vw, 1.65rem);
  text-align: center;
}

.category-icon {
  width: clamp(2.4rem, 4vw, 3.45rem);
  height: clamp(2.4rem, 4vw, 3.45rem);
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.28));
}

.category-card h3 {
  min-height: 2.12em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.3vw, 2rem);
  font-weight: 400;
  line-height: 0.98;
  text-shadow: 0 2px 9px rgba(0, 0, 0, 0.52);
}

.category-card p {
  min-height: 2.6em;
  margin: 0.85rem 0 0;
  font-size: clamp(0.65rem, 1vw, 0.82rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.explorer-panel {
  height: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  border: 1px solid transparent;
  border-radius: 1.5rem;
  background: rgba(255, 250, 243, 0.94);
  box-shadow: 0 20px 58px rgba(66, 49, 33, 0.17);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: height 480ms cubic-bezier(.2,.76,.2,1), margin 480ms cubic-bezier(.2,.76,.2,1), opacity 320ms ease, border-color 320ms ease;
}

.explorer-panel.is-open {
  margin: clamp(0.85rem, 1.8vw, 1.35rem) 0;
  opacity: 1;
  border-color: rgba(121, 98, 68, 0.18);
}

.panel-inner {
  padding: clamp(1.25rem, 4vw, 3.2rem);
  transition: opacity 170ms ease, transform 170ms ease;
}

.panel-inner.is-swapping {
  opacity: 0;
  transform: translateY(6px);
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  color: #5a4831;
  background: rgba(177, 135, 65, 0.13);
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.035em;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.back-button:hover,
.back-button:focus-visible {
  background: rgba(177, 135, 65, 0.23);
  outline: none;
  transform: translateX(-2px);
}

.panel-kicker {
  margin: 0;
  color: var(--gold-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.panel-heading {
  margin: 0.25rem 0 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
}

.panel-description {
  max-width: 50rem;
  margin: 0.7rem 0 0;
  color: var(--muted-ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.5;
}

.subcategory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.subcategory-button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 4rem;
  border: 1px solid rgba(107, 90, 67, 0.16);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 5px 16px rgba(72, 54, 36, 0.045);
  cursor: pointer;
  transition: transform 190ms ease, border-color 190ms ease, box-shadow 190ms ease, background 190ms ease;
}

.subcategory-button:hover,
.subcategory-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(157, 116, 54, 0.5);
  outline: none;
  background: #fff;
  box-shadow: 0 10px 24px rgba(72, 54, 36, 0.1);
}

.subcategory-button .label {
  padding-right: 1rem;
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.18;
}

.subcategory-button .count {
  display: inline-grid;
  min-width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 999px;
  color: #6b512d;
  background: rgba(177, 135, 65, 0.14);
  font-size: 0.73rem;
  font-weight: 700;
}

.teachings-list {
  display: grid;
  gap: 0.85rem;
  margin: 1.7rem 0 0;
  padding: 0;
  list-style: none;
}

.teaching-card {
  position: relative;
  border: 1px solid rgba(107, 90, 67, 0.14);
  border-radius: 1rem;
  padding: clamp(1.1rem, 2.4vw, 1.65rem) clamp(1.1rem, 2.5vw, 1.8rem) clamp(1.1rem, 2.4vw, 1.55rem) clamp(3.2rem, 5vw, 4.2rem);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 7px 20px rgba(62, 46, 31, 0.045);
}

.teaching-number {
  position: absolute;
  top: 1.25rem;
  left: 1rem;
  color: #9c7a45;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.teaching-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.7vw, 1.42rem);
  line-height: 1.36;
}

.teaching-text a {
  color: inherit;
  text-decoration-color: transparent;
  text-underline-offset: 0.18em;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.teaching-text a:hover,
.teaching-text a:focus-visible {
  color: #775625;
  text-decoration-color: #b18743;
  outline: none;
}

.teaching-reference {
  margin: 0.7rem 0 0;
  color: #745a36;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.09em;
}

.loading-note {
  margin: 1rem 0 0;
  text-align: center;
  color: #6b625a;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  transition: opacity 220ms ease;
}

.loading-note.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.error-note {
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: #6e2f2f;
}

.footer-verse {
  position: relative;
  display: grid;
  min-height: 24rem;
  place-items: center;
  overflow: hidden;
  background-image:
    linear-gradient(180deg, rgba(248, 241, 232, 0.82), rgba(245, 237, 227, 0.66)),
    url("images/background.png");
  background-position: center 62%;
  background-size: cover;
}

.footer-verse blockquote {
  margin: 0;
  padding: 3rem 1.5rem;
  text-align: center;
}

.footer-verse p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3vw, 2.45rem);
  font-style: italic;
  line-height: 1.15;
}

.footer-verse cite {
  display: block;
  margin-top: 1.2rem;
  color: #6e665e;
  font-size: 0.73rem;
  font-style: normal;
  font-weight: 650;
  letter-spacing: 0.25em;
}

.noscript-message {
  margin: 0;
  padding: 1rem;
  text-align: center;
  background: #fff4d8;
}

@media (max-width: 760px) {
  main {
    display: flex;
    min-height: 100svh;
    flex-direction: column;
  }

  .hero {
    flex: 0 0 29.375rem;
    width: 100%;
    min-height: 0;
    background-position: 74% top;
    background-size: auto 36rem;
  }

  .hero-shade {
    background:
      linear-gradient(90deg, rgba(255, 250, 243, 0.91) 0%, rgba(255, 250, 243, 0.66) 37%, rgba(255, 250, 243, 0.03) 66%),
      linear-gradient(180deg, rgba(249, 241, 231, 0.08) 42%, rgba(40, 31, 24, 0.13) 100%);
  }

  .brand-lockup {
    top: max(2.75rem, calc(env(safe-area-inset-top) + 0.2rem));
    left: 1.2rem;
  }

  .brand-name {
    font-size: clamp(1.72rem, 7.65vw, 1.9rem);
    line-height: 0.9;
  }

  .brand-tagline {
    margin-top: 0.45rem;
    font-size: clamp(0.47rem, 1.95vw, 0.58rem);
    letter-spacing: 0.28em;
  }

  .hero-copy {
    top: 23.25%;
    left: 1.2rem;
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 8.65vw, 2.16rem);
    line-height: 0.94;
    letter-spacing: -0.035em;
  }

  .hero-copy p {
    margin-top: 1.05rem;
    font-size: clamp(0.51rem, 2.05vw, 0.62rem);
    line-height: 1.43;
    letter-spacing: 0.26em;
  }

  .gold-rule {
    width: 2.4rem;
    margin-top: 0.85rem;
  }

  .hero-verse {
    right: 1.25rem;
    bottom: 5.85rem;
  }

  .hero-verse p {
    font-size: clamp(1.55rem, 7.6vw, 1.9rem);
  }

  .hero-verse span {
    width: 1.55rem;
    margin: 0.7rem auto 0.55rem;
  }

  .hero-verse cite {
    font-size: 0.47rem;
    letter-spacing: 0.22em;
  }

  .explorer-shell {
    flex: 0 0 auto;
    width: calc(100vw - 1.3rem);
    margin-top: -7.4rem;
    padding-bottom: 0.5rem;
  }

  .category-row {
    gap: 0.45rem;
  }

  .category-card {
    min-height: clamp(7.75rem, 32vw, 8.05rem);
    border-radius: 0.7rem;
  }

  .category-card::after {
    inset: 0.28rem;
    border-radius: 0.48rem;
  }

  .category-card::before {
    background-image:
      linear-gradient(180deg, rgba(16, 18, 18, 0.01) 16%, rgba(19, 22, 22, 0.16) 45%, rgba(24, 25, 25, 0.72) 69%, rgba(241, 233, 220, 0.92) 100%),
      var(--card-image);
  }

  .card-content {
    min-height: 67%;
    padding: 0.38rem 0.18rem 0.48rem;
  }

  .category-icon {
    width: clamp(1.38rem, 5.9vw, 1.55rem);
    height: clamp(1.38rem, 5.9vw, 1.55rem);
    margin-bottom: 0.32rem;
  }

  .category-card h3 {
    min-height: 2.12em;
    font-size: clamp(0.72rem, 3.25vw, 0.82rem);
    line-height: 1.02;
  }

  .category-card p {
    min-height: 2.75em;
    margin-top: 0.34rem;
    font-size: clamp(0.39rem, 1.62vw, 0.44rem);
    line-height: 1.2;
    letter-spacing: 0.055em;
    color: #2f2c29;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.72);
  }

  .explorer-panel {
    border-radius: 1rem;
  }

  .panel-inner {
    padding: 1rem 0.85rem 1.15rem;
  }

  .panel-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .back-button {
    min-height: 2.5rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
  }

  .panel-kicker {
    font-size: 0.62rem;
  }

  .panel-heading {
    font-size: 2rem;
  }

  .panel-description {
    font-size: 1rem;
  }

  .subcategory-list {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-top: 1rem;
  }

  .subcategory-button {
    min-height: 3.35rem;
    padding: 0.72rem 0.78rem;
  }

  .subcategory-button .label {
    font-size: 1rem;
  }

  .subcategory-button .count {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.66rem;
  }

  .teaching-card {
    padding: 1rem 0.9rem 1rem 2.9rem;
  }

  .teaching-number {
    top: 1.05rem;
    left: 0.8rem;
  }

  .teaching-text {
    font-size: 1.1rem;
  }

  .teaching-reference {
    font-size: 0.7rem;
  }

  .footer-verse {
    flex: 1 0 9rem;
    min-height: 9rem;
    background-position: left 72%;
    background-size: auto 31rem;
  }

  .footer-verse blockquote {
    padding: 1.35rem 1rem 1rem;
  }

  .footer-verse p {
    font-size: clamp(1.03rem, 4.8vw, 1.22rem);
    line-height: 1.12;
  }

  .footer-verse cite {
    margin-top: 0.75rem;
    font-size: 0.57rem;
    letter-spacing: 0.23em;
  }

  .footer-verse span {
    width: 1.9rem;
    margin: 0.75rem auto 0;
  }

  .loading-note.is-hidden {
    display: none;
  }
}

@media (max-width: 370px) {
  .category-row {
    gap: 0.32rem;
  }

  .category-card {
    min-height: 9.8rem;
  }

  .category-card h3 {
    font-size: 0.74rem;
  }

  .category-card p {
    font-size: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
