/* engineericly — link-in-bio grid */

:root {
  --bg: #121412;
  --surface: #1b1e1c;
  --tile: #1b1e1c;
  --tile-empty: #191c1a;
  --tile-empty-2: #1e2220;
  --line: #2a2f2c;
  --text: #edefea;
  --text-soft: #c9cfcb;
  --muted: #a3aba6;
  --faint: #7d857f;
  --accent: #3db58f;
  --accent-hover: #52c9a2;
  --accent-text: #3db58f;
  --gold: #e3a72f;
  --on-accent: #0b1410;
  --bar-bg: rgba(18, 20, 18, 0.86);
  --scrim: rgba(0, 0, 0, 0.62);
  --handle: #3a403c;
  color-scheme: dark;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light palette: used when the phone is in light mode, or when picked with the toggle */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7f4;
    --surface: #ffffff;
    --tile: #e9ece8;
    --tile-empty: #eceee9;
    --tile-empty-2: #e3e6e1;
    --line: #e2e5e1;
    --text: #141614;
    --text-soft: #343a36;
    --muted: #5b635e;
    --faint: #6f7772;
    --accent-text: #1f8a68;
    --gold: #9a6508;
    --bar-bg: rgba(246, 247, 244, 0.86);
    --scrim: rgba(0, 0, 0, 0.45);
    --handle: #cfd4cf;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --tile: #e9ece8;
  --tile-empty: #eceee9;
  --tile-empty-2: #e3e6e1;
  --line: #e2e5e1;
  --text: #141614;
  --text-soft: #343a36;
  --muted: #5b635e;
  --faint: #6f7772;
  --accent-text: #1f8a68;
  --gold: #9a6508;
  --bar-bg: rgba(246, 247, 244, 0.86);
  --scrim: rgba(0, 0, 0, 0.45);
  --handle: #cfd4cf;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.is-locked {
  overflow: hidden;
}

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

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

button {
  font: inherit;
  color: inherit;
}

.page {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Shared bits ---------- */

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.text-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s ease;
}

.text-link:hover {
  color: var(--text);
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.3s var(--ease-out);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn:active {
  transform: scale(0.9);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}

/* Show the icon of the mode you would switch to */
.theme-toggle .icon-moon {
  display: none;
}
:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme]) .theme-toggle .icon-moon {
    display: block;
  }
}
.theme-toggle:hover svg {
  transform: rotate(-20deg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Compact bar (appears after scrolling past the header) ---------- */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}

.bar.is-on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.bar-inner {
  max-width: 600px;
  height: 56px;
  margin: 0 auto;
  padding: 0 8px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-inner img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.bar-inner .wordmark {
  flex-grow: 1;
  font-size: 17px;
}

/* ---------- Profile header ---------- */

.profile {
  padding: 28px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform-origin: top left;
  will-change: opacity, transform;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.5s var(--ease-out);
}

.avatar:hover {
  transform: rotate(-8deg) scale(1.05);
}

.profile-name {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-name .wordmark {
  margin: 0;
  font-size: 22px;
}

.handle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  align-items: center;
}

.tagline {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-soft);
}

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 0;
  background: var(--tile);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* reveal uses opacity + translate; press uses transform, so they never fight */
  opacity: 0;
  translate: 0 24px;
  transition: opacity 0.6s var(--ease-out), translate 0.6s var(--ease-out), transform 0.2s ease;
  transition-delay: var(--delay, 0s), var(--delay, 0s), 0s;
}

.tile.is-in {
  opacity: 1;
  translate: 0 0;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out), filter 0.3s ease;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
}

.tile-pin {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.tile-go {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px) scale(0.8);
  transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}

@media (hover: hover) {
  .tile:hover img {
    transform: scale(1.07);
    filter: saturate(1.15);
  }
  .tile:hover::after {
    background: rgba(0, 0, 0, 0.22);
  }
  .tile:hover .tile-go {
    opacity: 1;
    transform: none;
  }
}

.tile:active {
  transform: scale(0.96);
}

.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.tile:focus-visible .tile-go {
  opacity: 1;
  transform: none;
}

.tile-skeleton {
  aspect-ratio: 9 / 16;
  background: var(--tile-empty);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    background: var(--tile-empty-2);
  }
}

.feed-status {
  padding: 40px 16px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}

.feed-status button {
  margin-top: 12px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

.sentinel {
  height: 1px;
}

.page-footer {
  padding: 28px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.socials {
  display: flex;
  gap: 8px;
}

.social {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.3s var(--ease-out);
}

.social:hover {
  color: var(--text);
  border-color: var(--muted);
  transform: translateY(-2px);
}

/* ---------- Sheet ---------- */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.sheet-layer[hidden] {
  display: none;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: var(--scrim);
  cursor: pointer;
  animation: fade-in 0.3s ease both;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: sheet-up 0.45s var(--ease-out) both;
  touch-action: none;
}

.sheet.is-dragging {
  animation: none;
  transition: none;
}

.sheet-handle {
  align-self: center;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--handle);
}

.sheet-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.sheet-thumb {
  width: 90px;
  height: 160px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tile);
  animation: pop-in 0.5s 0.08s var(--ease-out) both;
}

.sheet-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  min-width: 0;
}

.sheet-host {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.sheet-layer.is-closing .sheet-scrim {
  animation: fade-out 0.22s ease both;
}

.sheet-layer.is-closing .sheet {
  animation: sheet-down 0.22s ease-in both;
}

@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes fade-out {
  to { opacity: 0; }
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
}
@keyframes sheet-down {
  to { transform: translateY(100%); }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9) rotate(-2deg);
  }
}

.cta {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.3s ease;
}

.cta svg {
  transition: transform 0.3s var(--ease-out);
}

.cta:hover {
  background: var(--accent-hover);
  box-shadow: 0 8px 28px rgba(61, 181, 143, 0.35);
}

.cta:hover svg {
  transform: translateX(4px);
}

.cta:active {
  transform: scale(0.98);
}

/* ---------- About page ---------- */

.about-top {
  height: 64px;
  padding: 0 8px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.about-top-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.about-top-right img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.about-section {
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.6s var(--ease-out), translate 0.6s var(--ease-out);
}

/* Only hide for the reveal when JS is running, so the page never stays blank */
.js .about-section:not(.is-in) {
  opacity: 0;
  translate: 0 24px;
}

.about-section.is-in {
  opacity: 1;
  translate: 0 0;
}

.about-intro {
  padding-top: 32px;
  gap: 14px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.about-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.lede {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}

.about-section h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.stat {
  background: var(--surface);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: var(--accent-text);
}

.stat-value.is-gold {
  color: var(--gold);
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.series {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform 0.3s var(--ease-out), border-color 0.2s ease;
}

.series:hover {
  transform: translateX(4px);
  border-color: var(--accent);
}

.series-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-text);
  padding-top: 2px;
}

.series-title {
  font-weight: 600;
  font-size: 16px;
}

.series-desc {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.founder {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.founder > img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.founder-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.founder-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.founder-role {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.founder-bio {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-soft);
}

.about-page .page-footer {
  border-top: 1px solid var(--line);
}

/* ---------- Motion preferences ---------- */

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