/* ============================================================
   Tiernan & Co. Solicitors — Design Tokens
   Single source of truth for all colors, typography,
   spacing, radius, shadow, and transition values.
   ============================================================ */

:root {

  /* ─── COLORS ─── */
  --midnight:      #0A1628;
  --navy:          #132840;
  --navy-light:    #1B3354;
  --brass:         #B8924A;
  --brass-light:   #D4A853;
  --brass-muted:   #8B7340;
  --parchment:     #F5F1E8;
  --limestone:     #E4DDD0;
  --brick:         #7A3B2E;
  --irish-green:   #1B6B4A;
  --ink:           #0F1419;
  --slate:         #4A5568;
  --fog:           #9CA3AF;
  --white-warm:    #FDFAF4;

  /* ─── TYPOGRAPHY ─── */
  --font-display:  'Instrument Serif', Georgia, serif;
  --font-heading:  'Source Serif 4', 'Palatino Linotype', Georgia, serif;
  --font-body:     'Satoshi', 'Helvetica Neue', Helvetica, sans-serif;
  --font-accent:   'Instrument Sans', 'Helvetica Neue', sans-serif;

  /* ─── SPACING ─── */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-2xl:  48px;
  --space-3xl:  64px;
  --space-4xl:  96px;
  --space-5xl:  128px;
  --space-6xl:  192px;

  /* ─── LAYOUT ─── */
  --container-max:  1280px;
  --container-pad:  24px;

  /* ─── RADIUS ─── */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 999px;

  /* ─── SHADOWS ─── */
  --shadow-sm:   0 1px 2px rgba(10, 22, 40, 0.05);
  --shadow-md:   0 4px 12px rgba(10, 22, 40, 0.08);
  --shadow-lg:   0 12px 32px rgba(10, 22, 40, 0.12);
  --shadow-glow: 0 0 24px rgba(184, 146, 74, 0.15);

  /* ─── TRANSITIONS ─── */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:  0.2s;
  --duration-base:  0.3s;
  --duration-slow:  0.5s;
}

/* ─── RESPONSIVE CONTAINER PADDING ─── */
@media (min-width: 768px) {
  :root { --container-pad: 48px; }
}
@media (min-width: 1024px) {
  :root { --container-pad: 64px; }
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--midnight);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  display: block;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

ul, ol {
  list-style: none;
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.section {
  padding: var(--space-5xl) 0;
}

.section-dark {
  background: var(--midnight);
}

.section-light {
  background: var(--parchment);
}

@media (max-width: 767px) {
  .section { padding: var(--space-4xl) 0; }
}

/* ============================================================
   TYPOGRAPHY UTILITIES
   ============================================================ */

.font-display  { font-family: var(--font-display); }
.font-heading  { font-family: var(--font-heading); }
.font-body     { font-family: var(--font-body); }
.font-accent   { font-family: var(--font-accent); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--brass-light);
  color: var(--midnight);
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default),
    transform var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--brass);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px) scale(1.02);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: transparent;
  color: var(--brass-light);
  border: 1px solid var(--brass);
  padding: 14px 30px;
  border-radius: var(--radius-pill);
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default),
    transform var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(184, 146, 74, 0.1);
  border-color: var(--brass-light);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

/* ============================================================
   PHONE LINK UTILITY
   ============================================================ */

.phone-link {
  font-family: var(--font-display);
  color: var(--brass-light);
  text-decoration: none;
  font-size: inherit;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.phone-link:hover {
  opacity: 0.8;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ============================================================
   CARDS
   ============================================================ */

.card-dark {
  background: var(--navy);
  border: 1px solid rgba(184, 146, 74, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: border-color var(--duration-base) var(--ease-default);
}

.card-dark:hover {
  border-color: rgba(184, 146, 74, 0.3);
}

.card-light {
  background: var(--white-warm);
  border: 1px solid var(--limestone);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition:
    box-shadow var(--duration-base) var(--ease-default),
    border-color var(--duration-base) var(--ease-default);
}

.card-light:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brass);
}

/* ============================================================
   LINK HOVER (underline slide-in)
   ============================================================ */

.link-hover {
  position: relative;
  text-decoration: none;
}

.link-hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--brass-light);
  transition: width var(--duration-base) var(--ease-default);
}

.link-hover:hover::after {
  width: 100%;
}

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */

.animate-in {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s var(--ease-default),
    transform 0.6s var(--ease-default);
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-in-left {
  opacity: 0;
  transform: translateX(-24px);
  transition:
    opacity 0.6s var(--ease-default),
    transform 0.6s var(--ease-default);
}

.animate-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-in-right {
  opacity: 0;
  transform: translateX(24px);
  transition:
    opacity 0.6s var(--ease-default),
    transform 0.6s var(--ease-default);
}

.animate-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Stagger delays — applied to .animate-in children inside .stagger-children.
   These override the implicit 0s delay from the transition shorthand because
   .stagger-children > *:nth-child() has higher specificity than .animate-in alone. */
.stagger-children > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children > *:nth-child(2) { transition-delay: 100ms; }
.stagger-children > *:nth-child(3) { transition-delay: 200ms; }
.stagger-children > *:nth-child(4) { transition-delay: 300ms; }
.stagger-children > *:nth-child(5) { transition-delay: 400ms; }
.stagger-children > *:nth-child(6) { transition-delay: 500ms; }

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 72px;
  display: flex;
  align-items: center;
  transition:
    background var(--duration-base) var(--ease-default),
    backdrop-filter var(--duration-base) var(--ease-default),
    box-shadow var(--duration-base) var(--ease-default);
}

.site-header.scrolled {
  background: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(184, 146, 74, 0.1);
}

.site-header .container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
}

.header-logo {
  flex-shrink: 0;
  height: 44px;
  width: auto;
  padding-left: 8px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.header-nav a {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: rgba(245, 241, 232, 0.8);
  position: relative;
  transition: color var(--duration-fast) var(--ease-default);
}

/* Brass left-border slide-in on hover / active */
.header-nav a::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  width: 2px;
  height: 14px;
  background: var(--brass-light);
  border-radius: 1px;
  transform: translateY(-50%) scaleY(0);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--parchment);
}

.header-nav a:hover::before,
.header-nav a.active::before {
  transform: translateY(-50%) scaleY(1);
}

.header-cta {
  flex-shrink: 0;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 8px 0;
  cursor: pointer;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--parchment);
  border-radius: 2px;
  transition:
    transform var(--duration-base) var(--ease-default),
    opacity var(--duration-fast) var(--ease-default);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile overlay */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--midnight);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-default);
}

.mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}

.mobile-menu a {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--parchment);
  transition: color var(--duration-fast) var(--ease-default);
}

.mobile-menu a:hover {
  color: var(--brass-light);
}

.mobile-menu-divider {
  width: 40px;
  height: 1px;
  background: rgba(184, 146, 74, 0.3);
}

.mobile-menu-phone {
  font-family: var(--font-accent);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brass-light);
}

@media (max-width: 1023px) {
  .hamburger { display: flex; }
  .header-nav { display: none; }
  .header-cta { display: none; }
  .mobile-menu { display: flex; }
}

/* ============================================================
   CHATBOT WIDGET
   ============================================================ */

#chatbot-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: var(--brass-light);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  color: var(--midnight);
  box-shadow: 0 4px 20px rgba(184, 146, 74, 0.3);
  animation: chatPulse 3s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#chatbot-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(184, 146, 74, 0.45);
}
#chatbot-trigger.active {
  animation: none;
  background: var(--brass);
}
#chatbot-trigger svg {
  width: 24px;
  height: 24px;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(184, 146, 74, 0.3), 0 0 0 0 rgba(212, 168, 83, 0.3); }
  50%       { box-shadow: 0 4px 20px rgba(184, 146, 74, 0.3), 0 0 0 14px rgba(212, 168, 83, 0); }
}

#chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--midnight);
  border: 1px solid rgba(184, 146, 74, 0.2);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
#chatbot-window.chatbot-closed {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  visibility: hidden;
  pointer-events: none;
}
#chatbot-window.chatbot-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--navy);
  border-bottom: 1px solid rgba(184, 146, 74, 0.15);
  flex-shrink: 0;
}
.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chatbot-avatar {
  width: 36px;
  height: 36px;
  background: rgba(184, 146, 74, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chatbot-header-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  color: var(--parchment);
  margin: 0;
}
.chatbot-header-status {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--fog);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.chatbot-status-dot {
  width: 8px;
  height: 8px;
  background: #34D399;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.chatbot-close {
  background: transparent;
  border: none;
  color: var(--fog);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
}
.chatbot-close:hover {
  color: var(--parchment);
  background: rgba(245, 241, 232, 0.1);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(184,146,74,0.2); border-radius: 2px; }

.chatbot-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
}
.chatbot-msg-bot { align-self: flex-start; }
.chatbot-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chatbot-msg-avatar {
  width: 28px;
  height: 28px;
  background: rgba(184, 146, 74, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chatbot-msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}
.chatbot-msg-bot .chatbot-msg-bubble {
  background: var(--navy);
  color: var(--parchment);
  border-bottom-left-radius: 4px;
}
.chatbot-msg-user .chatbot-msg-bubble {
  background: var(--brass);
  color: var(--midnight);
  border-bottom-right-radius: 4px;
}

.chatbot-typing .chatbot-msg-bubble {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
}
.chatbot-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--fog);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.chatbot-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

.chatbot-input-area,
.chatbot-input-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(184, 146, 74, 0.15);
  background: var(--navy);
  gap: 8px;
  flex-shrink: 0;
}
#chatbot-input {
  flex: 1;
  background: rgba(245, 241, 232, 0.05);
  border: 1px solid rgba(184, 146, 74, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--parchment);
  outline: none;
  transition: border-color 0.2s ease;
}
#chatbot-input:focus { border-color: var(--brass); }
#chatbot-input::placeholder { color: var(--fog); }

#chatbot-send {
  width: 40px;
  height: 40px;
  background: var(--brass-light);
  border: none;
  border-radius: 8px;
  color: var(--midnight);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
#chatbot-send:hover { background: var(--brass); }

@media (max-width: 768px) {
  #chatbot-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}

/* ============================================================
   SKIP LINK (accessibility)
   ============================================================ */

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  background: var(--brass-light);
  color: var(--midnight);
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  transition: top var(--duration-fast) var(--ease-default);
}

.skip-link:focus {
  top: 16px;
}

/* ============================================================
   FOCUS STYLES (accessibility)
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--brass-light);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   FOOTER — Shared across all pages
   ============================================================ */

.site-footer {
  background: var(--midnight);
  border-top: 1px solid rgba(184, 146, 74, 0.14);
  padding-top: var(--space-4xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: var(--space-3xl);
  padding-bottom: var(--space-3xl);
}

.footer-logo {
  height: 36px;
  width: auto;
  display: block;
  margin-bottom: var(--space-lg);
}

.footer-desc {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.72;
  color: rgba(245, 241, 232, 0.45);
  max-width: 260px;
  margin-bottom: var(--space-xl);
}

.footer-sig {
  height: auto;
  width: 200px;
  opacity: 0.85;
  margin-top: 16px;
  filter: brightness(1.3);
}

.footer-col-head {
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass-muted);
  margin-bottom: var(--space-lg);
  display: block;
}

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

.footer-nav a {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(245, 241, 232, 0.5);
  transition: color var(--duration-fast) var(--ease-default);
  padding: 2px 0;
}

.footer-nav a:hover { color: var(--parchment); }

.footer-contact-row {
  margin-bottom: var(--space-md);
}

.footer-contact-label {
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass-muted);
  display: block;
  margin-bottom: 3px;
}

.footer-contact-val {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(245, 241, 232, 0.6);
  display: block;
  transition: color var(--duration-fast) var(--ease-default);
}

a.footer-contact-val:hover { color: var(--parchment); }

.footer-bottom {
  border-top: 1px solid rgba(184, 146, 74, 0.1);
  padding: var(--space-xl) 0;
}

.footer-bottom-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2xl);
  flex-wrap: wrap;
}

.footer-legal {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(245, 241, 232, 0.28);
  line-height: 1.65;
  max-width: 640px;
}

.footer-badges-img {
  height: 48px !important;
  width: auto !important;
  max-height: none !important;
  opacity: 0.9;
  flex-shrink: 0;
  filter: brightness(1.1);
  background: transparent;
  padding: 0;
  border-radius: 0;
}

@media (max-width: 1023px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 599px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-2xl); }
  .footer-bottom-row { flex-direction: column; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

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

  .animate-in,
  .animate-in-left,
  .animate-in-right {
    opacity: 1;
    transform: none;
  }

  .hero-animate {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}
