/* ============================================================
   Sebiv Technologies — épuré editorial studio site
   White paper · hairline rules · neo-grotesque + mono
   Inspired by the pared-back studio work of Yorgo Tloupas
   ============================================================ */

:root {
  --paper:   #fbfbf8;   /* barely-warm white */
  --ink:     #14130f;   /* near-black */
  --muted:   #6f6e66;   /* secondary text */
  --line:    rgba(20, 19, 15, 0.16);   /* hairline */
  --line-2:  rgba(20, 19, 15, 0.08);   /* fainter hairline */
  --accent:  #1c2bd4;   /* cobalt — the only color, used sparingly */

  --sans: "Schibsted Grotesk", -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --pad: clamp(20px, 5vw, 64px);   /* page gutter */
  --max: 1320px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint paper grain for depth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* labels share the mono voice */
.nav, .label, .tile-meta, .status,
.colophon, .contact-note, .thumb-note {
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ----------  MASTHEAD  ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
/* masthead: small static resolved lockup */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.logo-mark { width: 1.5em; height: 1.5em; flex: none; overflow: visible; }
.lm-arm { fill: none; stroke: var(--ink); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.lm-axis { stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }

/* ----------  BRAND CONSTRUCTION (hero band)  ---------- */
.build {
  display: flex;
  align-items: center;
  justify-content: flex-start;   /* prompt anchored at the left; text grows right */
  min-height: 32vh;
  padding: clamp(16px, 3vh, 40px) var(--pad);
  padding-left: clamp(36px, 9vw, 150px);   /* nudge the start in from the edge */
  overflow: hidden;              /* contain the mid-spin bloom */
}
.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  transition: transform 0.85s cubic-bezier(.2, .8, .2, 1);  /* settles to center at the end */
}
.brand.centered { transform: translateX(var(--center-x, 0)); }
/* command and mark share one cell. rotation and grow are on separate layers so
   the spin stays one continuous turn (no mid-keyframe stutter that reads as two). */
.spin, .grow {
  display: inline-grid;
  transform-origin: center center;
}
.grow > .cmd, .grow > .mark { grid-area: 1 / 1; align-self: center; justify-self: start; }
.brand.to-mark .spin { animation: spin-rot 1.7s cubic-bezier(.2, .7, .2, 1) forwards; }
.brand.to-mark .grow { animation: spin-grow 1.7s ease-in-out forwards; }
.brand.to-mark .cmd  { opacity: 0; transition: opacity 0.45s ease; }
.brand.to-mark .mark { opacity: 1; transition: opacity 0.55s ease 0.2s; }
@keyframes spin-rot  { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-grow { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* wordmark rises in once the mark has landed */
.logo-type {
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-size: clamp(1.7rem, 6.5vw, 3.6rem);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  max-width: 0;          /* reserves no space until it writes in */
  opacity: 0;
  padding-left: 0.4em;   /* gap to the mark, clipped while collapsed */
  padding-bottom: 0.2em; /* room for the "g" descender inside the clip box */
  margin-bottom: -0.2em; /* keep the lockup vertically centered */
  transition: max-width 0.6s ease, opacity 0.5s ease;
}
.brand.to-mark .logo-type {
  max-width: 12em;
  opacity: 1;
  transition: max-width 1.7s cubic-bezier(.2, .8, .2, 1) 1.5s, opacity 1s ease 1.55s;
}

/* the command line that types itself: > good vibes | great tech < */
.cmd {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(0.95rem, 2.6vw, 1.75rem);
  white-space: pre;
}
.op   { color: var(--ink); }
.pipe { color: var(--accent); }
.cmd-word {
  display: inline-block;
  overflow: hidden;
  white-space: pre;
  color: var(--ink);
  font-weight: 500;
  max-width: 24ch;
  opacity: 1;
  transition: max-width 0.6s cubic-bezier(.4, 0, .2, 1), opacity 0.4s ease;
}
.cmd.collapsed .cmd-word { max-width: 0; opacity: 0; }
.cmd-caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.02em;
  background: var(--accent);
  margin-left: 0.18ch;
  animation: cursor-blink 1.05s steps(1, end) infinite;
}
.cmd.collapsed .cmd-caret { display: none; }
@keyframes cursor-blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* the drawn mark revealed by the spin */
.mark {
  width: clamp(120px, 24vw, 240px);
  height: clamp(120px, 24vw, 240px);
  overflow: visible;
  opacity: 0;
}
.mark-arm {
  fill: none;
  stroke: var(--ink);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mark-axis {
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
}
.nav { display: flex; gap: clamp(16px, 3vw, 40px); font-size: 0.8rem; }
.nav a {
  color: var(--muted);
  text-transform: uppercase;
  position: relative;
  transition: color 0.25s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s cubic-bezier(.2,.8,.2,1);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { width: 100%; }

/* ----------  INTRO (opening studio block)  ---------- */
.intro {
  padding-top: clamp(8px, 2vh, 28px);   /* sits close under the logo */
  padding-bottom: clamp(60px, 12vh, 150px);
}
.intro .label { display: block; margin-bottom: clamp(20px, 4vh, 44px); }

/* Inline mirror words: "vibes" ⇄ "sebiv", "Sebiv" ⇄ "Vibes" */
.flip-word {
  display: inline-block;
  cursor: pointer;
  perspective: 800px;
  color: var(--accent);
  vertical-align: baseline;
}
.fw-inner {
  display: inline-grid;            /* stack faces → no width jump on flip */
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(.2, .85, .2, 1);
}
.flip-word:hover .fw-inner,
.flip-word.is-flipped .fw-inner { transform: rotateY(180deg); }
.fw-face {
  grid-area: 1 / 1;
  white-space: nowrap;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.fw-back { transform: rotateY(180deg); }

/* ----------  BLOCKS / SECTIONS  ---------- */
.block {
  padding-top: clamp(60px, 12vh, 150px);
  padding-bottom: clamp(60px, 12vh, 150px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: clamp(32px, 5vh, 64px);
}
.label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  flex: none;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.98;
}

/* ----------  WORK GRID (ruled, magazine)  ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.tile {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(18px, 2vw, 30px);
  transition: background 0.4s ease;
}
.tile:hover { background: #fff; }
.tile-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(16px, 2vw, 24px);
}

.thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(108px, 13vw, 150px);
  margin-bottom: clamp(16px, 2vw, 26px);
}
.thumb-hatch {
  border: 1px solid var(--line-2);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 9px,
    var(--line-2) 9px 10px
  );
}
.thumb-note {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
  padding: 6px 10px;
}

.tile h3 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.tile p {
  margin: 0 0 24px;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}
.status {
  margin-top: auto;
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--ink);
}
.tile-soon .status { color: var(--muted); }
.tile:hover .status { color: var(--accent); }
a.status { align-self: flex-start; transition: color 0.25s ease; }
a.status:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ----------  CHESS REP APP ICON  ---------- */
.app-icon {
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 22%;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(20, 19, 15, 0.1);
}

/* ----------  MANIFESTO + SUPPORTING TEXT  ---------- */
.manifesto {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.045em;
  max-width: 13ch;
  text-wrap: balance;
}
.studio-text {
  margin: clamp(32px, 6vh, 64px) 0 0;
  max-width: 48ch;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}

/* ----------  CONTACT  ---------- */
.contact .label { display: block; margin-bottom: clamp(20px, 4vh, 40px); }
.big-mail {
  display: inline-block;
  font-size: clamp(2.4rem, 9vw, 7.5rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.95;
  position: relative;
}
.big-mail::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0.08em;
  width: 100%; height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(.2,.8,.2,1);
}
.big-mail:hover { color: var(--accent); }
.big-mail:hover::after { transform: scaleX(1); background: var(--accent); }
.contact-note {
  margin: clamp(24px, 4vh, 40px) 0 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----------  COLOPHON  ---------- */
.colophon {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--muted);
}
.col-c { text-align: center; flex: 1; }
.colophon span:last-child { text-align: right; }

/* ----------  MOTION  ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s cubic-bezier(.2,.8,.2,1),
              transform 0.8s cubic-bezier(.2,.8,.2,1);
}
.reveal.in { opacity: 1; transform: none; }
/* gentle stagger for the opening block */
.intro .reveal:nth-child(2) { transition-delay: 0.06s; }
.intro .reveal:nth-child(3) { transition-delay: 0.16s; }

/* ----------  RESPONSIVE  ---------- */
@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav { gap: 16px; }
}

/* phones: stack the hero lockup so the wordmark never overflows the viewport */
@media (max-width: 600px) {
  .build {
    justify-content: center;
    padding-left: var(--pad);
    padding-right: var(--pad);
  }
  .brand { flex-direction: column; gap: 0.3em; align-items: center; text-align: center; }
  .brand.centered { transform: none; }   /* CSS centering replaces the JS slide */
  .mark { width: clamp(110px, 32vw, 150px); height: clamp(110px, 32vw, 150px); }
  .logo-type {
    padding-left: 0;
    padding-bottom: 0.15em;
    margin-bottom: -0.15em;
    font-size: clamp(1.55rem, 7.5vw, 2.4rem);
  }
  .brand.to-mark .logo-type { max-width: 92vw; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fw-inner, .reveal, .big-mail::after { transition: none; }
  .reveal { opacity: 1; transform: none; }
  .cmd-caret { animation: none; }
  .spin, .grow { animation: none; transform: none; }
  .cmd { display: none; }
  .mark { opacity: 1; }
  .mark-axis, .lm-axis { animation: none; }
  .build { justify-content: center; padding-left: var(--pad); }
  .brand { transform: none; }
  .logo-type { max-width: 12em; opacity: 1; transition: none; }
}
