/* =========================================================
   CLEANER, MORE CONSISTENT LAYOUT + CARD ALIGNMENT (RELEARN)
   Drop-in replacement: keeps your aesthetic, fixes spacing,
   grid borders, typography rhythm, and "title-only" cards.
   ========================================================= */

/* Font import is fine */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600&display=swap');

:root{
  --burgundy:#7b001c;
  --burgundy-soft: rgba(123,0,28,0.35);

  --ink: rgba(18,18,18,0.92);
  --muted: rgba(18,18,18,0.70);

  --card: rgba(255,255,255,0.92);
  --card-border: rgba(0,0,0,0.07);
  --shadow: 0 12px 28px rgba(0,0,0,0.08);

  --parchment:#f4ede0;

  --teal:#007c72;
  --teal-soft:#e8f4f3;

  /* NEW: spacing tokens (makes everything align) */
  --content-max: 980px;        /* was 1180; tighter reads better with sidebar */
  --gutter: 1.35rem;
  --radius-1: 14px;
  --radius-2: 16px;
  --radius-3: 18px;
}

/* =========================
   GLOBAL TYPOGRAPHY + RHYTHM
   ========================= */
html, body,
#R-body, #R-content,
h1, h2, h3, h4, h5, h6,
#R-content *{
  font-family: "EB Garamond", serif !important;
}

html, body{ overflow-x:hidden; }
#R-content{ color: var(--ink); }

/* Better vertical rhythm */
#R-content :where(p, ul, ol){
  line-height: 1.6;
  margin: 0.65rem 0;
}

/* Justify only on wider screens (prevents ugly gaps on mobile) */
#R-content p{
  hyphens: auto;
}
@media (min-width: 900px){
  #R-content p{
    text-align: justify;
    text-justify: inter-word;
  }
}

/* Headings spacing consistent */
#R-content :where(h1,h2,h3,h4){
  letter-spacing: 0.01em;
  margin: 1.15rem 0 0.55rem 0;
}
#R-content h1{ margin-top: 0.25rem; }
#R-content h2{ margin-top: 1.6rem; }

/* Hide heavy dividers */
hr{ display:none !important; }

/* =========================
   HIDE RIGHT TOC (clean look)
   ========================= */
#R-toc,
#R-toc-wrapper,
#R-toc-container,
#R-toc-content,
.R-sidebar-right,
.right-sidebar{
  display:none !important;
}

/* =========================
   CONTENT WIDTH (better with left sidebar)
   ========================= */
#R-content{
  max-width: var(--content-max) !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 var(--gutter) !important;
}

@media (max-width: 760px){
  :root{ --gutter: 1.05rem; }
}

/* =========================
   MINI TOP BAR
   ========================= */
#mini-topbar{
  position: sticky;
  top: 0.65rem;
  z-index: 9999;

  max-width: var(--content-max);
  margin: 0.65rem auto 1rem auto;
  padding: 0.7rem 1.05rem;

  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 1rem;

  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-2);
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: var(--shadow);
}

#mini-topbar a{
  text-decoration: none;
  font-weight: 600;
  color: var(--burgundy);
}
#mini-topbar a:hover{
  text-decoration: underline;
  text-decoration-color: var(--burgundy-soft);
}

/* =========================
   HERO IMAGE (kept, but you said you may remove later)
   ========================= */
#hero-image{
  max-width: var(--content-max);
  margin: 0.25rem auto 1.2rem auto;
  border-radius: var(--radius-3);
  overflow: hidden;
  background: #0b1c2d;
  box-shadow: 0 16px 40px rgba(0,0,0,0.14);
  border: 1px solid rgba(255,255,255,0.08);
}
#hero-image img{
  width: 100%;
  height: clamp(240px, 32vh, 440px);
  object-fit: cover;
  display: block;
}

/* =========================
   SECTION HEADERS (with icons)
   ========================= */
.sec{
  display:inline-flex;
  align-items:center;
  gap: 0.55rem;
}
.sec .ico{
  width: 1.2rem;
  height: 1.2rem;
  color: var(--burgundy);
}

/* STATS BAND — clean grid borders */
.stat{
  padding: 0.95rem 1.05rem;
  background: rgba(255,255,255,0.35);
  border-left: 1px solid rgba(0,0,0,0.07);
  border-top: 1px solid rgba(0,0,0,0.07);
}

/* Desktop: 4 columns → first row has no top border */
.stats-inner .stat:nth-child(-n+4){
  border-top: none;
}

/* Tablet: 2 columns → first row = first 2 items */
@media (max-width: 980px){
  .stats-inner .stat:nth-child(-n+2){
    border-top: none;
  }
}

/* Mobile: 1 column → remove left borders; keep only top separators */
@media (max-width: 520px){
  .stat{
    border-left: none;
  }
  .stats-inner .stat:first-child{
    border-top: none;
  }
}

/* =========================
   CALLOUTS
   ========================= */
.callout{
  max-width: var(--content-max);
  margin: 1rem auto;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-2);
  background: var(--teal-soft);
  border: 1.5px solid rgba(0,124,114,0.30);
  box-shadow: 0 10px 22px rgba(0,0,0,0.06);
}

.callout .tag{
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}
.callout p{
  margin: 0;
  color: rgba(18,18,18,0.82);
}

/* =========================
   MODULE GRID (match spacing)
   ========================= */
.mod-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
  margin: 0.8rem 0 1.1rem 0;
}
@media (max-width: 800px){
  .mod-grid{ grid-template-columns: 1fr; }
}

.mod-card{
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-1);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.mod-card .k{
  font-weight: 600;
  color: var(--burgundy);
  margin-bottom: 0.35rem;
}
.mod-card .p{
  margin: 0;
  color: rgba(18,18,18,0.74);
}

/* =========================
   PROJECT BREAKDOWN (cards) — aligned titles, equal heights
   ========================= */
.breakdown{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 0.75rem 0 1.25rem 0;
}
.break-card{
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-1);
  padding: 14px 16px;
  box-shadow: var(--shadow);

  /* NEW: equal height feel */
  display:flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 110px;
}
.break-card h4{
  margin: 0;
  color: var(--burgundy);
  font-weight: 600;
  line-height: 1.2;
}
.break-card p{
  margin: 0;
  color: rgba(18,18,18,0.74);
}

/* =========================
   REFERENCES
   ========================= */
.refs{
  max-width: var(--content-max);
  margin: 1.25rem auto 0 auto;
  padding: 1.0rem 1.05rem;
  border-radius: var(--radius-2);
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 10px 22px rgba(0,0,0,0.06);
}
.refs ol{
  margin: 0.25rem 0 0 0;
  padding-left: 1.15rem;
}
.refs li{
  margin: 0.75rem 0;
  line-height: 1.55;
}
.refs a{
  color: var(--burgundy);
  text-decoration: none;
  border-bottom: 1px solid rgba(123,0,28,0.22);
}
.refs a:hover{
  border-bottom-color: rgba(123,0,28,0.6);
}

/* =========================
   CONTACT LINKS
   ========================= */
.contact-links{
  display:flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}
.contact-links a{
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--burgundy);
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(123,0,28,0.25);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.contact-links a:hover{
  color: var(--ink);
  border-bottom-color: rgba(123,0,28,0.6);
  transform: translateY(-1px);
}

/* =========================================================
   RELEARN "CARDS": title-only + equal height everywhere
   ========================================================= */

/* Hide only card descriptions (safer than hiding all <p>) */
.card-container .card .card-content-text,
.card-container .card .card-description,
.card.card-popout .card-content-text,
.card.card-popout .card-description{
  display: none !important;
}

/* Equal height + centered titles */
.card-container .card,
.card.card-popout{
  min-height: 92px !important;
  display: flex !important;
  align-items: center !important;
}

/* Title styling */
.card .card-title a{
  font-weight: 650 !important;
  font-size: 1.05rem !important;
  line-height: 1.25 !important;
  display: block !important;
}

/* Tighten padding */
.card .card-content{
  padding: 14px 16px !important;
}

/* Nice hover */
.card.card-popout:hover{
  transform: translateY(-2px);
  transition: transform 180ms ease;
}

/* Ensure hero images are never hidden */
.project-hero img,
#hero-image img{
  display: block !important;
  height: auto !important;
  max-width: 100% !important;
}
