:root {
  --bg: #000;
  --surface: #0a0a0a;
  --surface-2: #141414;
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --border: #262626;
  --border-strong: #3a3a3a;
  --radius: 14px;
  --maxw: 760px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  word-wrap: break-word;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5rem 1.25rem 4rem;
}

a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
a:hover { opacity: 0.75; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---- Hero / bio ---- */
.hero { margin-bottom: 6rem; }

.bio {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 5.5rem;
}

.avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #555);
  display: grid; place-items: center;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 6px 24px rgba(255,255,255,0.08);
}
.avatar-link { display: inline-block; }

.bio-text h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.bio-text h1 a { color: inherit; text-decoration: none; }
.bio-text h1 a:hover { opacity: 0.8; }
.tagline {
  margin: 0.15rem 0 0;
  color: var(--text);
  font-size: 1rem;
}

/* ---- Extended bio (home) ---- */
.more-bio {
  margin: 0 0 5.5rem;
  color: var(--muted);
}
.more-bio ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}
.more-bio ul ul {
  margin: 0.35rem 0 0.35rem;
  padding-left: 1.25rem;
  list-style: circle;
}
.more-bio li {
  margin: 0 0 0.4rem;
}
.more-bio a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Animated collage (monochrome) ---- */
.collage {
  position: relative;
  width: 100%;
  height: 260px;
  margin: 0 0 1.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.04), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
}
.collage-compact { height: 180px; }

.tile {
  position: absolute;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  will-change: transform;
  filter: grayscale(100%);
}

.tile-1 {
  top: 8%; left: 6%;
  width: 110px; height: 140px;
  background: linear-gradient(135deg, #f5f5f5, #1a1a1a);
  animation: float1 9s ease-in-out infinite;
}
.tile-2 {
  top: 15%; left: 28%;
  width: 130px; height: 110px;
  background: linear-gradient(135deg, #202020, #9a9a9a);
  animation: float2 11s ease-in-out infinite;
}
.tile-3 {
  top: 5%; left: 52%;
  width: 100px; height: 120px;
  background: linear-gradient(135deg, #dcdcdc, #2a2a2a);
  animation: float3 10s ease-in-out infinite;
}
.tile-4 {
  top: 12%; left: 74%;
  width: 120px; height: 130px;
  background: linear-gradient(135deg, #3a3a3a, #e6e6e6);
  animation: float4 12s ease-in-out infinite;
}
.tile-5 {
  top: 48%; left: 10%;
  width: 140px; height: 100px;
  background: linear-gradient(135deg, #111, #bdbdbd);
  animation: float5 8.5s ease-in-out infinite;
}
.tile-6 {
  top: 52%; left: 38%;
  width: 110px; height: 120px;
  background: linear-gradient(135deg, #cfcfcf, #1f1f1f);
  animation: float6 10.5s ease-in-out infinite;
}
.tile-7 {
  top: 50%; left: 62%;
  width: 120px; height: 110px;
  background: linear-gradient(135deg, #4a4a4a, #f0f0f0);
  animation: float7 9.5s ease-in-out infinite;
}
.tile-8 {
  top: 40%; left: 82%;
  width: 90px; height: 140px;
  background: linear-gradient(135deg, #eaeaea, #2d2d2d);
  animation: float8 11.5s ease-in-out infinite;
}
.tile-9 {
  top: 72%; left: 44%;
  width: 130px; height: 80px;
  background: linear-gradient(135deg, #232323, #a8a8a8);
  animation: float9 13s ease-in-out infinite;
}

@keyframes float1 {
  0%,100% { transform: translate(0,0) rotate(-4deg); }
  50%     { transform: translate(14px,-10px) rotate(3deg); }
}
@keyframes float2 {
  0%,100% { transform: translate(0,0) rotate(2deg); }
  50%     { transform: translate(-12px,12px) rotate(-4deg); }
}
@keyframes float3 {
  0%,100% { transform: translate(0,0) rotate(-2deg); }
  50%     { transform: translate(10px,14px) rotate(5deg); }
}
@keyframes float4 {
  0%,100% { transform: translate(0,0) rotate(3deg); }
  50%     { transform: translate(-14px,-8px) rotate(-5deg); }
}
@keyframes float5 {
  0%,100% { transform: translate(0,0) rotate(-3deg); }
  50%     { transform: translate(12px,-12px) rotate(2deg); }
}
@keyframes float6 {
  0%,100% { transform: translate(0,0) rotate(4deg); }
  50%     { transform: translate(-10px,10px) rotate(-3deg); }
}
@keyframes float7 {
  0%,100% { transform: translate(0,0) rotate(-5deg); }
  50%     { transform: translate(14px,8px) rotate(4deg); }
}
@keyframes float8 {
  0%,100% { transform: translate(0,0) rotate(2deg); }
  50%     { transform: translate(-12px,-14px) rotate(-3deg); }
}
@keyframes float9 {
  0%,100% { transform: translate(0,0) rotate(-2deg); }
  50%     { transform: translate(10px,12px) rotate(5deg); }
}

@media (prefers-reduced-motion: reduce) {
  .tile { animation: none !important; }
}

/* ---- CTA (newsletter) ---- */
.cta {
  padding: 0;
  display: grid;
  gap: 1.5rem;
  text-align: left;
}
.cta-copy h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.cta-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}
.cta-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  max-width: 420px;
  width: 100%;
}
.cta-form input[type="email"] {
  flex: 1 1 240px;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.cta-form input[type="email"]::placeholder { color: var(--muted); }
.cta-form input[type="email"]:focus {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}
.cta-form button {
  padding: 1rem 1.75rem;
  border-radius: 10px;
  border: none;
  background: var(--text);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
}
.cta-form button:hover { transform: translateY(-1px); background: #fff; }
.cta-success {
  flex-basis: 100%;
  margin: 0.25rem 0 0;
  color: var(--text);
  font-size: 0.95rem;
}

/* ---- Feed ---- */
.feed-title {
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 1.25rem;
  font-weight: 700;
}
.feed-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.post-card {
  padding: 2rem 0;
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.post-card a,
.post-card iframe,
.post-card figure,
.post-card img { cursor: auto; }
.post-card:first-child { padding-top: 0; }
.post-card + .post-card {
  border-top: 1px solid var(--border-strong);
}
.post-card a.post-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.post-card:hover {
  opacity: 0.75;
}
.post-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
  letter-spacing: 0.02em;
}
.post-meta a { color: inherit; text-decoration: none; }
.post-meta a:hover { color: var(--text); }
.post-body p { margin: 0 0 1rem; }
.post-body p:last-child { margin-bottom: 0; }
.post-body p a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.md > *:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.md li { margin-bottom: 0.35rem; }
.md strong { font-weight: 700; }
.md em { font-style: italic; }
.md code {
  font-family: inherit;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.95em;
}
.md pre {
  background: var(--surface-2);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
}
.md pre code { background: transparent; padding: 0; }
.md blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
}
.md h2, .md h3 { margin: 1.5rem 0 0.75rem; letter-spacing: -0.01em; }
.md h2 { font-size: 1.35rem; }
.md h3 { font-size: 1.15rem; }
.md a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.md hr { border: 0; border-top: 1px solid var(--border-strong); margin: 1.5rem 0; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.95rem;
}
.pagination-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pagination-link:hover { opacity: 0.75; }
.pagination-info { text-align: center; flex: 1; }

/* ---- Single post ---- */
.post-full { margin-top: 1rem; }
.post-full .post-meta { margin-bottom: 1.5rem; font-size: 0.9rem; }
.post-full p { margin: 0 0 1rem; font-size: 1.35rem; line-height: 1.5; }
.post-full p a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.post-full .md ul, .post-full .md ol { font-size: 1.35rem; line-height: 1.5; }
.post-full .md li { font-size: 1.35rem; line-height: 1.5; margin-bottom: 0.5rem; }
.post-full .loading { color: var(--muted); }
.post-full .error { color: var(--text); }

.post-image {
  margin: 1.5rem 0;
}
.post-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.post-image figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.post-video {
  margin: 1.5rem 0;
}
.post-video video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
}
.post-video figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.admin-block video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #000;
  display: block;
}

.embed {
  margin: 1.5rem 0;
  max-width: 100%;
}
.embed-video {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.embed-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 0;
  display: block;
}

.embed-pdf {
  margin: 1.5rem 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  width: 100%;
  max-width: 100%;
}
.embed-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  gap: 1rem;
}
.embed-pdf-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.embed-pdf-dl {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.embed-pdf-frame {
  width: 1px;
  min-width: 100%;
  max-width: 100%;
  height: 70vh;
  max-height: 800px;
  border: 0;
  display: block;
  background: var(--bg);
}
.post-full .embed-pdf-header { font-size: 1.35rem; padding: 1rem 1.25rem; }

/* ---- Gallery (bio in pics) ---- */
.gallery-title {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 0 0 2rem;
  font-weight: 700;
}
.gallery {
  position: relative;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.gallery-item {
  margin: 0;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}
.gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border-strong);
  filter: grayscale(100%);
  transition: width 0.3s cubic-bezier(.2,.8,.2,1), filter 0.3s ease;
}
.gallery-item:hover { z-index: 30; }
.gallery-item:hover img {
  filter: none;
  width: var(--full-w, 100%);
  object-fit: cover;
}

.back-link { margin: 0 0 1.5rem; }

main > .cta {
  margin: 3rem 0;
  padding: 3rem 0;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}
main > .cta + .site-footer {
  margin-top: 0;
  border-top: none;
  padding-top: 1.5rem;
}

/* ---- Footer ---- */
.site-footer {
  margin-top: 6rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
}

/* ---- Admin ---- */
.admin-title {
  font-size: 1.8rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}
.admin-subtitle {
  color: var(--muted);
  margin: 0 0 2rem;
}
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-panel h2 {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.admin-field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.admin-field label {
  font-size: 0.85rem;
  color: var(--muted);
}
.admin-input,
.admin-textarea {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}
.admin-input:focus,
.admin-textarea:focus {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}
.admin-textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

.admin-blocks { display: grid; gap: 0.75rem; }
.admin-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--surface-2);
  display: grid;
  gap: 0.5rem;
}
.admin-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.admin-block-actions { display: flex; gap: 0.35rem; }
.admin-block img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.admin-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.admin-btn {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.admin-btn:hover { background: #1c1c1c; }
.admin-btn.primary { background: var(--text); color: #000; border-color: var(--text); font-weight: 700; }
.admin-btn.primary:hover { background: #fff; }
.admin-btn.danger { border-color: #555; color: var(--muted); }
.admin-btn.danger:hover { color: var(--text); }

.admin-status {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  min-height: 1.2em;
}
.admin-status.ok { color: var(--text); }
.admin-status.err { color: #ff8a8a; }

.admin-progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0 0;
  position: relative;
}
.admin-progress-bar {
  height: 100%;
  background: var(--text);
  width: 0%;
  transition: width 0.2s ease;
}
.admin-progress.indeterminate .admin-progress-bar {
  width: 40%;
  transition: none;
  animation: admin-progress-slide 1.4s ease-in-out infinite;
}
@keyframes admin-progress-slide {
  0%   { transform: translateX(-110%); }
  50%  { transform: translateX(160%); }
  100% { transform: translateX(-110%); }
}

.admin-lock {
  max-width: 420px;
  margin: 4rem auto;
  text-align: center;
}

.admin-thought-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}
.admin-thought-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.admin-thought-main {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  flex-wrap: wrap;
  min-width: 0;
}
.admin-thought-date {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.admin-thought-id,
.admin-thought-summary {
  color: var(--text);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-thought-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
  list-style: none;
}

/* ---- Responsive tweaks ---- */
@media (max-width: 520px) {
  .container { padding: 3rem 1rem 3rem; }
  .cta-form input[type="email"],
  .cta-form button { font-size: 1rem; padding: 0.9rem 1rem; }
  main > .cta { padding: 2rem 0; margin: 2rem 0; }
  .hero { margin-bottom: 3rem; }
  .bio { margin-bottom: 2.5rem; }
  .more-bio { margin-bottom: 2.5rem; }
  .site-footer { margin-top: 3rem; padding-top: 2rem; }
  .embed-pdf-frame { display: none; }
  .embed-pdf-header { border-bottom: none; }
}

.md img, .md iframe, .md video { max-width: 100%; height: auto; }

/* ---- Language toggle ---- */
.feed-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.post-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0.5rem 0 1rem;
}
.lang-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface-2);
}
.lang-btn {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.lang-btn.active {
  background: var(--text);
  color: #000;
}
.lang-fallback {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0 0 0.75rem;
}

/* ---- Admin language tabs ---- */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.admin-tab {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
}
.admin-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
