/* ETW Trades — design refresh.
   Loaded last so it can soften the whole site in one place: warmer
   surfaces, rounder organic shapes, layered shadows, gradient buttons,
   a clear active state in the header, and consistent focus rings.
   Pairs with etw-ux.js (navigation behaviour, reveal-on-scroll, etc.). */

:root {
  --etw-blue: #4a7ae0;
  --etw-violet: #7a5af0;
  --etw-ink: #182033;
  --etw-surface: #fbfcff;
  --etw-grad: linear-gradient(135deg, #4a7ae0 0%, #6366f1 55%, #7a5af0 100%);
  --etw-grad-soft: linear-gradient(135deg, rgba(74,122,224,.12), rgba(122,90,240,.12));
  --etw-shadow-sm: 0 1px 2px rgba(24,32,51,.04), 0 2px 6px rgba(24,32,51,.04);
  --etw-shadow-md: 0 2px 4px rgba(24,32,51,.04), 0 12px 28px -8px rgba(36,52,92,.16);
  --etw-shadow-lg: 0 4px 8px rgba(24,32,51,.05), 0 24px 48px -12px rgba(52,72,140,.25);
  --etw-ring: 0 0 0 3px #fff, 0 0 0 5px rgba(74,122,224,.55);
  --etw-header-h: 76px;
}

html { scroll-padding-top: calc(var(--etw-header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { background: var(--etw-surface); color: var(--etw-ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: rgba(74,122,224,.2); }

/* Consistent, visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--etw-ring);
  border-radius: 12px;
}

/* ---------------- Header ---------------- */
header.sticky {
  background: rgba(255,255,255,.78) !important;
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom-color: rgba(24,32,51,.06) !important;
  transition: box-shadow .25s ease, background-color .25s ease;
}
header.sticky.etw-scrolled {
  background: rgba(255,255,255,.92) !important;
  box-shadow: 0 6px 24px -12px rgba(24,32,51,.18);
}
nav[aria-label="Primary navigation"] { gap: 4px !important; }
nav[aria-label="Primary navigation"] a {
  position: relative;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  color: #4b5568 !important;
  white-space: nowrap;
  transition: color .2s ease, background-color .2s ease;
}
nav[aria-label="Primary navigation"] a:hover { color: var(--etw-ink) !important; background: rgba(24,32,51,.05); }
nav[aria-label="Primary navigation"] a[aria-current="page"] {
  color: var(--etw-blue) !important;
  background: rgba(74,122,224,.1);
  font-weight: 600;
}
@media (min-width: 768px) and (max-width: 1100px) {
  nav[aria-label="Primary navigation"] a { padding: 7px 9px; font-size: .8rem; }
}

/* Mobile menu */
button[data-testid="button-mobile-menu"] {
  border-radius: 12px !important;
  transition: background-color .2s ease;
}
button[data-testid="button-mobile-menu"]:hover { background: rgba(24,32,51,.06); }
nav[aria-label="Mobile navigation"] { gap: 4px !important; }
nav[aria-label="Mobile navigation"] a:not(.etw-btn) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 14px !important;
  padding: 13px 14px !important;
  font-size: .95rem !important;
  font-weight: 600 !important;
  color: var(--etw-ink) !important;
  background: transparent !important;
}
nav[aria-label="Mobile navigation"] a:not(.etw-btn)::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .3;
}
nav[aria-label="Mobile navigation"] a:not(.etw-btn):hover { background: rgba(24,32,51,.05) !important; }
nav[aria-label="Mobile navigation"] a[aria-current="page"] {
  color: var(--etw-blue) !important;
  background: rgba(74,122,224,.1) !important;
}
nav[aria-label="Mobile navigation"] .etw-btn { margin-top: 8px; }
header .etw-shell.md\:hidden { animation: etw-drop .22s ease-out; }
@keyframes etw-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- Buttons ---------------- */
.etw-btn {
  border-radius: 999px;
  padding: .8rem 1.4rem;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: transform .2s ease, box-shadow .25s ease, background-color .2s ease, color .2s ease, border-color .2s ease, filter .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.etw-btn:hover { transform: translateY(-2px); }
.etw-btn:active { transform: translateY(0) scale(.98); }
.etw-btn:disabled, .etw-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.etw-btn-primary {
  background: var(--etw-grad);
  background-size: 140% 140%;
  background-position: 0% 50%;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 22px -10px rgba(74,104,230,.75);
}
.etw-btn-primary:hover {
  background: var(--etw-grad);
  background-size: 140% 140%;
  background-position: 100% 50%;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 16px 30px -12px rgba(74,104,230,.85);
}
/* Ghost buttons keep their inherited colours so they still work on the dark
   admin and journal surfaces; only the homepage hero gets the white pill. */
.etw-btn-ghost:hover {
  background: rgba(74,122,224,.08);
  color: inherit;
  border-color: rgba(74,122,224,.5);
}
.etw-home-hero .etw-btn-ghost {
  background: #fff;
  border-color: rgba(24,32,51,.12);
  color: var(--etw-ink);
  box-shadow: var(--etw-shadow-sm);
}
.etw-home-hero .etw-btn-ghost:hover {
  color: var(--etw-blue);
  border-color: rgba(74,122,224,.45);
  box-shadow: var(--etw-shadow-md);
}
.etw-btn svg { transition: transform .2s ease; }
.etw-btn:hover svg:last-child { transform: translateX(2px); }

/* ---------------- Cards ---------------- */
.etw-card {
  border-radius: 1.5rem;
  border-color: rgba(24,32,51,.07);
  background: #fff;
  box-shadow: var(--etw-shadow-sm);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .3s ease;
}
.etw-card:hover {
  transform: translateY(-4px);
  border-color: rgba(74,122,224,.28);
  box-shadow: var(--etw-shadow-lg);
}
.etw-input { border-radius: 14px; transition: border-color .2s ease, box-shadow .2s ease; }
.etw-input:focus { border-color: rgba(74,122,224,.6); box-shadow: 0 0 0 4px rgba(74,122,224,.14); }

/* Section eyebrow pill (shared by new headings) */
.etw-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--etw-grad-soft);
  color: var(--etw-blue);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ---------------- Homepage hero ---------------- */
.etw-home-hero {
  background: linear-gradient(180deg, #f3f6fd 0%, var(--etw-surface) 70%) !important;
  isolation: isolate;
}
.etw-home-hero::before,
.etw-home-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.etw-home-hero::before {
  width: 520px; height: 420px;
  top: -140px; left: -120px;
  background: radial-gradient(circle at 40% 40%, rgba(74,122,224,.32), transparent 65%);
  animation: etw-float 18s ease-in-out infinite alternate;
}
.etw-home-hero::after {
  width: 560px; height: 460px;
  top: 40px; right: -160px;
  background: radial-gradient(circle at 50% 50%, rgba(122,90,240,.24), transparent 65%);
  animation: etw-float 22s ease-in-out infinite alternate-reverse;
}
@keyframes etw-float {
  from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(40px,30px,0) scale(1.08); }
}
.etw-home-hero > .etw-shell { padding-top: 104px !important; padding-bottom: 104px !important; }
@media (min-width: 768px) {
  .etw-home-hero > .etw-shell { padding-top: 136px !important; padding-bottom: 128px !important; }
}
.etw-home-hero h1 {
  letter-spacing: -.035em;
  color: var(--etw-ink);
}
.etw-home-hero h1 + p { color: #5b6477; }

/* Hero tiles (now real links) */
.etw-hero-tile { text-decoration: none; border-radius: 1.25rem; }
.etw-hero-tile > p { color: #6b7488 !important; transition: color .2s ease; }
.etw-hero-tile:hover > p { color: var(--etw-blue) !important; }
.etw-hero-tile-card {
  position: relative;
  border-radius: 1.25rem !important;
  background: #fff !important;
  border: 1px solid rgba(24,32,51,.07);
  box-shadow: var(--etw-shadow-md);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .3s ease;
  overflow: hidden;
}
.etw-hero-tile-card::after {
  content: "";
  position: absolute;
  top: 14px; right: 14px;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: rgba(74,122,224,.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a7ae0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center/12px no-repeat;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity .25s ease, transform .25s ease;
}
.etw-hero-tile:hover .etw-hero-tile-card,
.etw-hero-tile:focus-visible .etw-hero-tile-card {
  transform: translateY(-5px);
  border-color: rgba(74,122,224,.35);
  box-shadow: var(--etw-shadow-lg);
}
.etw-hero-tile:hover .etw-hero-tile-card::after,
.etw-hero-tile:focus-visible .etw-hero-tile-card::after { opacity: 1; transform: none; }
.etw-hero-tile-card.is-dark {
  background: radial-gradient(120% 90% at 0% 0%, #2c3a63 0%, #182033 60%, #121829 100%) !important;
  border-color: rgba(255,255,255,.06);
  box-shadow: 0 18px 40px -16px rgba(24,32,51,.55);
}
.etw-hero-tile-card.is-dark::after {
  background-color: rgba(255,255,255,.14);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
}
@media (max-width: 639px) {
  .etw-hero-tile-card { height: 104px !important; padding: 12px !important; border-radius: 1rem !important; }
  .etw-hero-tile-card p { font-size: 10px !important; }
  .etw-hero-tile-card::after { display: none; }
  .etw-home-hero > .etw-shell { padding-top: 56px !important; padding-bottom: 72px !important; }
}

/* ---------------- Homepage features ---------------- */
.etw-home-features { background: #fff !important; border-top-color: rgba(24,32,51,.05) !important; }
.etw-feature-card { text-decoration: none; padding-top: 2.5rem !important; padding-bottom: 2.25rem !important; }
.etw-feature-icon {
  background: var(--etw-grad-soft);
  color: var(--etw-blue);
  box-shadow: inset 0 0 0 1px rgba(74,122,224,.12);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), background .3s ease, color .3s ease;
}
.etw-feature-card:hover .etw-feature-icon { transform: translateY(-2px) rotate(-6deg); background: var(--etw-grad); color: #fff; }
.etw-feature-cta svg { transition: transform .2s ease; }
.etw-feature-card:hover .etw-feature-cta svg { transform: translateX(3px); }

/* ---------------- Loading skeleton ---------------- */
.etw-skeleton-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 8px; }
.etw-skeleton {
  height: 220px;
  border-radius: 1.5rem;
  background: linear-gradient(100deg, #eef1f8 20%, #f7f9fd 40%, #eef1f8 60%) 0 0 / 220% 100%;
  animation: etw-shimmer 1.3s linear infinite;
}
@keyframes etw-shimmer { to { background-position: -220% 0; } }

/* ---------------- Section polish for patch-injected blocks ---------------- */
.etwtg-card, .etwbk-card, .etwm-card, .etwa-isnot-card { border-radius: 1.5rem !important; }
.etwbk-card, .etwm-card { transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease !important; }
.etwbk-card:hover, .etwm-card:hover { transform: translateY(-4px); box-shadow: var(--etw-shadow-lg) !important; }

/* Footer social icons get a comfortable touch target */
.etw-footer-bar a[data-testid^="link-social-"] {
  width: 38px; height: 38px;
  justify-content: center;
  border-radius: 999px;
}
.etw-footer-bar a[data-testid^="link-social-"]:hover { background: rgba(74,122,224,.1); }

/* ---------------- Back to top ---------------- */
.etw-to-top {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 40;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--etw-grad);
  box-shadow: 0 12px 26px -10px rgba(74,104,230,.8);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.etw-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.etw-to-top:hover { transform: translateY(-2px); }

/* ---------------- Reveal on scroll (only for elements etw-ux.js marks) ---------------- */
.etw-reveal-pending { opacity: 0; transform: translateY(18px); }
.etw-reveal-in { animation: etw-reveal .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes etw-reveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .etw-reveal-pending { opacity: 1; transform: none; }
}
