@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/*
 * Korthubben — Nordic design system v2
 *
 * Pure presentation layer. This file is loaded last and intentionally leaves
 * routing, CardSight, marketplace queries and data contracts untouched.
 * Dark mode is the primary identity; light mode uses the warm cream companion
 * palette from the approved Nordic concept.
 */

:root {
  --cream: #fbf3ea;
  --ink: #1a1712;
  --ink-soft: #5c564a;
  --white: #ffffff;
  --accent: #c2410c;
  --accent-soft: #fbdcc7;
  --line: #eadfd2;
  --up: #5c564a;
  --down: #5c564a;
  --kh-cream: #fbf3ea;
  --kh-ink: #1a1712;
  --kh-ink-soft: #5c564a;
  --kh-orange: #c2410c;
  --kh-orange-soft: #fbdcc7;
  --kh-line: #eadfd2;
  --kh-radius-sm: 8px;
  --kh-radius-md: 12px;
  --kh-radius-lg: 18px;
  --kh-radius-xl: 24px;
  --kh-radius-hero: 28px;
  --kh-shadow: 0 18px 55px -34px rgb(52 38 26 / 0.28);
  --kh-shadow-strong: 0 28px 80px -46px rgb(28 18 10 / 0.45);
  --kh-hover-shadow: 0 10px 24px rgb(52 38 26 / 0.16);
  --kh-focus: rgb(232 99 43 / 0.2);

  --background: #fbf3ea;
  --foreground: #1a1712;
  --surface: #f7ede3;
  --surface-elevated: #ffffff;
  --card: #ffffff;
  --card-foreground: #1a1712;
  --popover: #ffffff;
  --popover-foreground: #1a1712;
  --primary: #c2410c;
  --primary-foreground: #ffffff;
  --secondary: #f4e8db;
  --secondary-foreground: #1a1712;
  --muted: #f1e6da;
  --muted-foreground: #6c6255;
  --accent: #c2410c;
  --accent-foreground: #ffffff;
  --gold: #c2410c;
  --gold-foreground: #ffffff;
  --border: #eadfd2;
  --input: #ded0c1;
  --ring: #e8632b;
}

html.dark {
  --cream: #1c1712;
  --ink: #f5ece1;
  --ink-soft: #b4a990;
  --white: #26201a;
  --accent: #f2793b;
  --accent-soft: #3c2416;
  --line: #382f24;
  --up: #6fcb9a;
  --down: #e28b7a;
  --background: #1c1712;
  --foreground: #f5ece1;
  --surface: #211b16;
  --surface-elevated: #2b241d;
  --card: #26201a;
  --card-foreground: #f5ece1;
  --popover: #2b241d;
  --popover-foreground: #f5ece1;
  --primary: #f2793b;
  --primary-foreground: #1c1712;
  --secondary: #2b241d;
  --secondary-foreground: #f5ece1;
  --muted: #2b241d;
  --muted-foreground: #b4a990;
  --accent: #f2793b;
  --accent-foreground: #1c1712;
  --gold: #f2793b;
  --gold-foreground: #1c1712;
  --border: #382f24;
  --input: #382f24;
  --ring: #f2793b;
  --kh-line: #382f24;
  --kh-shadow: 0 20px 65px -38px rgb(0 0 0 / 0.72);
  --kh-shadow-strong: 0 34px 90px -48px rgb(0 0 0 / 0.88);
  --kh-hover-shadow: 0 10px 24px rgb(0 0 0 / 0.3);
}

*,
*::before,
*::after {
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
}

html,
body {
  background: var(--background) !important;
  color: var(--foreground);
  font-family:
    "Inter",
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif !important;
}

body {
  position: relative;
  background-image: radial-gradient(
    circle at 78% -10%,
    color-mix(in srgb, var(--accent) 7%, transparent),
    transparent 36%
  ) !important;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  content: "";
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.kh-site-header-layer {
  z-index: 40 !important;
  overflow: visible;
}

.kh-nav-dropdown {
  z-index: 60 !important;
}

html body h1,
html body h2,
html body h3,
html body h4,
html body h5,
html body h6,
html body .font-display {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif !important;
  text-wrap: balance;
}

html body .font-mono,
html body [class*="font-mono"] {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace !important;
}

html body .font-semibold {
  font-weight: 600;
}

html body .font-bold {
  font-weight: 700;
}

/* Soft Nordic geometry. Pills and avatars are allowed to stay fully round. */
html body .rounded-sm {
  border-radius: var(--kh-radius-sm) !important;
}

html body .rounded-md {
  border-radius: var(--kh-radius-md) !important;
}

html body .rounded-lg {
  border-radius: 14px !important;
}

html body .rounded-xl {
  border-radius: var(--kh-radius-lg) !important;
}

html body .rounded-2xl {
  border-radius: var(--kh-radius-xl) !important;
}

html body .rounded-3xl {
  border-radius: var(--kh-radius-hero) !important;
}

html body .rounded-full {
  border-radius: 9999px !important;
}

html body .kh-card,
html body .kh-card-interactive {
  border-radius: var(--kh-radius-lg) !important;
}

html body .kh-card-interactive:hover {
  transform: translateY(-4px);
  border-color: var(--border) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32) !important;
}

html body .kh-icon-btn:hover {
  background: var(--accent) !important;
  color: var(--white) !important;
}

html body .kh-collection-card > a {
  flex-direction: column;
}

html body .kh-collection-card-image img {
  object-fit: contain;
}

html body .kh-icon-badge {
  border-radius: var(--kh-radius-md) !important;
}

/* Cards should feel tactile without turning the product into a dashboard. */
html body :is(.bg-card, .bg-popover)[class*="border"] {
  box-shadow: var(--kh-shadow);
}

html body :is(button, a, [role="button"])[class~="bg-primary"] {
  color: var(--primary-foreground) !important;
  -webkit-text-fill-color: var(--primary-foreground) !important;
}

html body :is(button, a, [role="button"])[class~="bg-primary"] :where(span, strong, small, p),
html body :is(button, a, [role="button"])[class~="bg-primary"] svg {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  stroke: currentColor !important;
}

html body :is(input, select, textarea):focus,
html body :is(input, select, textarea):focus-visible {
  border-color: color-mix(in srgb, var(--primary) 55%, transparent) !important;
  box-shadow: 0 0 0 3px var(--kh-focus) !important;
  outline: none !important;
}

html body :is(input, select, textarea).border-none:focus,
html body :is(input, select, textarea).border-none:focus-visible {
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Search focus stays on the control as a whole, without an orange inner frame. */
html body .kh-search-control {
  transition: box-shadow 180ms ease;
}

html body .kh-search-control:focus-within {
  border-color: var(--border) !important;
  box-shadow: 0 8px 18px -14px rgb(28 18 10 / 0.38) !important;
}

html body .kh-search-control svg {
  color: var(--accent) !important;
  stroke: var(--accent) !important;
  opacity: 1 !important;
}

html body .kh-search-control input:focus,
html body .kh-search-control input:focus-visible {
  border-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

html body :is(button, a, [role="button"]):focus-visible {
  outline: 2px solid var(--ring) !important;
  outline-offset: 3px;
}

/* Header — pill navigation, warm surfaces and round utility actions. */
html body header {
  border-color: var(--border) !important;
}

html body header > div[class*="max-w-"] {
  min-height: 72px !important;
}

html body header nav[aria-label="Huvudmeny"] {
  gap: 4px !important;
  padding: 5px !important;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--card);
  box-shadow: var(--kh-shadow);
}

html body header nav[aria-label="Huvudmeny"] > a,
html body header nav[aria-label="Huvudmeny"] > div > button {
  border-radius: 9999px !important;
  min-height: 36px;
  padding-inline: 15px !important;
}

html body .kh-header-action-icon :is(button, a),
html body :is(a, button).kh-header-action-icon,
html body .kh-header-action-icon:is(a, button) {
  border-radius: 9999px !important;
}

/* Homepage hero — same composition, new visual language. No data changes. */
html body .min-h-dvh > main > section:first-child:has(h1),
html body .min-h-screen > main > section:first-child:has(h1) {
  background: var(--background) !important;
  border-color: transparent !important;
}

html body .min-h-dvh > main > section:first-child:has(h1) h1,
html body .min-h-screen > main > section:first-child:has(h1) h1 {
  color: var(--foreground) !important;
  -webkit-text-fill-color: var(--foreground) !important;
  font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: -0.055em !important;
}

html body .min-h-dvh > main > section:first-child:has(h1) h1 + p,
html body .min-h-screen > main > section:first-child:has(h1) h1 + p {
  color: var(--muted-foreground) !important;
  -webkit-text-fill-color: var(--muted-foreground) !important;
}

html body .min-h-dvh > main > section:first-child:has(h1) > div[class*="mx-auto"],
html body .min-h-screen > main > section:first-child:has(h1) > div[class*="mx-auto"] {
  padding-top: clamp(2.75rem, 6vw, 5.5rem) !important;
  padding-bottom: clamp(2.75rem, 6vw, 5.5rem) !important;
}

html body .min-h-dvh > main > section:first-child:has(h1) > div[aria-hidden="true"],
html body .min-h-screen > main > section:first-child:has(h1) > div[aria-hidden="true"] {
  opacity: 0.025 !important;
}

html body .min-h-dvh > main > section:first-child:has(h1) div[class*="max-w-3xl"][class*="bg-card"],
html
  body
  .min-h-screen
  > main
  > section:first-child:has(h1)
  div[class*="max-w-3xl"][class*="bg-card"] {
  border-radius: var(--kh-radius-lg) !important;
  border-color: var(--border) !important;
  padding: 8px !important;
  box-shadow: var(--kh-shadow-strong) !important;
}

html.dark
  body
  .min-h-dvh
  > main
  > section:first-child:has(h1)
  div[class*="max-w-3xl"][class*="bg-card"],
html.dark
  body
  .min-h-screen
  > main
  > section:first-child:has(h1)
  div[class*="max-w-3xl"][class*="bg-card"] {
  background: #24201c !important;
}

/* Market pulse becomes a row of soft, independent action cards. */
html body section[aria-label="Marknadspuls"] {
  border: 0 !important;
  background: var(--background) !important;
}

html body section[aria-label="Marknadspuls"] > div {
  padding-top: 18px;
  padding-bottom: 18px;
}

html body section[aria-label="Marknadspuls"] > div > div {
  gap: 12px;
  padding-top: 4px;
  padding-bottom: 12px;
  overflow-y: visible !important;
}

html body section[aria-label="Marknadspuls"] > div > div > :first-child {
  min-width: auto !important;
  border: 0 !important;
  padding: 0 10px 0 0 !important;
  color: var(--muted-foreground) !important;
}

html body section[aria-label="Marknadspuls"] a.group {
  border: 1px solid transparent !important;
  border-radius: var(--kh-radius-lg) !important;
  background: var(--card);
  padding: 18px 20px !important;
  box-shadow: none;
}

html body section[aria-label="Marknadspuls"] a.group:hover {
  transform: translateY(-3px);
  border-color: transparent !important;
  background: var(--card) !important;
  box-shadow: var(--kh-hover-shadow);
}

/* Section rhythm: more editorial space and less hard dashboard framing. */
html body main > section:not(:first-child) {
  scroll-margin-top: 92px;
}

html body section[data-pulse-section]:not(:has(ul)) {
  display: none;
}

html body main section [class*="bg-card"][class*="border"] {
  border-color: var(--border) !important;
}

html body main section :is(a, button)[class*="border-primary"] {
  border-radius: var(--kh-radius-md) !important;
}

html body footer {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

@media (max-width: 767px) {
  html body header > div[class*="max-w-"] {
    min-height: 62px !important;
  }

  html body .min-h-dvh > main > section:first-child:has(h1) > div[class*="mx-auto"],
  html body .min-h-screen > main > section:first-child:has(h1) > div[class*="mx-auto"] {
    padding-top: 1.75rem !important;
    padding-bottom: 1.75rem !important;
  }

  html body .min-h-dvh > main > section:first-child:has(h1) h1,
  html body .min-h-screen > main > section:first-child:has(h1) h1 {
    font-size: clamp(2.25rem, 11vw, 3rem) !important;
    line-height: 1.04 !important;
  }

  html body section[aria-label="Marknadspuls"] > div > div > :first-child {
    display: none !important;
  }

  html body section[aria-label="Marknadspuls"] a.group {
    min-width: 205px !important;
    padding: 15px 16px !important;
  }
}

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