/* ============================================================
   INKWELL — layout.css
   Structural layout: header, hero, content grid, sidebar, footer
   ============================================================ */

/* ══════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════ */
.ink-topbar {
  background: var(--ink-900);
  color: var(--ink-300);
  font-size: 0.8125rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.ink-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-4);
  min-height: 2rem;
}

/* ══════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════ */
.ink-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--dur-med) var(--ease);
}

.ink-header.is-scrolled { box-shadow: var(--shadow-md); }

.ink-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  height: 68px;
}

/* Logo */
.ink-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.ink-logo__img { height: 36px; width: auto; }
.ink-logo__text {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.03em;
}
.ink-logo__text::after { content: '.'; color: var(--accent); }

/* Primary navigation */
.ink-nav { flex: 1; display: flex; align-items: center; justify-content: center; }

/* Override Joomla menu module default styles */
.ink-nav ul,
.ink-nav .nav { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; gap: 0; }
.ink-nav li { position: relative; }
.ink-nav li a,
.ink-nav li span.separator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.ink-nav li a:hover,
.ink-nav li.active > a,
.ink-nav li.current > a {
  color: var(--accent);
  background: var(--accent-light);
}

/* Dropdown */
.ink-nav li ul {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--dur-med) var(--ease);
  pointer-events: none;
}
.ink-nav li:hover > ul,
.ink-nav li:focus-within > ul {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.ink-nav li ul li a { font-size: 0.875rem; border-radius: var(--r-md); }

/* Header actions (search + hamburger) */
.ink-header__actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex-shrink: 0; }
.ink-header__search { }

/* Hamburger */
.ink-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  padding: 0;
  transition: border-color var(--dur-fast) var(--ease);
}
.ink-hamburger:hover { border-color: var(--accent); }
.ink-hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--dur-med) var(--ease), opacity var(--dur-fast) var(--ease);
}
.ink-hamburger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.ink-hamburger.is-open span:nth-child(2) { opacity: 0; }
.ink-hamburger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════════
   OFF-CANVAS DRAWER
   ══════════════════════════════════════════════════════════════ */
.ink-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(340px, 90vw);
  background: var(--surface);
  z-index: 400;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.ink-drawer[aria-hidden="false"] { transform: translateX(0); }

.ink-drawer__close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--text-2);
}
.ink-drawer__close:hover { background: var(--surface-2); }
.ink-icon--close::before { content: '×'; }

.ink-drawer__inner {
  padding: var(--sp-12) var(--sp-6) var(--sp-8);
}

/* Drawer nav links */
.ink-drawer__inner ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.ink-drawer__inner li a {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ink-drawer__inner li a:hover { background: var(--accent-light); color: var(--accent); }

.ink-drawer__overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 390;
  opacity: 0; visibility: hidden;
  transition: all var(--dur-slow) var(--ease);
  backdrop-filter: blur(2px);
}
.ink-drawer__overlay.is-visible { opacity: 1; visibility: visible; }

/* ══════════════════════════════════════════════════════════════
   HERO BANNER
   ══════════════════════════════════════════════════════════════ */
.ink-hero {
  position: relative;
  min-height: clamp(480px, 65vh, 780px);
  display: flex;
  align-items: center;
  overflow: hidden;
  color: var(--hero-text);
}

.ink-hero__backdrop {
  position: absolute;
  inset: 0;
  background: var(--hero-bg);
  background-size: cover;
  background-position: center;
  z-index: 0;
}

/* Overlay gradient when hero-bg is an image */
.ink-hero__backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(14,12,10,.85) 0%,
    rgba(14,12,10,.55) 55%,
    rgba(14,12,10,.2) 100%
  );
}

/* Decorative grain texture */
.ink-hero__backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  z-index: 1;
}

.ink-hero__inner {
  position: relative;
  z-index: 2;
  padding-block: var(--sp-20);
}

.ink-hero__content {
  max-width: 680px;
  animation: heroReveal 0.9s var(--ease-out) both;
}

@keyframes heroReveal {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ink-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--sp-4);
  animation: heroReveal 0.7s var(--ease-out) 0.1s both;
}

.ink-hero__eyebrow::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.ink-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: var(--sp-5);
  animation: heroReveal 0.8s var(--ease-out) 0.15s both;
}

.ink-hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255,255,255,.7);
  line-height: 1.6;
  max-width: 55ch;
  margin-bottom: var(--sp-8);
  animation: heroReveal 0.8s var(--ease-out) 0.25s both;
}

.ink-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  animation: heroReveal 0.8s var(--ease-out) 0.35s both;
}

.ink-hero__scroll-nudge {
  position: absolute;
  bottom: var(--sp-8);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.4);
  transition: color var(--dur-fast) var(--ease);
  animation: scrollNudge 2.5s var(--ease) 1.5s infinite;
  z-index: 2;
}
.ink-hero__scroll-nudge:hover { color: rgba(255,255,255,.8); }
.ink-hero__scroll-nudge svg { width: 36px; height: 36px; }

@keyframes scrollNudge {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: .4; }
  50%       { transform: translateX(-50%) translateY(8px); opacity: .8; }
}

/* ══════════════════════════════════════════════════════════════
   HIGHLIGHT STRIP
   ══════════════════════════════════════════════════════════════ */
.ink-highlights {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.ink-highlights__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.ink-highlight-cell {
  padding: var(--sp-8) var(--sp-8);
  border-right: 1px solid var(--border);
}

.ink-highlight-cell:last-child { border-right: none; }

@media (max-width: 900px) {
  .ink-highlights__grid { grid-template-columns: 1fr; }
  .ink-highlight-cell { border-right: none; border-bottom: 1px solid var(--border); }
  .ink-highlight-cell:last-child { border-bottom: none; }
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT WRAPPER
   ══════════════════════════════════════════════════════════════ */
.ink-main-wrap {
  padding-block: var(--sp-10) var(--sp-16);
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT GRID — component + sidebar
   ══════════════════════════════════════════════════════════════ */
.ink-layout {
  display: grid;
  gap: var(--sp-10);
  align-items: start;
}

.ink-layout--with-sidebar {
  grid-template-columns: 1fr 300px;
}

.ink-layout--with-sidebar.ink-layout--sidebar-left {
  grid-template-columns: 300px 1fr;
}

.ink-layout--full {
  grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
  .ink-layout--with-sidebar,
  .ink-layout--with-sidebar.ink-layout--sidebar-left {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════
   JOOMLA BLOG / ARTICLE GRID OVERRIDES
   Targets com_content blog layout output
   ══════════════════════════════════════════════════════════════ */
/* Featured (leading) articles */
.blog-featured,
.items-leading { margin-bottom: var(--sp-8); }

/* Article grid */
.blog-items,
.items-row,
.items-more {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
}

/* Each article in grid */
.blog-item,
.item,
.com-content-category__items .row > div {
  /* Individual item — card applied via html override */
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════ */
.ink-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  position: sticky;
  top: calc(68px + var(--sp-4));
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ink-sidebar::-webkit-scrollbar { width: 4px; }
.ink-sidebar::-webkit-scrollbar-track { background: transparent; }
.ink-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.ink-sidebar__slot { /* each widget slot — styled via ink_sidebar_widget chrome */ }

/* ══════════════════════════════════════════════════════════════
   PRE-FOOTER
   ══════════════════════════════════════════════════════════════ */
.ink-prefooter {
  background: var(--ink-900);
  color: var(--ink-300);
  padding-block: var(--sp-16);
}

.ink-prefooter__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-8);
}

@media (max-width: 1024px) { .ink-prefooter__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .ink-prefooter__grid { grid-template-columns: 1fr; } }

/* Prefooter widget styles */
.ink-prefooter .moduletable h3,
.ink-prefooter .moduletable .module-title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.ink-prefooter .moduletable ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.ink-prefooter .moduletable ul li a { color: var(--ink-400); font-size: 0.875rem; transition: color var(--dur-fast) var(--ease); }
.ink-prefooter .moduletable ul li a:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */
.ink-footer {
  background: var(--ink-950);
  color: var(--ink-500);
  border-top: 1px solid rgba(255,255,255,.05);
  padding-block: var(--sp-6);
  font-size: 0.875rem;
}

.ink-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.ink-footer__left { color: var(--ink-500); }
.ink-footer__right { }

.ink-social-links { display: flex; align-items: center; gap: var(--sp-3); }
.ink-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--ink-400);
  transition: all var(--dur-fast) var(--ease);
}
.ink-social-link svg { width: 16px; height: 16px; }
.ink-social-link:hover { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.2); }

/* ══════════════════════════════════════════════════════════════
   MODULE CHROME STYLES
   (Joomla module style="" attribute values)
   ══════════════════════════════════════════════════════════════ */

/* ink_sidebar_widget: styled card used in sidebar positions */
/* (This chrome is applied via php files in html/modules.php or inline) */
/* The classes are added programmatically — see html/ folder */

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .ink-nav { display: none; }
  .ink-hamburger { display: flex; }

  .ink-hero { min-height: 60vh; }
  .ink-hero__inner { padding-block: var(--sp-12); }

  .ink-main-wrap { padding-block: var(--sp-8) var(--sp-12); }
  .ink-layout { gap: var(--sp-8); }

  .ink-footer__inner { flex-direction: column; align-items: flex-start; gap: var(--sp-4); }
}

@media (max-width: 480px) {
  .ink-hero__cta { flex-direction: column; align-items: flex-start; }
  .ink-hero__cta .ink-btn { width: 100%; justify-content: center; }
}

/* ══════════════════════════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════════════════════════ */
@media print {
  .ink-header, .ink-topbar, .ink-hero, .ink-sidebar,
  .ink-prefooter, .ink-footer, .ink-hamburger,
  .ink-hero__scroll-nudge, .pagination { display: none !important; }
  .ink-layout { grid-template-columns: 1fr !important; }
  body { background: white; color: black; }
}

/* ── Header flex — Joomla module wrapper fix ──────────────────────
   Joomla wraps every module in a block-level div when frontend
   editing is on. display:contents collapses those wrappers so
   the logo, nav and search remain direct flex children.           */
.ink-header__inner > div:not(.ink-header__logo):not(.ink-header__actions):not(.ink-header__search) {
  display: contents;
}

/* nav needs explicit flex so it doesn't collapse to a dot */
.ink-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* Logo wrapper always a flex item, never collapses */
.ink-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
}
