/* ==========================================================================
   heymartin.xyz — style.css
   Design tokens z "Website - struktura": barvy, typografie, layout
   ========================================================================== */

/* ---------- Fonts (self-hosted Geist Mono) ---------- */
@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/GeistMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/GeistMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --font: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* layout */
  --max-width: 592px;
  --page-pad-y: 100px;
  --page-pad-x: 24px;

  /* easing z Framer overrides */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

/* Dark theme (výchozí) */
:root,
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --headline: #fafafa;
  --body: #a3a3a3;
  --border: #262626;
  --border-hover: #363636;
  --hover: #181818;
  --logo-filter: none;
  color-scheme: dark;
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #fafafa;
  --headline: #0a0a0a;
  --body: #525252;
  --border: #e5e5e5;
  --border-hover: #d4d4d4;
  --hover: #f5f5f5;
  --logo-filter: brightness(0) opacity(0.85); /* loga jsou v #FAFAFA → v light módu tmavá */
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
  font: inherit;
}

ul {
  list-style: none;
}

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

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

button {
  font: inherit;
  color: inherit;
}

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

/* ---------- Typografie ---------- */
/* Headline: Regular 14/20 · Headline-small: Medium 12/16 · Body: 14/20 · Body-small: Medium 12/16 · Tag: Medium 10/16 */
.name,
.section-title,
.item-title {
  color: var(--headline);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
}

/* ---------- Layout ---------- */
.page {
  max-width: calc(var(--max-width) + var(--page-pad-x) * 2);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: -16px; /* 24px mezi fotkou a jménem (celkově 40 - 16) */
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Icons (SVG jako maska → barví se přes currentColor) ---------- */
.icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / auto no-repeat;
  mask: var(--icon) center / auto no-repeat;
}

.icon-arrow {
  --icon: url("assets/icons/arrow.svg");
}
.icon-x {
  --icon: url("assets/icons/x.svg");
}
.icon-threads {
  --icon: url("assets/icons/threads.svg");
}
.icon-instagram {
  --icon: url("assets/icons/instagram.svg");
}
.icon-letterboxd {
  --icon: url("assets/icons/letterboxd.svg");
}
.icon-copy {
  /* ikona kopírování pro mobil ("Tap [ikona] to copy my email.") */
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='4.5' width='6' height='6' rx='1.25'/%3E%3Cpath d='M7.5 2.75V2.5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.25'/%3E%3C/svg%3E");
}

/* ---------- Theme switch ---------- */
.theme-switch {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--body);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.2s ease;
}

.theme-switch:hover {
  border-color: var(--border-hover);
}

.icon-theme {
  width: 16px;
  height: 16px;
  -webkit-mask-size: 16px 16px;
  mask-size: 16px 16px;
  --icon: url("assets/icons/moon.svg");
}

:root[data-theme="light"] .icon-theme {
  --icon: url("assets/icons/sun.svg");
}

/* ---------- Intro ---------- */
.intro {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.name-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tagline,
.bio {
  color: var(--body);
}

.copy-hint {
  position: relative;
  margin-top: -12px; /* 12px pod bio */
  min-height: 20px;
}

.copy-line,
.copied-line {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: opacity 0.18s var(--ease-in);
}

.copied-line {
  position: absolute;
  inset: 0 auto auto 0;
  color: var(--headline);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s var(--ease-in);
}

.copy-hint.is-copied .copy-line {
  opacity: 0;
}

.copy-hint.is-copied .copied-line {
  opacity: 1;
  transition: opacity 0.22s var(--ease-out);
}

.kbd {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--body);
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.kbd:hover {
  border-color: var(--border-hover);
}

.kbd .icon {
  width: 12px;
  height: 12px;
}

/* desktop: "Press [C]" / dotyk: "Tap [ikona]" */
.when-touch {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .when-hover {
    display: none;
  }
  .when-touch {
    display: inline;
  }
  .icon.when-touch {
    display: inline-block;
  }
}

/* ---------- Sections ---------- */
.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- Ticker (Brands) ----------
   8 položek · gap 24px · směr doleva · okraje vyblednou (clipping 20 %) · hover = 0.5× */
.ticker {
  overflow: hidden;
  padding: 6px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20%, #000 80%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 20%, #000 80%, transparent 100%);
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 32s linear infinite;
  will-change: transform;
}

.ticker-set {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-right: 24px; /* stejná mezera i na spoji smyčky */
}

.ticker-set li {
  display: flex;
  align-items: center;
  flex: none;
}

.ticker-set img {
  width: auto;
  max-width: none;
  height: auto;
  filter: var(--logo-filter);
  transition: filter 0.2s ease;
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

/* ---------- Item (Selected Work, Writing, Last Played/Watched, Latest News) ---------- */
.item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: fit-content;
  max-width: 100%;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 24px;
}

.item-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex: none;
  transition: border-color 0.18s ease;
}

/* ikona + indikátor tvoří skupinu s gapem 4px; indikátor visí vlevo mimo sloupec */
.indicator {
  position: absolute;
  left: -6px; /* 2px šířka + 4px gap */
  top: 0;
  width: 2px;
  height: 24px;
  background: var(--headline);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: opacity 0.18s var(--ease-in), transform 0.18s var(--ease-in);
}

/* headline + šipka: gap 4px */
.item-title {
  margin-left: 24px; /* [indikátor + ikona] → [headline + šipka] */
}

.item-row .icon-arrow {
  margin-left: 4px; /* headline → šipka */
  color: var(--headline);
}

/* description se rozbalí (height 0 → auto) pomocí grid trick */
.item-desc-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-left: 48px; /* zarovnáno s headlinem */
  transition: grid-template-rows 0.18s var(--ease-in), opacity 0.18s var(--ease-in);
}

.item-desc {
  display: block;
  overflow: hidden;
  min-height: 0;
  max-width: 480px;
  padding-top: 0;
  color: var(--body);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.item-desc::before {
  content: "";
  display: block;
  height: 4px; /* row1 → row2 gap */
}

@media (hover: hover) {
  .item:hover .indicator,
  .item:focus-visible .indicator {
    opacity: 1;
    transform: scaleX(1);
    transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out);
  }

  .item:hover .item-desc-wrap,
  .item:focus-visible .item-desc-wrap {
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 0.3s var(--ease-out) 0.03s, opacity 0.3s var(--ease-out) 0.03s;
  }
}

/* ---------- Stack ---------- */
.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stack-item {
  position: relative;
  width: 24px;
  height: 24px;
}

.stack-item img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  transition: border-color 0.18s ease;
}

.stack-item:hover img,
.stack-item:focus-visible img {
  border-color: var(--border-hover);
}

.tooltip {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  z-index: 10;
  padding: 4px 8px;
  background: var(--hover);
  border-radius: 4px;
  color: var(--headline);
  font-size: 10px;
  line-height: 16px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -2px);
  transition: opacity 0.15s ease, transform 0.15s var(--ease-out);
}

/* výřez (šipka) nahoru */
.tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-width: 0;
  border-bottom-color: var(--hover);
}

.stack-item:hover .tooltip,
.stack-item:focus-visible .tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Links (Elsewhere) ---------- */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--body);
  transition: color 0.18s ease;
}

.link:hover,
.link:focus-visible {
  color: var(--headline);
}

/* ---------- Footer ---------- */
.footer {
  color: var(--body);
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  :root {
    --page-pad-y: 40px;
  }

  .links {
    flex-direction: column;
    gap: 12px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  .ticker-track {
    animation: none;
  }
}
