/* Pantalla d'entrada. Llenguatge de sakata.capital: pedra, tinta, molt d'aire;
   l'únic element expressiu és la muntanya en punts de mitja tinta. */
:root {
  --stone: #f5f4f0;
  --ink: #141414;
  --graphite: #5e5d58;
  --mist: #dedcd4;
  --ember: #f39a2e;
  --sun: #f8c23a;
  --btn: #141414;
  --btn-ink: #f5f4f0;
  --dots: 20, 20, 20;
  --dots-glow: 0;
  --clouds-blend: multiply;
  --clouds-filter: none;
  --logo-filter: none;
  --f-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --rail: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stone: #121211;
    --ink: #ecebe6;
    --graphite: #a09e97;
    --mist: #2a2a27;
    --btn: #ecebe6;
    --btn-ink: #121211;
    --dots: 236, 235, 230;
    --dots-glow: 1;
    --clouds-blend: screen;
    --clouds-filter: invert(1);
    --logo-filter: invert(1) hue-rotate(180deg);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --stone: #121211;
  --ink: #ecebe6;
  --graphite: #a09e97;
  --mist: #2a2a27;
  --btn: #ecebe6;
  --btn-ink: #121211;
  --dots: 236, 235, 230;
  --dots-glow: 1;
  --clouds-blend: screen;
  --clouds-filter: invert(1);
  --logo-filter: invert(1) hue-rotate(180deg);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font: 400 15px/1.55 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Estructura: dues columnes amb els rails verticals del web --- */
.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(380px, 40fr) 60fr;
}
.page::before, .page::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--mist); z-index: 1; pointer-events: none;
}
.page::before { left: var(--rail); }
.page::after { left: calc(40% + 0px); }

.panel {
  position: relative; z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 36px 48px 28px calc(var(--rail) + 40px);
  min-height: 100vh;
  min-height: 100dvh;
}

.top { display: flex; align-items: center; min-height: 40px; }
.logo { width: 208px; height: auto; display: block; filter: var(--logo-filter); }

.intro { align-self: center; padding: 64px 0; max-width: 30rem; }

.title {
  margin: 0;
  font-weight: 500;
  font-size: clamp(48px, 5vw, 84px);
  line-height: .96;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.lede {
  margin: 22px 0 0;
  font: italic 400 clamp(22px, 1.9vw, 28px)/1.25 var(--f-serif);
  color: var(--graphite);
  letter-spacing: -.005em;
}

.signin { margin-top: 52px; }
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 26px 0 22px;
  border-radius: 999px;
  background: var(--btn); color: var(--btn-ink);
  font: 500 16px/1 var(--f-sans); letter-spacing: -.01em;
  text-decoration: none;
  transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 10px 30px -14px rgba(20,20,20,.45);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 16px 36px -14px rgba(20,20,20,.5); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }
.ms { width: 18px; height: 18px; flex: none; }
.btn-bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--ember), var(--sun));
  transform: scaleX(0); transform-origin: left;
}
.btn.is-going { pointer-events: none; }
.btn.is-going .btn-bar { animation: going 1.6s cubic-bezier(.3,.6,.2,1) forwards; }
@keyframes going { to { transform: scaleX(.92); } }

.hint { margin: 18px 0 0; max-width: 24rem; font-size: 14px; color: var(--graphite); }

.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--graphite);
  padding-top: 18px; border-top: 1px solid var(--mist);
}

/* --- Escena: la muntanya --- */
.scene { position: relative; margin: 0; overflow: hidden; min-height: 100%; }
#peaks { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.clouds {
  position: absolute; left: -10%; bottom: -22%; width: 120%; height: auto;
  mix-blend-mode: var(--clouds-blend); filter: var(--clouds-filter);
  opacity: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, #000 30%, transparent 70%);
          mask-image: linear-gradient(to top, #000 30%, transparent 70%);
}
.is-ready .clouds { animation: rise 2.4s .6s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(4%); } to { opacity: .55; transform: none; } }

/* --- Mòbil: la muntanya a dalt, el formulari a sota --- */
@media (max-width: 860px) {
  :root { --rail: 16px; }
  .page { grid-template-columns: 1fr; grid-template-rows: 44vh auto; }
  .page::after { display: none; }
  .page::before { left: 16px; }
  .scene {
    grid-row: 1; min-height: 44vh;
    -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
            mask-image: linear-gradient(to bottom, #000 78%, transparent);
  }
  .panel {
    grid-row: 2; min-height: auto;
    grid-template-rows: auto auto;
    padding: 8px 20px 22px calc(var(--rail) + 20px);
  }
  .top { position: absolute; top: calc(-44vh + 20px); left: calc(var(--rail) + 20px); }
  .logo { width: 176px; }
  .intro { grid-row: 1; padding: 0 0 48px; }
  .foot { grid-row: 2; flex-direction: column; gap: 4px; }
  .signin { margin-top: 36px; }
  .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .is-ready .clouds { animation: none; opacity: .9; }
  .btn, .btn:hover { transition: none; transform: none; }
  .btn.is-going .btn-bar { animation: none; transform: scaleX(.92); }
}
