/* Melvion.se — static site */
:root {
  --background: #fafafa;
  --foreground: #0a0a0a;
  --muted: #64748b;
  --border: #e8eef5;
  --primary: #0066ff;
  --primary-foreground: #ffffff;
  --primary-soft: rgba(0, 102, 255, 0.08);
  --grid-line: rgba(0, 102, 255, 0.12);
  --max: 64rem;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Space Grotesk", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--primary-soft);
  color: var(--foreground);
}

a {
  color: inherit;
}

.focus-ring:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.skip-link:focus {
  position: fixed !important;
  left: 1rem !important;
  top: 1rem !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  padding: 0.5rem 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  z-index: 100;
  clip: auto;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .wrap {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(12px);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.5rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .site-header .inner {
    padding: 0 1.5rem;
  }
}

.logo {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--foreground);
  border-radius: 0.125rem;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 640px) {
  .nav-main {
    gap: 1rem;
  }
}

.nav-main a {
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--muted);
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  transition: color 0.2s;
}

@media (min-width: 640px) {
  .nav-main a {
    padding: 0.375rem 0.75rem;
  }
}

.nav-main a:hover {
  color: var(--primary);
}

.nav-cta {
  display: none;
  margin-left: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground) !important;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.2s;
}

.nav-cta:hover {
  transform: scale(1.02);
}

@media (min-width: 640px) {
  .nav-cta {
    display: inline-block;
  }
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: 7rem;
  padding-bottom: 5rem;
}

@media (min-width: 640px) {
  .hero {
    padding-top: 8rem;
    padding-bottom: 7rem;
  }
}

.hero-grid {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 100%);
  animation: grid-pulse 8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero-grid {
    animation: none;
  }
}

@keyframes grid-pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.7;
  }
}

.hero-glow-r {
  pointer-events: none;
  position: absolute;
  right: -6rem;
  top: 25%;
  width: 18rem;
  height: 18rem;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  filter: blur(48px);
}

.hero-glow-l {
  pointer-events: none;
  position: absolute;
  left: -8rem;
  bottom: 0;
  width: 16rem;
  height: 16rem;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  filter: blur(48px);
}

.hero-inner {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .hero-inner {
    padding: 0 1.5rem;
  }
}

.hero-copy {
  max-width: 48rem;
}

.hero-eyebrow {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}

.hero-lead {
  margin: 1.25rem 0 0;
  max-width: 42rem;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--muted);
}

@media (min-width: 640px) {
  .hero-lead {
    font-size: 1.25rem;
  }
}

.hero-sub {
  margin: 1rem 0 0;
  max-width: 42rem;
  font-size: 1rem;
  line-height: 1.65;
  color: color-mix(in srgb, var(--foreground) 90%, transparent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--primary);
  color: var(--primary-foreground);
  text-decoration: none;
  transition: transform 0.2s;
}

.btn-primary:hover {
  transform: scale(1.02);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: color-mix(in srgb, white 60%, transparent);
  backdrop-filter: blur(4px);
  text-decoration: none;
  color: var(--foreground);
  transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

html.reduce-motion .reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

/* Hero stagger */
.hero-stagger {
  opacity: 0;
  transform: translateY(20px);
}

html:not(.reduce-motion) .hero-ready .hero-stagger {
  animation: hero-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-ready .hero-stagger:nth-child(1) {
  animation-delay: 0s;
}
.hero-ready .hero-stagger:nth-child(2) {
  animation-delay: 0.08s;
}
.hero-ready .hero-stagger:nth-child(3) {
  animation-delay: 0.16s;
}
.hero-ready .hero-stagger:nth-child(4) {
  animation-delay: 0.24s;
}
.hero-ready .hero-stagger:nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes hero-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html.reduce-motion .hero-stagger {
  opacity: 1;
  transform: none;
  animation: none;
}

/* Sections */
.section {
  padding: 5rem 0;
  scroll-margin-top: 6rem;
}

@media (min-width: 640px) {
  .section {
    padding: 6rem 0;
  }
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-intro {
  margin: 1rem 0 0;
  max-width: 42rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
}

@media (min-width: 640px) {
  .section-intro {
    font-size: 1.125rem;
  }
}

.section-intro strong {
  font-weight: 500;
  color: var(--foreground);
}

/* Cards grid */
.card-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 3rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, white 70%, transparent);
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08);
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--primary) 40%, transparent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover::before {
  opacity: 1;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.card p {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
}

@media (min-width: 640px) {
  .card p {
    font-size: 1rem;
  }
}

/* Projects */
.section-projects {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, white 40%, transparent);
  backdrop-filter: blur(4px);
}

.projects-grid {
  list-style: none;
  margin: 3rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 1.5rem;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08);
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.project-card .desc {
  flex: 1;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
}

@media (min-width: 640px) {
  .project-card .desc {
    font-size: 1rem;
  }
}

.project-card .accent {
  margin: 0.75rem 0 0;
  padding-left: 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--primary) 50%, transparent);
  font-size: 0.875rem;
  font-weight: 500;
  color: color-mix(in srgb, var(--foreground) 85%, transparent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tags span {
  border-radius: 9999px;
  background: var(--primary-soft);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
}

.project-card a.project-link {
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.project-card a.project-link:hover {
  text-decoration: underline;
}

/* Contact CTA */
.contact-panel {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background: linear-gradient(to bottom right, color-mix(in srgb, var(--primary) 10%, transparent), var(--background), var(--background));
  padding: 2rem;
}

@media (min-width: 640px) {
  .contact-panel {
    padding: 3rem 4rem;
  }
}

.contact-panel .glow {
  pointer-events: none;
  position: absolute;
  right: -4rem;
  top: 0;
  width: 12rem;
  height: 12rem;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  filter: blur(48px);
}

.contact-panel .inner {
  position: relative;
  max-width: 42rem;
}

.contact-panel .note {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, white 60%, transparent);
  backdrop-filter: blur(4px);
  padding: 3.5rem 0;
}

.footer-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

@media (min-width: 640px) {
  .footer-grid {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.footer-address {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
}

.footer-org {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .footer-aside {
    align-items: flex-end;
  }
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .social-row {
    justify-content: flex-end;
  }
}

.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, white 80%, transparent);
  color: var(--foreground);
  transition: transform 0.2s, border-color 0.2s, color 0.2s;
}

.social-row a:hover {
  transform: scale(1.05);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}

.social-row a svg {
  width: 1.25rem;
  height: 1.25rem;
}

.footer-email {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.footer-email:hover {
  text-decoration: underline;
}

.footer-legal {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

@media (min-width: 640px) {
  .footer-legal {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-legal .fine {
  font-size: 0.75rem;
}

@media (min-width: 640px) {
  .footer-legal .fine {
    font-size: 0.875rem;
  }
}

.code-hint {
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  color: color-mix(in srgb, var(--foreground) 90%, transparent);
}
