/* NordVaekst.net elite visual polish v3 */

/* Global rhythm */
:root {
  --nv-page-max: 1120px;
  --nv-bg: #07111f;
  --nv-card: #101d36;
  --nv-border: rgba(120, 160, 220, 0.18);
  --nv-text: #f4f7fb;
  --nv-muted: #c6d2e6;
}

/* Prevent the site from feeling stretched */
main section {
  padding-top: 38px !important;
  padding-bottom: 38px !important;
}

@media (max-width: 899px) {
  main section {
    padding-top: 28px !important;
    padding-bottom: 28px !important;
  }
}

/* Header: smaller, cleaner, more premium */
.header,
.nv-header,
.site-header,
header {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.brand-wrap {
  max-width: 245px !important;
}

.brand-wrap img,
.brand-logo,
.nv-header-brand-logo {
  max-height: 62px !important;
  width: auto !important;
}

/* Reduce oversized hero/intro gaps */
.hero,
.hero-section,
.page-hero,
.intro,
.guides-hero {
  padding-top: 34px !important;
  padding-bottom: 28px !important;
  margin-bottom: 24px !important;
}

.hero:empty,
.hero-section:empty,
.page-hero:empty,
.intro:empty {
  display: none !important;
}

/* If a top panel is visually empty, don't let it create a huge blank band */
.hero .card:empty,
.page-hero .card:empty,
.intro .card:empty,
.panel:empty,
.card:empty {
  display: none !important;
}

/* Better containers */
.container,
.section-inner,
.wrap,
main > section > div {
  max-width: var(--nv-page-max) !important;
}

/* Guide grid: tighter and more premium */
.guides-grid,
.grid,
.cards {
  gap: 18px !important;
}

/* Cards: less tall, better density */
.guide-card,
.card,
.panel,
.service-card,
.price-card {
  padding: 22px !important;
  min-height: auto !important;
  border-radius: 22px !important;
  border: 1px solid var(--nv-border) !important;
}

/* Only guide cards should keep a clean internal layout */
.guide-card {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  gap: 14px !important;
}

/* Icons should not create big empty vertical space */
.guide-card img,
.guide-card svg,
.card img,
.card svg {
  margin-bottom: 8px !important;
}

/* Typography */
h1, h2, h3 {
  letter-spacing: -0.03em;
}

h1 {
  margin-bottom: 14px !important;
}

h2 {
  margin-bottom: 12px !important;
}

h3 {
  margin-bottom: 10px !important;
  line-height: 1.16 !important;
  text-wrap: balance;
}

p {
  line-height: 1.5 !important;
}

.guide-card p,
.card p,
.panel p {
  margin-bottom: 12px !important;
}

/* Buttons: don't force huge empty card space */
.guide-card a,
.card a,
.page-link,
.btn,
.button {
  margin-top: 8px !important;
}

/* Guide page button polish */
.guide-card a,
.page-link {
  padding: 12px 14px !important;
  border-radius: 12px !important;
  line-height: 1.2 !important;
}

/* Mobile */
@media (max-width: 899px) {
  .brand-wrap {
    max-width: 205px !important;
  }

  .brand-wrap img,
  .brand-logo,
  .nv-header-brand-logo {
    max-height: 54px !important;
  }

  .guides-grid,
  .grid,
  .cards {
    gap: 14px !important;
  }

  .guide-card,
  .card,
  .panel,
  .service-card,
  .price-card {
    padding: 18px !important;
    border-radius: 18px !important;
  }

  .hero,
  .hero-section,
  .page-hero,
  .intro,
  .guides-hero {
    padding-top: 24px !important;
    padding-bottom: 20px !important;
    margin-bottom: 18px !important;
  }
}

/* Guides page specific cleanup */
body:has([href="/guides.html"]),
body:has(a[href="/guides.html"]) {
  --nv-guides-tight: 1;
}

/* Target common guides page wrappers */
.guides-page .hero,
.guides-page .page-hero,
.guides-page .intro,
.guides-page section:first-of-type,
body.guides .hero,
body.guides .page-hero,
body.guides .intro {
  padding-top: 22px !important;
  padding-bottom: 18px !important;
  margin-bottom: 18px !important;
}

/* If guides page has an oversized empty banner/card */
.guides-page .hero-card,
.guides-page .intro-card,
.guides-page .panel:first-child,
body.guides .hero-card,
body.guides .intro-card,
body.guides .panel:first-child {
  min-height: auto !important;
  padding: 22px !important;
}

/* Make guide cards more compact and equal-looking */
.guides-grid .card,
.guides-grid .guide-card,
.card-grid .card {
  min-height: 300px !important;
  padding: 22px !important;
}

.guides-grid .card h3,
.guides-grid .guide-card h3,
.card-grid .card h3 {
  min-height: auto !important;
  margin-bottom: 12px !important;
}

.guides-grid .card p,
.guides-grid .guide-card p,
.card-grid .card p {
  margin-bottom: 16px !important;
}

.guides-grid .card a,
.guides-grid .guide-card a,
.card-grid .card a {
  margin-top: auto !important;
}

/* Guide card readability fix */
.guides-grid,
.card-grid,
.cards {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)) !important;
  align-items: stretch !important;
}

.guides-grid .card,
.guides-grid .guide-card,
.card-grid .card {
  min-width: 0 !important;
  min-height: 270px !important;
  padding: 24px !important;
}

.guides-grid .card h3,
.guides-grid .guide-card h3,
.card-grid .card h3 {
  font-size: clamp(1.18rem, 1.3vw, 1.45rem) !important;
  line-height: 1.18 !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  max-width: 100% !important;
}

.guides-grid .card p,
.guides-grid .guide-card p,
.card-grid .card p {
  font-size: 1rem !important;
  line-height: 1.55 !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
}

.guides-grid .card a,
.guides-grid .guide-card a,
.card-grid .card a {
  font-size: 0.98rem !important;
  line-height: 1.22 !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
}

/* Keep mobile readable without creating broken words */
@media (max-width: 720px) {
  .guides-grid,
  .card-grid,
  .cards {
    grid-template-columns: 1fr !important;
  }

  .guides-grid .card,
  .guides-grid .guide-card,
  .card-grid .card {
    min-height: auto !important;
  }
}

/* HARD FIX: guides.html layout */
body.guides-page {
  overflow-x: hidden;
}

body.guides-page header,
body.guides-page .header,
body.guides-page .site-header,
body.guides-page .nv-header {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  margin-bottom: 0 !important;
}

body.guides-page .brand-wrap {
  max-width: 220px !important;
}

body.guides-page .brand-wrap img,
body.guides-page .brand-logo,
body.guides-page .nv-header-brand-logo {
  max-height: 56px !important;
  width: auto !important;
}

/* Remove the huge empty top band */
body.guides-page main,
body.guides-page main section:first-of-type {
  padding-top: 24px !important;
  margin-top: 0 !important;
}

body.guides-page .hero,
body.guides-page .page-hero,
body.guides-page .intro,
body.guides-page .guides-hero {
  padding-top: 20px !important;
  padding-bottom: 18px !important;
  margin-bottom: 22px !important;
  min-height: 0 !important;
}

/* Actual guide card grid */
body.guides-page .guides-grid,
body.guides-page .card-grid,
body.guides-page .grid,
body.guides-page .cards {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 18px !important;
  align-items: stretch !important;
}

/* Cards: shorter, cleaner, no forced empty space */
body.guides-page article,
body.guides-page .card,
body.guides-page .guide-card,
body.guides-page .panel {
  min-height: 260px !important;
  height: auto !important;
  padding: 22px !important;
  border-radius: 22px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

/* Stop ugly mid-word breaks */
body.guides-page article *,
body.guides-page .card *,
body.guides-page .guide-card *,
body.guides-page .panel * {
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
}

/* Titles */
body.guides-page h1,
body.guides-page h2,
body.guides-page h3 {
  letter-spacing: -0.03em !important;
}

body.guides-page .card h3,
body.guides-page .guide-card h3,
body.guides-page article h3 {
  font-size: 1.22rem !important;
  line-height: 1.15 !important;
  margin: 8px 0 6px 0 !important;
  max-width: 100% !important;
}

/* Body text */
body.guides-page .card p,
body.guides-page .guide-card p,
body.guides-page article p {
  font-size: 0.96rem !important;
  line-height: 1.48 !important;
  margin: 0 0 10px 0 !important;
}

/* Buttons should sit naturally, not create huge blank areas */
body.guides-page .card a,
body.guides-page .guide-card a,
body.guides-page article a,
body.guides-page .page-link {
  margin-top: auto !important;
  padding: 11px 13px !important;
  border-radius: 12px !important;
  font-size: 0.94rem !important;
  line-height: 1.18 !important;
}

/* Tablet */
@media (max-width: 1100px) {
  body.guides-page .guides-grid,
  body.guides-page .card-grid,
  body.guides-page .grid,
  body.guides-page .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Mobile */
@media (max-width: 760px) {
  body.guides-page .guides-grid,
  body.guides-page .card-grid,
  body.guides-page .grid,
  body.guides-page .cards {
    grid-template-columns: 1fr !important;
  }

  body.guides-page article,
  body.guides-page .card,
  body.guides-page .guide-card,
  body.guides-page .panel {
    min-height: auto !important;
    padding: 18px !important;
  }
}

/* HARD FIX: guides.html bottom FAQ boxes */
body.guides-page section:has(h2) {
  max-width: 1120px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Target the FAQ area near bottom */
body.guides-page h2 {
  margin-bottom: 14px !important;
}

body.guides-page h2 + p {
  margin-bottom: 22px !important;
  max-width: 880px !important;
}

/* FAQ cards should be compact, not huge empty blocks */
body.guides-page section article,
body.guides-page section .card,
body.guides-page section .panel {
  min-height: auto !important;
  height: auto !important;
}

/* Specific bottom question boxes */
body.guides-page section h3 {
  margin-bottom: 12px !important;
}

body.guides-page section h3 + p {
  margin-bottom: 0 !important;
}

/* Make wide FAQ cards feel premium and compact */
body.guides-page main section:last-of-type .card,
body.guides-page main section:last-of-type .panel,
body.guides-page main section:last-of-type article {
  padding: 24px 28px !important;
  min-height: 0 !important;
  height: auto !important;
  border-radius: 22px !important;
}

/* Remove forced empty vertical space from FAQ/question cards */
body.guides-page main section:last-of-type .card *,
body.guides-page main section:last-of-type .panel *,
body.guides-page main section:last-of-type article * {
  margin-top: 0;
}

/* If FAQ cards are using flex from earlier guide-card rules, reset them */
body.guides-page main section:last-of-type .card,
body.guides-page main section:last-of-type .panel,
body.guides-page main section:last-of-type article {
  display: block !important;
}

/* Desktop: two-column FAQ grid if possible */
@media (min-width: 900px) {
  body.guides-page main section:last-of-type .grid,
  body.guides-page main section:last-of-type .cards,
  body.guides-page main section:last-of-type .faq-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
  }
}

/* Mobile: compact single column */
@media (max-width: 899px) {
  body.guides-page main section:last-of-type .card,
  body.guides-page main section:last-of-type .panel,
  body.guides-page main section:last-of-type article {
    padding: 18px !important;
    border-radius: 18px !important;
  }
}

/* =========================================================
   NordVaekst.net native modern platform layer
   View transitions + container queries + scroll animations
   ========================================================= */

/* Design tokens */
:root {
  --nv-color-bg: #07111f;
  --nv-color-surface: #101d36;
  --nv-color-surface-2: #132442;
  --nv-color-border: rgba(148, 163, 184, 0.18);
  --nv-color-text: #f8fafc;
  --nv-color-muted: #c6d2e6;
  --nv-color-accent: #33e6a0;
  --nv-color-accent-2: #38bdf8;
  --nv-color-warm: #f7c948;

  --nv-radius-sm: 12px;
  --nv-radius-md: 18px;
  --nv-radius-lg: 24px;
  --nv-radius-xl: 32px;

  --nv-shadow-card: 0 18px 55px rgba(0, 0, 0, 0.24);
  --nv-shadow-soft: 0 10px 35px rgba(0, 0, 0, 0.18);

  --nv-space-1: 0.5rem;
  --nv-space-2: 0.75rem;
  --nv-space-3: 1rem;
  --nv-space-4: 1.5rem;
  --nv-space-5: 2rem;
  --nv-space-6: 3rem;

  --nv-font-h1: clamp(2.3rem, 5vw, 5.2rem);
  --nv-font-h2: clamp(1.9rem, 3.5vw, 3.6rem);
  --nv-font-h3: clamp(1.2rem, 1.6vw, 1.6rem);
  --nv-font-body: clamp(1rem, 1vw, 1.08rem);
}

/* Component-like base classes */
.nv-shell {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.nv-stack {
  display: grid;
  gap: var(--nv-space-4);
}

.nv-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-2);
  align-items: center;
}

.nv-glass {
  background: linear-gradient(180deg, rgba(17, 31, 58, 0.9), rgba(14, 27, 52, 0.86));
  border: 1px solid var(--nv-color-border);
  border-radius: var(--nv-radius-lg);
  box-shadow: var(--nv-shadow-soft);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}

/* Container queries: cards adapt to their own width */
.card,
.panel,
.guide-card,
.price-card,
.service-card,
article {
  container-type: inline-size;
  container-name: nv-card;
}

@container nv-card (max-width: 260px) {
  h3 {
    font-size: 1.05rem !important;
    line-height: 1.16 !important;
  }

  p {
    font-size: 0.94rem !important;
    line-height: 1.45 !important;
  }

  a,
  .btn,
  .button,
  .page-link {
    font-size: 0.9rem !important;
  }
}

@container nv-card (min-width: 360px) {
  h3 {
    font-size: 1.32rem !important;
  }

  p {
    font-size: 1.02rem !important;
  }
}

/* View Transitions API */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(.2, .8, .2, 1);
}

::view-transition-old(root) {
  opacity: 1;
}

::view-transition-new(root) {
  opacity: 0;
  animation-name: nvPageIn;
}

@keyframes nvPageIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Native scroll-driven animation where supported */
@supports (animation-timeline: view()) {
  .card,
  .panel,
  .guide-card,
  .price-card,
  .service-card,
  article {
    animation: nvNativeReveal both ease-out;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }

  @keyframes nvNativeReveal {
    from {
      opacity: 0.72;
      transform: translateY(16px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}

/* Scroll progress native fallback enhancement */
@supports (animation-timeline: scroll()) {
  .nv-progress {
    animation: nvProgressGrow linear both;
    animation-timeline: scroll(root);
    width: 100% !important;
    transform-origin: left center;
  }

  @keyframes nvProgressGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
}

/* Component-grade CTA polish */
.btn,
.button,
.page-link,
.card a,
.guide-card a,
.price-card a,
.service-card a {
  isolation: isolate;
}

.btn::before,
.button::before,
.page-link::before,
.card a::before,
.guide-card a::before,
.price-card a::before,
.service-card a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
  transform: translateX(-120%);
  transition: transform 520ms ease;
  pointer-events: none;
}

.btn:hover::before,
.button:hover::before,
.page-link:hover::before,
.card a:hover::before,
.guide-card a:hover::before,
.price-card a:hover::before,
.service-card a:hover::before {
  transform: translateX(120%);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .card,
  .panel,
  .guide-card,
  .price-card,
  .service-card,
  article {
    animation: none !important;
  }
}
