/* ==========================================================
   fabianstranger.com
   ========================================================== */

/* ---------- Fonts (self-hosted, no Google connection) ---------- */
@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/outfit-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/geist-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* Fabian's own handwriting. Only A-Z / a-z, so it is always set in caps. */
@font-face {
  font-family: "Nofont";
  src: url("/assets/fonts/nofont.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #000;
  --fg: #fff;
  --fg-2: rgb(255 255 255 / 0.62);
  --fg-3: rgb(255 255 255 / 0.4);
  --card: rgb(18 18 18 / 0.78);
  --card-hover: rgb(26 26 26 / 0.9);
  --border: rgb(255 255 255 / 0.08);
  --border-hover: rgb(255 255 255 / 0.18);
  --line: rgb(255 255 255 / 0.14);
  --tip-bg: #141414;
  --shadow: rgb(0 0 0 / 0.95);
  --ink-accent: #f1d6c2;
  --grain-blend: screen;
  --grain-opacity: 0.07;

  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Nofont", "Outfit", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: dark;
}

/* Light by day, dark by night – following the sun over Salzburg (set in <head>) */
:root[data-theme="light"] {
  --bg: #f2f0ea;
  --fg: #151513;
  --fg-2: rgb(21 21 19 / 0.66);
  --fg-3: rgb(21 21 19 / 0.45);
  --border: rgb(21 21 19 / 0.1);
  --border-hover: rgb(21 21 19 / 0.2);
  --line: rgb(21 21 19 / 0.16);
  --tip-bg: #fbfaf7;
  --shadow: rgb(242 240 234 / 0.95);
  --ink-accent: #9a5a35;
  --grain-blend: multiply;
  --grain-opacity: 0.3;
  color-scheme: light;
}

:root[data-theme="light"] .il-ico--np img {
  filter: invert(1);
}

:root[data-theme="light"] .hello-dot {
  filter: brightness(0.7) saturate(1.6);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 1.2s var(--ease), color 1.2s var(--ease);
}

a {
  color: inherit;
}

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

::selection {
  background: var(--fg);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Both languages live side by side in the HTML */
:root:not([data-ui="de"]) [data-lang="de"],
:root[data-ui="de"] [data-lang="en"] {
  display: none !important;
}

/* ---------- Background layers ---------- */
#dots {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
}

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

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

.top,
main,
.foot {
  position: relative;
  z-index: 1;
}

/* ---------- Intro (first visit per session) ---------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  place-items: center;
  pointer-events: none;
}

.is-intro #intro {
  display: grid;
}

.intro-line {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  letter-spacing: 0.02em;
  color: var(--fg);
  text-shadow: 0 0 24px var(--shadow), 0 0 8px var(--shadow);
  transition: opacity 1s var(--ease), filter 1s var(--ease);
}

.intro-text {
  white-space: pre;
}

.intro-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  margin-left: 0.12em;
  background: var(--fg);
  animation: cursor 1.1s steps(1) infinite;
}

@keyframes cursor {
  50% { opacity: 0; }
}

#intro.settle .intro-line {
  opacity: 0;
  filter: blur(6px);
}

.intro-skip {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

#intro.gone {
  opacity: 0;
  transition: opacity 1s var(--ease);
}

/* ---------- Reveal system ---------- */
.js:not(.ready) .rv,
.js:not(.ready) .w {
  opacity: 0;
}

.ready .rv {
  animation: rise 1s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 1ms);
}

.w {
  display: inline-block;
}

.ready .w {
  animation: wordIn 0.9s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 1ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@keyframes wordIn {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(0.4em);
  }
}

/* ---------- Header ---------- */
.top {
  display: flex;
  justify-content: center;
  padding: 18px 16px 0;
  min-height: 56px;
}

.lang {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-3);
  z-index: 4;
}

.lang button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px 4px;
  background: transparent;
  color: var(--fg-3);
  font: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s;
}

.lang button:hover {
  color: var(--fg-2);
}

.lang button[aria-pressed="true"] {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

/* Greeting with city + weather */
.hello {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 30rem;
  margin: 0;
  padding: 0 72px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--fg-2);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.hello[hidden] {
  display: none;
}

.ready .hello.show {
  opacity: 1;
  transform: none;
}

.hello b {
  font-weight: 500;
  color: var(--fg);
}

.hello a {
  color: var(--fg);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.hello-dot {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  --c: #9aa0a6;
}

.hello-dot::before,
.hello-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c) 0 34%, transparent 70%);
}

.hello-dot::after {
  filter: blur(5px);
  animation: breathe 3.2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.35); opacity: 1; }
}

/* ---------- Main ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.hero {
  text-align: center;
  padding-top: clamp(40px, 8vh, 88px);
}

/* Portrait with rotating ring */
.avatar {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto clamp(24px, 4vh, 36px);
}

.avatar-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: spin 28s linear infinite;
}

.avatar-ring text {
  fill: var(--fg-3);
  font: 500 9.5px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.avatar-img {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  box-shadow: 0 0 0 1px var(--border);
  transition: transform 0.6s var(--spring);
}

.avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 40%;
}

.avatar:hover .avatar-img {
  transform: scale(1.06) rotate(-3deg);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Headline */
.headline {
  max-width: 14.5em;
  margin: 0 auto;
  font-size: clamp(2.1rem, 3.8vw, 3.25rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* Handwritten words (Fabian's own font) */
.hand {
  position: relative;
  /* Nofont draws its letters ~0.115em above the baseline – put them back on it */
  top: 0.115em;
  font-family: var(--hand);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* punctuation inside handwriting falls back to Outfit, which already sits on the baseline */
.hand .punct {
  position: relative;
  top: -0.115em;
}

.hello-word {
  display: inline-block;
  font-size: 1.12em;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
}

.k {
  display: inline-block;
  font-size: 0.92em;
  line-height: 0.9;
  cursor: default;
}


.k-real {
  margin-right: -0.08em;
}



/* "Servus" tooltip */
.tip {
  position: relative;
  cursor: help;
}

.tip-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 6px);
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font: 500 13px/1.3 var(--sans);
  letter-spacing: 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s var(--ease);
  z-index: 5;
}

.tip-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--fg);
}

.tip:hover .tip-bubble,
.tip:focus-visible .tip-bubble {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Bio */
.bio {
  max-width: 33rem;
  margin: clamp(28px, 4.5vh, 44px) auto 0;
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  font-weight: 400;
  line-height: 1.6;
  color: var(--fg-2);
  text-wrap: pretty;
}

.bio em {
  position: relative;
  top: 0.115em;
  font-family: var(--hand);
  font-style: normal;
  text-transform: uppercase;
  font-size: 1.02em;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--fg);
}

/* Inline link with icon + hover preview */
.il {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.il-ico {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  flex-shrink: 0;
  transition: transform 0.4s var(--spring);
}

.il-ico svg {
  width: 18px;
  height: 18px;
}

.il-ico img {
  width: 14px;
  height: 14px;
}

.il-ico--yt { color: #ff5a67; }
.il-ico--ig { color: #f0719a; }

.il:hover .il-ico {
  transform: rotate(-10deg) scale(1.15);
}

.il-text {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease);
}

.il:hover .il-text {
  background-size: 100% 1px;
}

.il-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translate(-50%, 6px) scale(0.96);
  padding: 7px 11px;
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  background: var(--tip-bg);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.3s var(--ease);
  z-index: 5;
}

.il:hover .il-tip,
.il:focus-visible .il-tip {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- Links (the link-in-bio part): a plain, typographic list ---------- */
.links {
  max-width: 30rem;
  margin: clamp(44px, 7vh, 72px) auto 0;
  border-top: 1px solid var(--line);
}

.js:not(.ready) .links {
  opacity: 0;
}

.ready .links {
  animation: fadeIn 1s var(--ease) 1s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 2rem 1fr auto 16px;
  align-items: baseline;
  gap: 12px;
  padding: 19px 2px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.3s;
}

.row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}

.row-idx {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  transition: color 0.3s;
}

.row-title {
  min-width: 0;
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.5s var(--ease);
}

.row-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-3);
  white-space: nowrap;
  transition: color 0.3s;
}

.row-new {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff5a5a;
  animation: blink 2.4s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: 0.25; }
}

.row-arrow {
  width: 15px;
  height: 15px;
  align-self: center;
  color: var(--fg-3);
  transition: transform 0.45s var(--ease), color 0.3s;
}

.row-preview {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  width: 172px;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  scale: 0.92;
  transition: opacity 0.25s, scale 0.35s var(--ease);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.6);
}

.row-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (hover: hover) {
  .row:hover::after {
    transform: scaleX(1);
  }
  .row:hover .row-idx,
  .row:hover .row-meta {
    color: var(--fg-2);
  }
  .row:hover .row-arrow {
    color: var(--fg);
    transform: translate(2px, -2px);
  }
  .row:hover .row-preview {
    opacity: 1;
    scale: 1;
  }
}

@media (hover: none) {
  .row-preview {
    display: none;
  }
}


/* ---------- Footer ---------- */
.foot {
  padding: clamp(64px, 12vh, 120px) 16px max(28px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13.5px;
  color: var(--fg-3);
}

.foot p {
  margin: 0;
}

.foot .based {
  margin-bottom: 8px;
  color: var(--fg-2);
}

.foot .daynote {
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-3);
}

:root:not([data-theme="light"]) .dn-day,
:root[data-theme="light"] .dn-night {
  display: none;
}

.foot .based time {
  font-variant-numeric: tabular-nums;
}

.foot .bar {
  margin: 0 6px;
  color: var(--fg-3);
}

.foot a {
  text-decoration: none;
  transition: color 0.2s;
}

.foot a:hover {
  color: var(--fg);
}

.foot .sep {
  margin: 0 7px;
}

/* ---------- Legal pages ---------- */
.legal {
  max-width: 38rem;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 96px) 0 0;
}

.legal h1 {
  margin: 0 0 clamp(28px, 5vh, 48px);
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.legal h1 em {
  font-family: var(--hand);
  font-style: normal;
  font-weight: 400;
  text-transform: uppercase;
}

/* ---------- Sign-off (handwritten signature) ---------- */
.signoff {
  margin: clamp(56px, 9vh, 96px) auto 0;
  text-align: center;
  color: var(--fg-2);
  font-size: 15px;
}

.signoff p {
  margin: 0 0 6px;
}

.signature {
  display: inline-block;
  font-family: var(--hand);
  font-size: clamp(2.1rem, 4vw, 2.75rem);
  line-height: 1;
  color: var(--fg);
  padding: 0 0.1em 0.08em;
  clip-path: inset(0 100% 0 0);
}

.signature.write {
  animation: write 1.6s cubic-bezier(0.55, 0.1, 0.35, 1) forwards;
}

@keyframes write {
  to { clip-path: inset(0 0 0 0); }
}

.legal h2 {
  margin: 32px 0 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--fg-3);
}

.legal p,
.legal li {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg-2);
}

.legal a {
  color: var(--fg);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.back {
  display: inline-block;
  margin-top: 36px;
  color: var(--fg-2);
  text-decoration: none;
}

.back:hover {
  color: var(--fg);
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .top {
    padding-top: 56px;
  }
  .hello {
    padding: 0 4px;
    font-size: 13.5px;
  }
  .hero {
    padding-top: 28px;
  }
  .avatar {
    width: 128px;
    height: 128px;
  }
  .avatar-img {
    inset: 26px;
  }
  .row {
    grid-template-columns: 1.6rem 1fr auto 14px;
    gap: 10px;
    padding: 18px 0 17px;
  }
  .row-title {
    font-size: 18px;
  }
  .lang {
    top: 10px;
    right: 10px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain,
  .avatar-ring,
  .hello-dot::after,
  .row-new,
  .intro-cursor {
    animation: none;
  }
  .ready .rv,
  .ready .w {
    animation: none;
  }
  .signature {
    clip-path: none;
  }
}
