/* =========================================================================
   Krysoft landing page — styles
   Editorial Swiss minimalism · light theme · cobalt accent
   ========================================================================= */

/* ---------- Fonts (self-hosted, Latin + Latin Extended for Slovak) ------- */
@font-face {
  font-family: "Inter Tight";
  src: url("/fonts/InterTight-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+2070-209F, U+20A0-20CF;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+2070-209F, U+20A0-20CF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F;
}

/* ---------- Reset ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { min-height: 100dvh; }
button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
hr { border: 0; }
h1, p { margin: 0; }

/* ---------- Tokens ------------------------------------------------------ */
:root {
  --bg: #F5F2EC;
  --bg-rgb: 245, 242, 236;        /* raw channels of --bg for rgba() */
  --fg: #161616;
  --fg-soft: rgba(22, 22, 22, 0.40);
  --hairline: rgba(22, 22, 22, 0.12);
  --accent: #1F3DFF;
  --pad-x: clamp(1.5rem, 4vw, 4rem);
  --pad-y: clamp(1.25rem, 3vh, 2.5rem);
  --indent: clamp(0rem, 8vw, 8rem); /* left indent of the content slab on desktop */
  --header-h: calc(var(--pad-y) * 2 + 1.2rem);
}

/* ---------- Base ------------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1.1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout ------------------------------------------------------ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pad-y) var(--pad-x);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background-color 200ms ease, border-color 200ms ease, backdrop-filter 200ms ease;
  border-bottom: 1px solid transparent;
}

.header.is-scrolled {
  background: rgba(var(--bg-rgb), 0.8);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom-color: var(--hairline);
}

.header__right {
  display: inline-flex;
  align-items: center;
  gap: 2rem;
}
.header__right > nav {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
  transition: color 200ms ease;
}
.nav-link:hover,
.nav-link:focus-visible { color: var(--accent); }

.main {
  display: grid;
  place-content: center start;
  min-height: calc(100dvh - var(--header-h));
  padding-top: var(--pad-y);
  padding-right: calc(var(--pad-x) * 2);
  padding-bottom: var(--pad-y);
  padding-left: calc(var(--pad-x) + var(--indent));
  gap: clamp(1rem, 2.5vh, 2rem);
  position: relative;
}

.footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: var(--pad-y) var(--pad-x);
}

/* ---------- Typography & components ------------------------------------ */
.wordmark {
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lang__btn {
  color: var(--fg-soft);
  transition: color 200ms ease;
}
.lang__btn.is-active { color: var(--fg); }
.lang__sep { color: var(--fg-soft); }

.headline {
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.subline {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  line-height: 1.5;
  max-width: 36ch;
  color: var(--fg);
}

.rule {
  width: 3rem;
  height: 1px;
  background: var(--fg);
  margin: 0;
  opacity: 1;
  transform-origin: left center;
}

.cta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
}
.cta__email { position: relative; }
.cta__arrow {
  color: var(--accent);
  transition: transform 200ms ease;
  display: inline-block;
}

.footer__co,
.footer__time {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.footer__time { display: inline-flex; gap: 0.5rem; align-items: baseline; }

/* ---------- Hero scroll hint ------------------------------------------ */
.hero__hint {
  position: absolute;
  left: calc(var(--pad-x) + var(--indent));
  bottom: var(--pad-y);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-soft);
  transition: color 200ms ease;
  animation: hero-rise 1100ms cubic-bezier(0.16, 1, 0.3, 1) 700ms both,
             hint-breathe 2.4s ease-in-out infinite 2000ms;
}
.hero__hint:hover,
.hero__hint:focus-visible { color: var(--fg); }

@keyframes hint-breathe {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(4px); opacity: 1; }
}

/* ---------- Hero reveal on load --------------------------------------- */
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hero-rule-draw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.headline { animation: hero-rise      1100ms cubic-bezier(0.16, 1, 0.3, 1)   0ms both; }
.subline  { animation: hero-rise      1100ms cubic-bezier(0.16, 1, 0.3, 1) 150ms both; }
.rule     { animation: hero-rule-draw 1100ms cubic-bezier(0.16, 1, 0.3, 1) 300ms both; }
.cta      { animation: hero-rise      1100ms cubic-bezier(0.16, 1, 0.3, 1) 450ms both; }

/* ---------- Portfolio -------------------------------------------------- */
.work {
  /* normal flow; cases manage their own per-section padding */
}

.case {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "eyebrow eyebrow"
    "text    figure";
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding-top: clamp(4rem, 10vh, 7rem);
  padding-right: var(--pad-x);
  padding-bottom: clamp(4rem, 10vh, 7rem);
  padding-left: calc(var(--pad-x) + var(--indent));
}

.case:nth-child(even) {
  grid-template-areas:
    "eyebrow eyebrow"
    "figure  text";
}

.case__eyebrow { grid-area: eyebrow; }
.case__text    { grid-area: text; min-width: 0; }
.case__figure  { grid-area: figure; min-width: 0; }

.case__eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin: 0 0 1rem;
}

.case__title {
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.case__rule {
  width: 3rem;
  height: 1px;
  background: var(--fg);
  margin: 0 0 1.5rem;
  opacity: 1;
  transform-origin: left center;
}

.case__block {
  margin: 0 0 1.25rem;
  max-width: 36ch;
}
.case__block:last-of-type { margin-bottom: 0; }

.case__label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin: 0 0 0.35rem;
}

.case__link {
  display: inline-flex;
  align-items: center;
  margin-top: 1.5rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 200ms ease;
}
.case__link:hover,
.case__link:focus-visible { color: var(--fg); }

.case__body {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fg);
  margin: 0;
}

.case__figure {
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

/* Case modifier: figure flush to the right viewport edge. */
.case--flush-right { padding-right: 0; }
.case--flush-right .case__figure {
  border-radius: 8px 0 0 8px;
}

.case__figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* Device-mockup figures (phone, etc.) — at narrow widths the 4:3 box
   leaves the phone tiny with lots of side whitespace. Switch to a 3:4
   portrait box so the phone fills vertically without cropping top
   or bottom; sides of the image get cropped instead. */
@media (max-width: 576px) {
  .case__figure--device {
    aspect-ratio: 3 / 4;
  }
  .case__figure--device img {
    object-position: center;
  }
}

.case__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 3vw, 2.5rem);
  letter-spacing: -0.01em;
}

/* ---------- Portfolio reveals ----------------------------------------- */
.case__eyebrow,
.case__title,
.case__block,
.case__link,
.case__figure {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1100ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.case__rule {
  transform: scaleX(0);
  transition: transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.case__figure {
  transform: translateY(32px) scale(0.98);
}

.case.is-visible .case__eyebrow { transition-delay: 0ms;   opacity: 1; transform: translateY(0); }
.case.is-visible .case__title   { transition-delay: 120ms; opacity: 1; transform: translateY(0); }
.case.is-visible .case__rule    { transition-delay: 240ms; transform: scaleX(1); }
.case.is-visible .case__figure  {
  transition-delay: 300ms;
  opacity: 1;
  transform: translateY(0) scale(1);
  translate: 0 var(--parallax-y, 0px);
}
.case.is-visible .case__block:nth-of-type(1) { transition-delay: 360ms; opacity: 1; transform: translateY(0); }
.case.is-visible .case__block:nth-of-type(2) { transition-delay: 480ms; opacity: 1; transform: translateY(0); }
.case.is-visible .case__link                 { transition-delay: 600ms; opacity: 1; transform: translateY(0); }

/* ---------- Contact ---------------------------------------------------- */
.contact {
  display: grid;
  gap: 1.5rem;
  padding-top: clamp(5rem, 14vh, 9rem);
  padding-right: var(--pad-x);
  padding-bottom: clamp(4rem, 10vh, 7rem);
  padding-left: calc(var(--pad-x) + var(--indent));
}

.contact__eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin: 0;
}

.contact__headline {
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 18ch;
}

.contact__email {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 2.5vw, 2.25rem);
  letter-spacing: -0.01em;
  align-self: start;
  margin-top: 0.5rem;
  position: relative;
}
.contact__email-text { position: relative; }
.contact__email-text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease-out;
}
.contact__email-arrow {
  color: var(--accent);
  transition: transform 200ms ease;
  display: inline-block;
}
.contact__email:hover .contact__email-text::after,
.contact__email:focus-visible .contact__email-text::after { transform: scaleX(1); }
.contact__email:hover .contact__email-arrow,
.contact__email:focus-visible .contact__email-arrow { transform: translateX(8px); }

.contact__meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--fg-soft);
  margin: 0;
  max-width: 42ch;
}

/* Contact reveal — fires when the section enters viewport */
.contact__eyebrow,
.contact__headline,
.contact__email,
.contact__meta {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1100ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.contact.is-visible .contact__eyebrow  { transition-delay: 0ms;   opacity: 1; transform: translateY(0); }
.contact.is-visible .contact__headline { transition-delay: 120ms; opacity: 1; transform: translateY(0); }
.contact.is-visible .contact__meta     { transition-delay: 260ms; opacity: 1; transform: translateY(0); }
.contact.is-visible .contact__email    { transition-delay: 400ms; opacity: 1; transform: translateY(0); }

/* ---------- Responsive ------------------------------------------------- */
@media (max-width: 1023px) {
  :root { --indent: clamp(0rem, 4vw, 3rem); }

  .case {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "eyebrow"
      "text"
      "figure";
    gap: clamp(1.5rem, 4vw, 2.5rem);
    padding-left: var(--pad-x);
    padding-right: var(--pad-x);
    /* allow the case to size naturally to its content on tablet
       so the figure doesn't crush the text on shorter screens */
    min-height: auto;
    padding-block: clamp(3rem, 8vh, 6rem);
  }
  /* On the stacked layout the figure sits below text — restore full radius. */
  .case--flush-right .case__figure { border-radius: 8px; }
  .case:nth-child(even) {
    grid-template-areas:
      "eyebrow"
      "text"
      "figure";
  }
  /* Contact mirrors the cases at narrow widths — symmetric padding. */
  .contact { padding-left: var(--pad-x); }
}
@media (max-width: 639px) {
  :root {
    --indent: 0;
    --pad-x: 1.5rem;
    --pad-y: 1rem;
  }
  body { overflow-x: hidden; }
  .headline { font-size: clamp(2rem, 9vw, 3rem); max-width: 16ch; }
  .subline { font-size: 0.95rem; max-width: 28ch; }
  .cta { font-size: 1.1rem; }
  .wordmark { font-size: 0.85rem; }
  .lang { font-size: 0.7rem; }
  /* Hide the secondary nav on mobile — Práca + Kontakt + lang together
     overflow narrow widths. The hero hint + scrolling cover navigation. */
  .header__right > nav[aria-label="Sections"] { display: none; }
  .hero__hint { font-size: 0.7rem; left: var(--pad-x); }
  .footer__co,
  .footer__time { font-size: 0.65rem; }
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .case {
    padding-block: clamp(2.5rem, 7vh, 4rem);
  }
  .case__title { font-size: clamp(1.75rem, 7vw, 2.5rem); }
  .case__block { max-width: 32ch; }

  /* The hero's desktop calc(var(--pad-x) * 2) on the right side reads
     as asymmetric on a narrow screen — flatten to symmetric padding. */
  .main {
    padding: var(--pad-y) var(--pad-x);
  }
}

/* ---------- Interactions ----------------------------------------------- */
.cta__email::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease-out;
}
.cta:hover .cta__email::after,
.cta:focus-visible .cta__email::after { transform: scaleX(1); }
.cta:hover .cta__arrow,
.cta:focus-visible .cta__arrow { transform: translateX(6px); }

/* ---------- Focus states ------------------------------------------------ */
:focus { outline: 0; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- Reduced motion --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
  .cta:hover .cta__arrow,
  .cta:focus-visible .cta__arrow { transform: none; }
  .cta:hover .cta__email::after,
  .cta:focus-visible .cta__email::after { transform: scaleX(1); transition: none; }

  /* Reveal everything in its final state immediately */
  .case__eyebrow,
  .case__title,
  .case__block,
  .case__link,
  .contact__eyebrow,
  .contact__headline,
  .contact__email,
  .contact__meta { opacity: 1; transform: none; }
  .case__figure { opacity: 1; transform: none; translate: none; }
  .case__rule { transform: scaleX(1); }
}
