/* loogika3.ee — Loogika Kuubis OÜ */

/* ---------- fonts (self-hosted, SIL OFL) ---------- */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- tokens ---------- */
:root {
  --bg: #07070a;
  --bg-2: #10111a;
  --fg: #ece9e2;
  --fg-soft: #b9b6ae;
  --muted: #7d7e88;
  --accent: #9dc4ff;
  --accent-rgb: 157 196 255;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --mx: 50vw;
  --my: 45vh;
  --px: 0;
  --py: 0;
}

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

html {
  color-scheme: dark;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background:
    radial-gradient(90% 70% at 50% 42%, var(--bg-2) 0%, transparent 70%),
    var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgb(var(--accent-rgb) / .28); color: var(--fg); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

/* ---------- background layers ---------- */
.cube {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 2.6s ease .2s;
}
.is-ready .cube,
html:not(.js) .cube { opacity: 1; }

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(560px circle at var(--mx) var(--my), rgb(var(--accent-rgb) / .07), transparent 62%);
}

.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: 2;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  animation: grain 1.4s steps(5) infinite;
}

/* ---------- chrome ---------- */
.top, .bottom {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(18px, 3vw, 30px) clamp(20px, 4.5vw, 52px);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  /* The bars sit flush with the viewport edges, so they must never be
     transformed themselves: a translated footer pokes below the page and
     flashes a scrollbar. Their children carry .reveal instead, and the
     slide stays inside the padding. `overflow: clip` guards that. */
  overflow: clip;
}
.top { padding-top: max(clamp(18px, 3vw, 30px), env(safe-area-inset-top)); }
.bottom { padding-bottom: max(clamp(18px, 3vw, 30px), env(safe-area-inset-bottom)); }
.bottom p { margin: 0; }

.mark {
  display: inline-flex;
  color: var(--fg-soft);
  transition: color .4s var(--ease), transform .8s var(--ease);
}
.mark:hover { color: var(--accent); transform: rotate(60deg); }
.mark svg { display: block; width: 22px; height: 22px; }

.lang { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; letter-spacing: .22em; }
.lang .sep { opacity: .6; }
.lang button {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 6px 3px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: color .3s;
}
.lang button::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s var(--ease);
}
.lang button:hover,
.lang button[aria-pressed="true"] { color: var(--fg); }
.lang button[aria-pressed="true"]::after { transform: scaleX(1); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px clamp(20px, 4.5vw, 52px);
}
.hero-inner {
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -8px), 0);
  will-change: transform;
}

.kicker {
  margin: 0 0 clamp(16px, 2.5vw, 28px);
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--muted);
}

.logo {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-style: normal;
  font-size: clamp(66px, 15vw, 184px);
  line-height: 1;
  letter-spacing: -.01em;
  display: flex;
  align-items: baseline;
  justify-content: center;
  color: var(--fg);
  cursor: default;
}
.logo .paren { display: inline-block; color: var(--fg-soft); }
.logo .word  { display: inline-block; font-style: italic; padding: 0 .02em; }
.logo .exp {
  display: inline-block;
  font-size: .42em;
  line-height: 0;
  vertical-align: baseline;
  margin-left: .02em;
  transform: translateY(-1.05em);
}
.logo .exp-in {
  display: inline-block;
  color: var(--accent);
  text-shadow: 0 0 16px rgb(var(--accent-rgb) / .35);
  transition: transform 1.2s var(--ease);
  animation: breathe 4.5s ease-in-out infinite;
}
.logo:hover .exp-in { transform: rotateY(360deg); }

.name {
  margin: clamp(16px, 2.4vw, 26px) 0 0;
  display: grid;
  font-size: 12px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
}
.name > span {
  grid-area: 1 / 1;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.name .alt {
  opacity: 0;
  transform: translateY(6px);
  letter-spacing: .12em;
  text-transform: none;
  color: var(--fg-soft);
}
.hero:has(.logo:hover) .name .primary,
.hero.is-flipped .name .primary { opacity: 0; transform: translateY(-6px); }
.hero:has(.logo:hover) .name .alt,
.hero.is-flipped .name .alt { opacity: 1; transform: none; }

.tagline {
  margin: clamp(30px, 4.5vw, 52px) 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.7vw, 34px);
  line-height: 1.3;
  color: rgb(236 233 226 / .92);
}

.contact {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  margin-top: clamp(34px, 5vw, 60px);
  padding: 6px 2px;
  position: relative;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: .04em;
}
.contact .prompt { color: var(--accent); }
.contact::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s var(--ease);
}
.contact:hover::after,
.contact:focus-visible::after { transform: scaleX(1); }
.caret {
  display: inline-block;
  width: .55em;
  height: 1.1em;
  margin-left: -.15em;
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}

/* language swap crossfade */
[data-i18n] { transition: opacity .25s ease; }
[data-i18n].swap { opacity: 0 !important; }

/* ---------- entrance ---------- */
.js .logo .paren,
.js .logo .word,
.js .logo .exp,
.js .reveal { opacity: 0; }

.js.is-ready .logo .open  { animation: paren-l 1.3s var(--ease) .1s forwards; }
.js.is-ready .logo .close { animation: paren-r 1.3s var(--ease) .1s forwards; }
.js.is-ready .logo .word  { animation: emerge 1.6s var(--ease) .3s forwards; }
.js.is-ready .logo .exp   { animation: pop 1.1s var(--ease) 1.15s forwards; }
.js.is-ready .reveal      { animation: reveal 1.2s var(--ease) var(--d, 1.4s) forwards; }

.kicker  { --d: 1.35s; }
.name    { --d: 1.5s; }
.tagline { --d: 1.65s; }
.contact { --d: 1.85s; }
.top, .bottom { --d: 2.1s; }

@keyframes paren-l { from { opacity: 0; transform: translateX(.6em); } to { opacity: 1; transform: none; } }
@keyframes paren-r { from { opacity: 0; transform: translateX(-.6em); } to { opacity: 1; transform: none; } }
@keyframes emerge {
  from { opacity: 0; filter: blur(16px); transform: translateY(.1em) scale(.97); letter-spacing: .08em; }
  to   { opacity: 1; filter: blur(0);    transform: none;                        letter-spacing: -.01em; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-1.05em) scale(.2) rotate(-30deg); }
  to   { opacity: 1; transform: translateY(-1.05em) scale(1) rotate(0); }
}
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes breathe {
  0%, 100% { text-shadow: 0 0 14px rgb(var(--accent-rgb) / .35); }
  50%      { text-shadow: 0 0 30px rgb(var(--accent-rgb) / .55), 0 0 70px rgb(var(--accent-rgb) / .18); }
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-1%, -1%); }
  80%  { transform: translate(3%, 1%); }
  100% { transform: translate(0, 0); }
}

/* ---------- static / reduced motion ---------- */
.is-static *, .is-static *::before, .is-static *::after {
  animation: none !important;
  transition: none !important;
}
.is-static .logo .paren,
.is-static .logo .word,
.is-static .logo .exp,
.is-static .reveal,
.is-static .cube { opacity: 1; }
.is-static .caret { animation: none; }
.is-static .hero-inner { transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* Open Graph render mode (?og) */
.is-og .top, .is-og .bottom { visibility: hidden; }
.is-og .caret, .is-og .grain { display: none; }
.is-og .spotlight { background: radial-gradient(560px circle at 50% 45%, rgb(var(--accent-rgb) / .07), transparent 62%); }

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .top, .bottom { font-size: 10px; letter-spacing: .14em; }
  .name { font-size: 11px; letter-spacing: .26em; }
  .name .alt { letter-spacing: .06em; }
  .tagline { font-size: 21px; }
  .contact { font-size: 13px; }
}
/* Short viewports (laptops at 768px, small landscape phones): tighten the
   vertical rhythm so the whole card fits without a scrollbar. */
@media (max-height: 720px) {
  .top, .bottom { padding-top: 16px; padding-bottom: 16px; }
  .hero { padding-top: 12px; padding-bottom: 12px; }
  .kicker { margin-bottom: 14px; }
  .logo { font-size: clamp(56px, min(15vw, 20vh), 184px); }
  .name { margin-top: 14px; }
  .tagline { margin-top: 24px; font-size: clamp(20px, 2.4vw, 28px); }
  .contact { margin-top: 28px; }
}
@media (max-height: 520px) {
  .logo { font-size: clamp(48px, min(15vw, 18vh), 120px); }
  .tagline { margin-top: 16px; }
  .contact { margin-top: 18px; }
}
