/* ==========================================================================
   LIBORIO — "Pixel par Pixel"
   Design tokens, layout, animations. Mobile-first.
   Pages: index.html, mentions.html, 404.html
   ========================================================================== */

:root {
  --ink: #131417;
  --ink-soft: #1B1C21;
  --ink-card: #1F2026;
  --line: #2A2C33;
  --white: #FFFFFF;
  --gray: #9CA0AB;
  --violet: #8177F8;
  --violet-deep: #5E52F3;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --container: 1200px;
  --gutter: clamp(20px, 5vw, 48px);
  --step: 12px; /* pixel unit for the staircase separators */
}

/* ---------- Reset & base ---------- */

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

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

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

textarea { resize: none; }

button { font: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }

::selection { background: var(--violet); color: var(--white); }

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

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--violet); color: var(--white);
  padding: 10px 18px; font-family: var(--font-mono); font-size: 13px;
}
.skip-link:focus { left: 0; }

/* ---------- Page load veil (pixel dissolve) ---------- */

.page-load-veil {
  position: fixed; inset: 0; z-index: 90;
  background: var(--ink);
  pointer-events: none;
  animation: veil-out 0.9s steps(8) 0.55s forwards;
}

@keyframes veil-out { to { opacity: 0; visibility: hidden; } }

/* ---------- Header / nav ---------- */

.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 80; }

.nav {
  display: flex; align-items: center; gap: 28px;
  max-width: var(--container); margin: 0 auto;
  padding: 14px var(--gutter);
}

.site-header::before {
  content: ""; position: absolute; inset: 0;
  background: rgba(19, 20, 23, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled::before { border-bottom-color: var(--line); }

.nav > * { position: relative; }

.nav-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em;
}

.nav-links { display: none; list-style: none; gap: 26px; margin-left: auto; }
.nav-links a {
  font-size: 14.5px; font-weight: 500; color: var(--gray);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--white); }

.nav-cta {
  display: none; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: var(--white);
  border: 1px solid var(--line);
  padding: 10px 16px;
  transition: border-color 0.2s, background 0.2s;
}
.nav-cta svg { width: 14px; height: 14px; transition: transform 0.2s; }
.nav-cta:hover { border-color: var(--violet); background: rgba(129, 119, 248, 0.08); }
.nav-cta:hover svg { transform: translateX(3px); }

.nav-burger {
  margin-left: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  background: none; border: 1px solid var(--line);
}
.nav-burger span { display: block; width: 22px; height: 2px; flex-shrink: 0; background: var(--white); border-radius: 1px; transition: transform 0.25s, opacity 0.25s; }
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: relative;
  background: rgba(19, 20, 23, 0.97);
  border-bottom: 1px solid var(--line);
}
.mobile-menu ul { list-style: none; padding: 10px var(--gutter) 26px; }
.mobile-menu a {
  display: block; padding: 14px 0;
  font-family: var(--font-display); font-size: 22px; font-weight: 500;
  border-bottom: 1px solid var(--line);
}
.mobile-menu-cta { color: var(--violet); }

@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
  .nav-burger, .mobile-menu { display: none; }
}

/* ---------- Pixel staircase separators ---------- */

/* The staircase tile is painted in the CURRENT section's background color
   and hangs over the top of the next section, creating a pixel edge. */
.px-stairs {
  position: absolute; left: 0; right: 0;
  bottom: calc(-1 * var(--step) * 3); height: calc(var(--step) * 3);
  background-repeat: repeat-x;
  background-size: 48px 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='36'%3E%3Cpath d='M0 0h12v36H0zM12 12h12v24H12zM24 24h12v12H24z' fill='%23131417'/%3E%3C/svg%3E");
  z-index: 2;
}
.px-stairs.flip { transform: scaleX(-1); }

/* Sections on the lighter background paint their own color */
.services .px-stairs,
.portfolio .px-stairs {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='36'%3E%3Cpath d='M0 0h12v36H0zM12 12h12v24H12zM24 24h12v12H24z' fill='%231B1C21'/%3E%3C/svg%3E");
}

/* ---------- Sections base ---------- */

.section { position: relative; padding: clamp(90px, 12vw, 150px) 0; }

.eyebrow {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--violet);
  margin-bottom: 18px;
}

.section-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.04; letter-spacing: -0.03em;
  margin-bottom: clamp(40px, 6vw, 70px);
}
.section-title .accent { color: var(--violet); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 130px 0 clamp(90px, 12vw, 140px);
  background: var(--ink);
  overflow: hidden;
}

.hero-grid { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero-inner {
  position: relative; z-index: 3;
  max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter);
  width: 100%;
}

.hero-logo { width: clamp(64px, 9vw, 92px); height: auto; margin-bottom: 34px; }

.hero-logo .px { opacity: 0; animation: px-in 0.001s forwards; }
.hero-logo .px-1 { animation-delay: 0.7s; }
.hero-logo .px-2 { animation-delay: 0.85s; }
.hero-logo .px-3 { animation-delay: 1s; }
.hero-logo .px-4 { animation-delay: 1.2s; }

@keyframes px-in { to { opacity: 1; } }

.hero-eyebrow {
  font-family: var(--font-mono); font-size: 13.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gray);
  margin-bottom: 22px;
}
.blink { color: var(--violet); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(44px, 9.5vw, 108px);
  line-height: 0.98; letter-spacing: -0.035em;
  margin-bottom: 30px;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span {
  display: block;
  transform: translateY(110%);
  animation: line-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-title .line:nth-child(1) > span { animation-delay: 0.75s; }
.hero-title .line:nth-child(2) > span { animation-delay: 0.9s; }
.hero-title .line:nth-child(3) > span { animation-delay: 1.05s; }
.line-accent { color: var(--violet); }

@keyframes line-up { to { transform: translateY(0); } }

.hero-sub {
  max-width: 560px; color: var(--gray); font-size: clamp(16px, 2vw, 18px);
  margin-bottom: 38px;
  opacity: 0; animation: fade-up 0.7s ease 1.3s forwards;
}

.hero-actions {
  display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 56px;
  opacity: 0; animation: fade-up 0.7s ease 1.45s forwards;
}

@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: clamp(22px, 4vw, 52px);
  list-style: none;
  border-top: 1px solid var(--line);
  padding-top: 26px;
  opacity: 0; animation: fade-up 0.7s ease 1.6s forwards;
}
.hero-meta li { display: flex; flex-direction: column; gap: 4px; }
.meta-key { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gray); }
.meta-val { font-family: var(--font-display); font-weight: 500; font-size: 17px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  padding: 15px 24px;
  min-height: 48px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.btn svg { width: 15px; height: 15px; transition: transform 0.2s; }
.btn:hover svg { transform: translateX(4px); }
.btn:hover svg.arrow-back { transform: translateX(-4px); }

.btn-primary {
  background: var(--violet); color: var(--white);
  border: 1px solid var(--violet);
  box-shadow: 4px 4px 0 0 var(--violet-deep);
}
.btn-primary:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 var(--violet-deep); }
.btn-primary:active { transform: translate(4px, 4px); box-shadow: 0 0 0 0 var(--violet-deep); }

.btn-ghost { border: 1px solid var(--line); color: var(--white); }
.btn-ghost:hover { border-color: var(--gray); }

/* ---------- Services ---------- */

.services { background: var(--ink-soft); }

.services-grid {
  display: grid; grid-template-columns: 1fr; gap: 18px;
}

.service-card {
  background: var(--ink-card);
  border: 1px solid var(--line);
  padding: clamp(26px, 4vw, 38px);
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s, border-color 0.25s;
}
.service-card::after {
  content: ""; position: absolute; top: 0; right: 0;
  width: 10px; height: 10px; background: var(--line);
  transition: background 0.25s, width 0.25s, height 0.25s;
}
.service-card:hover,
.service-card:active { transform: translateY(-4px); border-color: rgba(129, 119, 248, 0.55); }
.service-card:hover::after,
.service-card:active::after { background: var(--violet); width: 14px; height: 14px; }

.service-icon { width: 44px; height: 44px; margin-bottom: 22px; }
.service-icon svg { width: 100%; height: 100%; }

.service-card h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.service-card p { color: var(--gray); font-size: 15.5px; }

@media (min-width: 768px) { .services-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .services-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }

/* ---------- Process ---------- */

.process { background: var(--ink); }

.process-list { list-style: none; max-width: 860px; }

.process-step {
  display: grid; grid-template-columns: auto 1fr; gap: clamp(18px, 4vw, 40px);
  padding: clamp(26px, 4vw, 38px) 0;
  border-bottom: 1px solid var(--line);
}
.process-step:first-child { border-top: 1px solid var(--line); }

.step-index {
  font-family: var(--font-mono); font-size: clamp(15px, 2vw, 17px);
  color: var(--violet);
  padding-top: 4px;
  position: relative;
}

/* Vertical pixel connector between steps */
.step-index::after {
  content: "";
  position: absolute;
  left: 50%; top: 38px; bottom: calc(-1 * clamp(26px, 4vw, 38px));
  width: 3px;
  transform: translateX(-50%);
  background-image: linear-gradient(var(--line) 60%, transparent 60%);
  background-size: 3px 10px;
}
.process-step:last-child .step-index::after { display: none; }

.step-body h3 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 3vw, 26px);
  letter-spacing: -0.01em; margin-bottom: 8px;
}
.step-body p { color: var(--gray); max-width: 620px; font-size: 15.5px; }

/* ---------- Portfolio ---------- */

.portfolio { background: var(--ink-soft); }

.case-card {
  display: grid; grid-template-columns: 1fr; gap: 0;
  background: var(--ink-card);
  border: 1px solid var(--line);
  overflow: hidden;
}

.case-media { position: relative; display: block; overflow: hidden; }
.case-media img {
  width: 100%; height: 100%; object-fit: cover;
  aspect-ratio: 16 / 10;
  filter: saturate(0.85);
  transition: transform 0.5s ease, filter 0.5s ease;
}
.case-media:hover img { transform: scale(1.035); filter: saturate(1); }

.case-visit {
  position: absolute; left: 18px; bottom: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--white);
  font-family: var(--font-mono); font-size: 12.5px;
  padding: 10px 14px;
  border: 1px solid var(--line);
}
.case-visit svg { width: 13px; height: 13px; }

.case-body { padding: clamp(26px, 4vw, 44px); }

.case-tag {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--violet); margin-bottom: 14px;
}
.case-body h3 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -0.02em; margin-bottom: 14px;
}
.case-desc { color: var(--gray); font-size: 15.5px; margin-bottom: 30px; max-width: 520px; }

.case-facts { display: flex; flex-wrap: wrap; gap: clamp(20px, 3vw, 40px); list-style: none; }
.case-facts li { display: flex; flex-direction: column; gap: 3px; }
.fact-val { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--white); }
.fact-key { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray); }

@media (min-width: 900px) {
  .case-card { grid-template-columns: 1.15fr 1fr; }
  .case-media img { aspect-ratio: auto; min-height: 100%; }
}

/* ---------- Contact ---------- */

.contact { background: var(--ink); }

.contact-grid { display: grid; grid-template-columns: 1fr; gap: clamp(40px, 6vw, 80px); }

.contact-lede { color: var(--gray); max-width: 460px; margin-bottom: 36px; font-size: 16.5px; }

.contact-details { list-style: none; display: flex; flex-direction: column; gap: 20px; }
.contact-details li { display: flex; flex-direction: column; gap: 4px; }
.detail-key { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gray); }
.contact-details a, .contact-details span:not(.detail-key) { font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.contact-details a:hover { color: var(--violet); }

.contact-form {
  background: var(--ink-card);
  border: 1px solid var(--line);
  padding: clamp(26px, 4vw, 42px);
  display: flex; flex-direction: column; gap: 22px;
}

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gray);
}
.field input, .field textarea {
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--white);
  font-family: var(--font-body); font-size: 15.5px;
  padding: 14px 16px;
  min-height: 48px;
  transition: border-color 0.2s;
}
.field textarea { min-height: 140px; }
.field input::placeholder, .field textarea::placeholder { color: #5B5F6B; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--violet); }

.btn-submit { justify-content: center; }
.btn-submit[disabled] { opacity: 0.6; cursor: default; }

.form-note { font-size: 12.5px; color: var(--gray); }
.form-status { font-family: var(--font-mono); font-size: 13.5px; color: var(--violet); min-height: 1em; }
.form-status.is-error { color: #F87777; }

@media (min-width: 900px) { .contact-grid { grid-template-columns: 1fr 1.1fr; align-items: start; } }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--ink); }

.footer-inner {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding-top: 44px; padding-bottom: 44px;
}
.footer-brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.footer-brand .brand-mark { width: 30px; height: 30px; }
.footer-tag { font-family: var(--font-mono); font-size: 13px; color: var(--gray); }

.footer-meta { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.footer-legal { font-size: 13px; color: var(--gray); }
.footer-legal a:hover { color: var(--violet); }

.footer-linkedin {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--gray);
  transition: color 0.2s;
}
.footer-linkedin svg { width: 16px; height: 16px; }
.footer-linkedin:hover { color: var(--violet); }

@media (min-width: 768px) {
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .footer-meta { align-items: flex-end; }
}

/* ---------- Legal page (mentions.html) ---------- */

.legal-page { padding: 160px 0 clamp(80px, 10vw, 120px); }

.legal-container { max-width: 780px; }

.legal-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05; letter-spacing: -0.03em;
  margin-bottom: clamp(40px, 6vw, 64px);
}
.legal-title .accent { color: var(--violet); }

.legal-block { margin-bottom: clamp(36px, 5vw, 52px); }

.legal-block h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em;
  margin-bottom: 14px;
  padding-left: 18px;
  position: relative;
}
.legal-block h2::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 9px; height: 9px; background: var(--violet);
}

.legal-block p { color: var(--gray); font-size: 15.5px; margin-bottom: 12px; }
.legal-block p strong { color: var(--white); font-weight: 600; }
.legal-block a { color: var(--white); border-bottom: 1px solid var(--violet); transition: color 0.2s; }
.legal-block a:hover { color: var(--violet); }

.legal-list { list-style: none; border: 1px solid var(--line); background: var(--ink-card); }
.legal-list li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 18px;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.legal-list li:last-child { border-bottom: none; }
.legal-list li span {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gray);
}

.legal-updated { font-family: var(--font-mono); font-size: 12.5px; }

.legal-back { margin-top: 10px; }

@media (min-width: 640px) {
  .legal-list li { flex-direction: row; align-items: baseline; gap: 16px; }
  .legal-list li span { min-width: 220px; }
}

/* ---------- 404 page ---------- */

.notfound { min-height: 100svh; }

.notfound-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}

.notfound-figure {
  width: min(460px, 78vw);
  height: auto;
  margin: 10px 0 36px;
}

.notfound-figure rect {
  opacity: 0;
  animation: px-in 0.001s forwards;
  transition: fill 0.25s steps(2);
}

.notfound-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1.05; letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.notfound-sub {
  color: var(--gray); max-width: 480px; font-size: 16px;
  margin-bottom: 36px;
}

.notfound-actions { justify-content: center; margin-bottom: 0; }

/* ---------- Scroll reveals (pixel snap) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s steps(6), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Stagger inside grids */
.services-grid .reveal.is-visible:nth-child(2) { transition-delay: 0.08s; }
.services-grid .reveal.is-visible:nth-child(3) { transition-delay: 0.16s; }
.services-grid .reveal.is-visible:nth-child(4) { transition-delay: 0.24s; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .page-load-veil { animation: none; opacity: 0; visibility: hidden; }
  .hero-logo .px, .hero-title .line > span, .hero-sub, .hero-actions, .hero-meta { animation: none; opacity: 1; transform: none; }
  .blink { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-grid { display: none; }
  .notfound-figure rect { animation: none; opacity: 1; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
