@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root{
  --cream: #f8f6f0;
  --sidebar-bg: #fbfaf6;
  --ink: #2e2c26;
  --muted: #918c7c;
  --hairline: #e7e2d4;

  --green: #3d5c43;
  --green-bg: #e7ece2;
  --green-bg-solid: #eef1ea;

  --gold: #b1793f;
  --gold-bg: #f4e9d7;

  --blue: #3e5e8c;
  --blue-bg: #e6eaf2;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

*{ box-sizing: border-box; }

html, body{
  margin:0;
  padding:0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Lora', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; text-decoration: none; }

/* Editor content (RTE/Image content elements, not just the hero) can embed arbitrary-sized
   images; without this any image wider than its column would overflow horizontally on narrow
   screens instead of scaling down. */
img{ max-width:100%; height:auto; }

.layout{
  display:flex;
  min-height:100vh;
}

/* ---------- Mobile topbar ---------- */
/* Hidden by default (desktop uses the full sidebar); shown below "lg" (see the breakpoints
   section at the end of this file) as a sticky bar with a hamburger button that opens the
   sidebar as an off-canvas drawer. Toggle behaviour lives in nav-toggle.js. */
.mobile-topbar{
  display:none;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding: 14px 20px;
  background: var(--sidebar-bg);
  border-bottom:1px solid var(--hairline);
  position:sticky;
  top:0;
  z-index:110;
}
.mobile-topbar-brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.mobile-topbar-brand svg{ width:34px; height:24px; flex-shrink:0; }
.mobile-topbar-brand .brand-name{ font-size:14px; }

.nav-toggle{
  width:40px;
  height:40px;
  flex-shrink:0;
  border-radius: var(--radius-md);
  border:1px solid var(--hairline);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color: var(--ink);
}
.nav-toggle svg{ width:20px; height:20px; }

/* Backdrop behind the open drawer; also the tap target that closes it. */
.nav-overlay{
  display:none;
  position:fixed;
  inset:0;
  background: rgba(30,28,20,.4);
  z-index:90;
}
.nav-overlay--visible{ display:block; }

/* ---------- Sidebar ---------- */
.sidebar{
  width: 272px;
  flex-shrink:0;
  background: var(--sidebar-bg);
  border-right:1px solid var(--hairline);
  padding: 34px 26px;
  display:flex;
  flex-direction:column;
}

.brand{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
  margin-bottom: 38px;
  padding-left: 4px;
}

.brand svg{ width:74px; height:56px; }

.brand-name{
  font-family:'Playfair Display', serif;
  font-size: 17px;
  letter-spacing: 2.5px;
  font-weight:600;
  color: var(--ink);
}

.brand-sub{
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top:-8px;
}

.nav{
  display:flex;
  flex-direction:column;
  gap: 4px;
}

.nav a{
  display:flex;
  align-items:center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--ink);
  transition: background .15s ease;
}

.nav a:hover{ background: #f1efe8; }

.nav a.active{
  background: var(--green-bg);
  color: var(--green);
  font-weight:600;
}

.nav a svg{ width:20px; height:20px; flex-shrink:0; }
.nav a .tib-glyph{ font-size:18px; width:20px; text-align:center; }

.nav-divider{
  height:1px;
  background: var(--hairline);
  margin: 14px 4px;
}

.sidebar-footer{
  margin-top:auto;
  padding-top: 30px;
  text-align:center;
  color: var(--muted);
}

.sidebar-footer .knot{
  width:56px;
  margin: 0 auto 14px;
  opacity: .55;
}

.sidebar-footer .om{
  font-size: 20px;
  color:#c7bfa4;
  margin-bottom: 6px;
}

.sidebar-footer .om-label{
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ---------- Main ---------- */
.main{
  flex:1;
  min-width:0;
}

/* ---------- Home hero ---------- */
.hero{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  padding: 70px 40px 60px;
  text-align:center;
  /* No default background and no forced height: with no editor image, the hero is just its
     text content — it collapses to that height and the cards below (negative margin-top) ride
     up right underneath it. See .hero--has-image for the sizing an editor image needs. */
  /* Text color defaults — h1/p/divider read these custom properties rather than hardcoding a
     color each. The editor's color-picker value (Hero.html) overrides them inline per instance,
     so these only apply as a fallback for content elements saved before that field existed. */
  --hero-title-color: var(--green);
  --hero-subtitle-color: #6b6656;
  --hero-divider-color: var(--gold);
}

/* Only applied when an editor image is set (see Hero.html) — gives .hero-media something
   sized to fill. aspect-ratio matches the shipped hero.png's own ratio, which keeps any editor
   image close to that framing too; z-index establishes the stacking context .hero-media's
   negative z-index needs to stay scoped locally instead of escaping to the root.
   Deliberately no min-height here: combining min-height with aspect-ratio on an auto-width flex
   box makes browsers derive the WIDTH from min-height via the ratio once the aspect-ratio-only
   height would undershoot it (560px here) — .hero then renders ~1262px wide regardless of the
   real viewport, pushing h1/p off-screen on narrow screens. aspect-ratio alone (adjusted per
   breakpoint below) is the only height source, so that never happens. */
.hero--has-image{
  z-index:0;
  aspect-ratio: 1262 / 560;
  overflow:hidden;
}

/* Editor-uploaded hero image, rendered as a real <picture>/<img> (not CSS background) so the
   browser can pick a device-appropriate srcset and treat it as an LCP candidate. Absolutely
   positioned with a negative z-index so it sits behind the (non-positioned) h1/p/divider without
   taking part in the flex layout above. */
.hero-media{
  position:absolute;
  inset:0;
  z-index:-1;
}
.hero-media-img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:right top;
}

.hero h1{
  font-family:'Playfair Display', serif;
  font-weight: 600;
  font-size: clamp(30px, 6vw + 12px, 58px); /* scales continuously between breakpoints instead of jumping */
  color: var(--hero-title-color);
  margin: 0 0 12px;
}

.hero p{
  font-size: 17px;
  color: var(--hero-subtitle-color);
  margin: 0 0 18px;
}

.hero .divider{
  display:flex;
  align-items:center;
  gap:10px;
  color: var(--hero-divider-color);
  font-size:14px;
  letter-spacing:3px;
}
.hero .divider::before,
.hero .divider::after{
  content:"";
  width:70px;
  height:1px;
  background: var(--hero-divider-color);
  opacity:.5;
}

/* ---------- Cards ---------- */
.cards{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  padding: 0 60px;
  margin-top: -30px;
  position:relative;
  z-index:2;
}

.card{
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  text-align:center;
}

.card.green{ background: var(--green-bg); }
.card.gold{ background: var(--gold-bg); }
.card.blue{ background: var(--blue-bg); }

.card .icon{
  width:64px;
  height:64px;
  border-radius:50%;
  background: rgba(255,255,255,.6);
  display:flex;
  align-items:center;
  justify-content:center;
  margin: 0 auto 18px;
}
.card.green .icon{ color: var(--green); font-size:26px; }
.card.gold .icon svg{ color: var(--gold); }
.card.blue .icon svg{ color: var(--blue); }

.card h3{
  font-family:'Playfair Display', serif;
  font-size: 24px;
  margin: 0 0 10px;
}
.card.green h3{ color: var(--green); }
.card.gold h3{ color: var(--gold); }
.card.blue h3{ color: var(--blue); }

.card p{
  font-size: 14.5px;
  color: #74705f;
  line-height:1.5;
  margin: 0 0 18px;
}

.card .go{
  font-size: 20px;
}
.card.green .go{ color: var(--green); }
.card.gold .go{ color: var(--gold); }
.card.blue .go{ color: var(--blue); }

.search-bar{
  margin: 46px 60px 0;
  display:flex;
  align-items:center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 18px 26px;
  box-shadow: 0 8px 24px rgba(60,50,20,.04);
  color: var(--muted);
  font-size:15px;
}

.search-bar svg{ width:18px; height:18px; flex-shrink:0; }

.search-bar-input{
  flex:1;
  min-width:0;
  border:none;
  outline:none;
  background:transparent;
  padding:0;
  color: var(--ink);
  font-family:'Lora', serif;
  font-size:15px;
}
.search-bar-input::placeholder{ color: var(--muted); }
.search-bar-input::-webkit-search-cancel-button{ display:none; }

.page-pad-bottom{ height: 60px; }

/* ---------- Detail pages ---------- */
/* The Abigud/Dictionary plugins go through TYPO3's default content-element frame (unlike our
   own Hero/Card FLUIDTEMPLATEs), which auto-renders the content element's own "header" field as
   a bare <h2> with zero side padding — add the same horizontal rhythm as .detail-topbar/
   .entries-grid below it so it doesn't sit flush against the viewport edge. */
.frame > header > h2{
  padding: 0 44px;
}

.detail-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 30px 44px 0;
}

.breadcrumb{
  display:flex;
  align-items:center;
  gap:8px;
  color: var(--muted);
  font-size:14.5px;
}
.breadcrumb svg{ width:16px; height:16px; }
.breadcrumb .sep{ opacity:.5; }
.breadcrumb .current{ color: var(--ink); }

.back-link{
  display:flex;
  align-items:center;
  gap:8px;
  font-size: 14.5px;
  color: var(--ink);
}
.back-link svg{ width:16px; height:16px; }

.topbar-actions{
  display:flex;
  align-items:center;
  gap: 10px;
}
.topbar-actions button{
  width: 38px;
  height: 38px;
  border-radius:50%;
  border:1px solid var(--hairline);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color: var(--ink);
}
.topbar-actions button svg{ width:17px; height:17px; }

.back-button{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--hairline);
  background:#fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-size:14.5px;
  cursor:pointer;
  color: var(--ink);
  font-family:'Lora', serif;
}
.back-button svg{ width:15px; height:15px; }

.detail-card{
  margin: 26px 44px 40px;
  background:#fff;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow:hidden;
}

.detail-row{
  display:grid;
  grid-template-columns: 220px 1fr;
  border-bottom: 1px solid var(--hairline);
}
.detail-row:last-child{ border-bottom:none; }

.detail-label{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding: 24px 26px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 1.3px;
  text-transform:uppercase;
}
.detail-label .lbl-icon{
  width:30px;
  height:30px;
  border-radius: 8px;
  background: var(--green-bg-solid);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  color: var(--green);
  font-size:13px;
}
.detail-label .lbl-icon svg{ width:15px; height:15px; }

.detail-value{
  padding: 20px 30px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 20px;
}

.detail-value.split{
  padding:0;
}
.split-half{
  flex:1;
  padding: 20px 30px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.split-half + .split-half{
  border-left: 1px solid var(--hairline);
}
.split-tag{
  font-size: 11px;
  letter-spacing:1px;
  color: var(--muted);
  background: var(--cream);
  border-radius: 6px;
  padding: 3px 8px;
  margin-right: 12px;
}

.word-title{
  font-family:'Playfair Display', serif;
  font-size: clamp(24px, 4vw + 10px, 34px);
  font-weight:600;
  letter-spacing:1px;
}

.tibetan-script{
  font-size: clamp(22px, 3vw + 10px, 30px);
  color: var(--ink);
}

.pronunciation{
  font-style: italic;
  font-size: 19px;
  color: #55523f;
}

.eng-value, .ukr-value{
  font-size: 19px;
}

.icon-btn{
  width:34px;
  height:34px;
  border-radius:50%;
  background: var(--green-bg-solid);
  border:none;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--green);
  cursor:pointer;
  flex-shrink:0;
}
.icon-btn svg{ width:15px; height:15px; }

.tag-pill{
  display:inline-block;
  background: var(--cream);
  border: 1px solid var(--hairline);
  color: #6b6650;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 999px;
}
.tag-pill + .tag-pill{ margin-left: 8px; }

.notes-box{
  flex:1;
  position:relative;
  padding-right: 40px;
}
.notes-box ul{
  margin:0;
  padding-left: 18px;
  color: #4b4838;
  font-size: 15px;
  line-height: 1.9;
}
.notes-box .example-tib{
  font-size: 18px;
  color: var(--ink);
  margin-top:2px;
}
.notes-box .example-tr{
  font-style: italic;
  color: #6b6650;
}
.edit-pencil{
  position:absolute;
  top:0;
  right:0;
  color: var(--muted);
}
.edit-pencil svg{ width:16px; height:16px; }

.illustration-row{
  display:flex;
  align-items:stretch;
}
.illustration-img{
  flex: 1.4;
  min-height: 220px;
  background-size: cover;
  background-position: center;
}
.illustration-note{
  flex:1;
  background: var(--cream);
  padding: 30px 34px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap: 14px;
}
.illustration-note h4{
  margin:0;
  font-family:'Playfair Display', serif;
  font-size: 19px;
  color: var(--ink);
}
.illustration-note p{
  margin:0;
  font-size: 14.5px;
  color: #6b6650;
  line-height: 1.6;
}
.illustration-note .heart{ color: #b7ae94; }

.assoc-list{
  margin:0;
  padding-left: 18px;
  font-size: 14px;
  color:#6b6650;
  line-height:1.8;
}

.detail-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 44px 44px 60px;
  color: var(--ink);
  font-size:15px;
}
.detail-footer a{ display:flex; align-items:center; gap:8px; }
.detail-footer svg{ width:16px; height:16px; }

/* ---------- Entries list ---------- */
.entries-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  padding: 26px 44px 40px;
}

.entry-tile{
  background:#fff;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  text-align:center;
  transition: box-shadow .15s ease;
}
.entry-tile:hover{ box-shadow: 0 8px 24px rgba(60,50,20,.06); }

.entry-tile-glyph{
  font-size: 26px;
  color: var(--green);
  margin-bottom: 10px;
}

.entry-tile-title{
  font-family:'Playfair Display', serif;
  font-size: 17px;
  font-weight:600;
  color: var(--ink);
}

.entry-tile-pronunciation{
  font-style: italic;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 4px;
}

.entries-empty{
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 15px;
}

/* ==========================================================================
   Responsive breakpoints — aligned to Bootstrap 5's grid (the same xs/sm/md/
   lg/xl scale used for the hero's <picture> sources), so "tablet" or
   "desktop" means the same viewport width everywhere on the site. Each block
   only lists what actually changes at that width; unlisted rules keep
   cascading down from the desktop styles above.
   ========================================================================== */

/* < xl (1200px): entries list goes from 4 to 3 columns before it gets cramped. */
@media (max-width: 1199.98px){
  .entries-grid{ grid-template-columns: repeat(3, 1fr); }
}

/* < lg (992px): the sidebar becomes an off-canvas drawer (opened via the hamburger button in
   .mobile-topbar, wired up in nav-toggle.js) instead of a permanent column; cards/entries drop
   a column. */
@media (max-width: 991.98px){
  .mobile-topbar{ display:flex; }

  .sidebar{
    position:fixed;
    top:0; left:0; bottom:0;
    width:280px;
    max-width:82vw;
    z-index:100;
    transform:translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 16px 0 40px rgba(30,28,20,.18);
  }
  .sidebar.sidebar--open{ transform:translateX(0); }

  .cards{ grid-template-columns: repeat(2, 1fr); }
  .entries-grid{ grid-template-columns: repeat(2, 1fr); }
}

/* < md (768px): hero/detail pages switch from a 2-column to a stacked layout. */
@media (max-width: 767.98px){
  .hero{ padding: 40px 20px 40px; }
  .hero--has-image{ aspect-ratio: 3 / 4; } /* taller ratio so the banner stays a reasonable height on narrow screens instead of the ~170px a 2.25:1 ratio would give */
  .detail-row{ grid-template-columns: 1fr; }
  .illustration-row{ flex-direction:column; }
  .detail-topbar, .detail-card, .detail-footer{ margin-left:16px; margin-right:16px; padding-left:20px; padding-right:20px; }
  .entries-grid{ padding: 20px 20px 30px; }
  .frame > header > h2{ padding: 0 20px; }
}

/* < sm (576px): phones — everything goes single-column and paddings tighten up. */
@media (max-width: 575.98px){
  .cards{ grid-template-columns: 1fr; padding:0 16px; }
  .entries-grid{ grid-template-columns: 1fr; padding: 20px 16px 30px; }
  .search-bar{ margin:24px 16px 0; padding: 14px 20px; }
  .frame > header > h2{ padding: 0 16px; }

  .detail-value{ flex-wrap:wrap; row-gap:10px; }
  .split-half{ flex-direction:column; align-items:flex-start; gap:6px; }
  .split-half + .split-half{ border-left:none; border-top:1px solid var(--hairline); }

  .detail-topbar{ flex-direction:column; align-items:flex-start; gap:14px; }
  .detail-footer{ flex-direction:column; align-items:flex-start; gap:14px; }
}
