/* imslimism.com — Slim Saelim
   Nocturnal Editorial: a magazine about cybernetics, read by lamplight */

/* ============================================
   Tokens
   ============================================ */

:root {
  --bg: #0e0e12;
  --bg-warm: #121216;
  --bg-surface: #17171c;
  --bg-raised: #1e1e25;
  --border: #28282f;
  --border-glow: #333340;
  --text: #bbbbc8;
  --text-bright: #e8e8f0;
  --text-dim: #72727f;
  --accent: #d4ad4e;
  --accent-dim: #9a7e3a;
  --accent-glow: rgba(201, 162, 67, 0.08);
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --mono: 'JetBrains Mono', 'Menlo', monospace;
  --max-width: 760px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================
   Reset
   ============================================ */

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Film grain — Lipsett */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
  pointer-events: none;
  z-index: 9999;
}

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

/* ============================================
   Typography
   ============================================ */

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--text-bright);
  font-weight: 400;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease), opacity 0.2s var(--ease);
}

a:hover {
  color: var(--text-bright);
}

strong {
  color: var(--text-bright);
  font-weight: 700;
}

em {
  font-style: italic;
  color: var(--text-bright);
}

/* ============================================
   Entrance animations
   ============================================ */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes lineGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.hero,
.section {
  animation: fadeUp 0.8s var(--ease) both;
}

.hero { animation-delay: 0.1s; }
#work { animation-delay: 0.15s; }
#writing { animation-delay: 0.2s; }
#thesis { animation-delay: 0.25s; }
#workshop { animation-delay: 0.3s; }
#connect { animation-delay: 0.35s; }

/* ============================================
   Layout
   ============================================ */

.site {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============================================
   Hero
   ============================================ */

.hero {
  padding: 6rem 0 4.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero-portrait {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  animation: fadeIn 2.5s var(--ease) 0.3s both;
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.55;
  filter: saturate(0.5) brightness(0.8);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.name {
  font-family: var(--serif);
  font-size: 3.6rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hook {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--text);
  max-width: 520px;
  margin-bottom: 1.25rem;
  line-height: 1.55;
  letter-spacing: 0.005em;
}

.identity {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 2.5rem;
}

.nav {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.nav a {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--mono);
  position: relative;
  padding-bottom: 2px;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.nav a:hover {
  color: var(--accent);
}

.nav a:hover::after {
  width: 100%;
}

/* ============================================
   Sections
   ============================================ */

.section {
  padding: 5rem 0;
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-dim);
  margin-bottom: 1.25rem;
  font-weight: 400;
}

.section-intro {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--text);
  max-width: 540px;
  margin-bottom: 3rem;
  line-height: 1.6;
  letter-spacing: 0.005em;
}

.section-coda {
  margin-top: 3rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--text-dim);
  font-style: italic;
  letter-spacing: 0.01em;
}

.section-link {
  display: inline-block;
  margin-top: 1.75rem;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

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

.empty-state {
  color: var(--text-dim);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
}

/* ============================================
   Story
   ============================================ */

.story-text {
  max-width: 600px;
}

.story-text p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.story-text p:last-child {
  margin-bottom: 0;
}

.story-text em {
  color: var(--accent);
  font-style: italic;
}

/* ============================================
   Now
   ============================================ */

.now-updated {
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2rem;
}

.now-list {
  list-style: none;
  padding: 0;
  max-width: 600px;
}

.now-list li {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding-left: 1.25rem;
}

.now-list li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--accent-dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  top: 0.85rem;
}

.now-list li:last-child {
  border-bottom: none;
}

/* ============================================
   Projects
   ============================================ */

.projects {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project {
  padding: 2rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  position: relative;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.project::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.3s var(--ease);
}

.project:hover {
  border-color: var(--border-glow);
  box-shadow:
    0 0 0 1px var(--border-glow),
    0 4px 24px -4px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.project-image {
  width: calc(100% + 4rem);
  height: 200px;
  overflow: hidden;
  margin: -2rem -2rem 1.5rem -2rem;
  position: relative;
}

.project-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  background: linear-gradient(to top, var(--bg-surface) 5%, transparent);
  pointer-events: none;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: saturate(0.65) brightness(0.8);
  transition: filter 0.5s var(--ease), transform 0.5s var(--ease);
}

.project:hover .project-image img {
  filter: saturate(0.9) brightness(0.95);
  transform: scale(1.03);
}

/* Subtle top-edge glow on hover */
.project::after {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.project:hover::after {
  opacity: 1;
}

.project-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.project-name {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.project-tagline {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--accent-dim);
  font-style: italic;
}

.project-description {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 1.25rem;
  max-width: 580px;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.project-stack {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-link {
  font-size: 0.7rem;
  color: var(--accent-dim);
  letter-spacing: 0.02em;
}

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

/* Project card overflow for images */
.project {
  overflow: hidden;
}

/* ============================================
   Writing (Homepage)
   ============================================ */

.writing-list-home {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.writing-item {
  display: block;
  padding: 1.5rem 2rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.writing-item:hover {
  border-color: var(--border-glow);
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.4);
  color: var(--text);
}

.writing-item time {
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.writing-item h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0.5rem 0 0.4rem;
  color: var(--text-bright);
  font-weight: 500;
}

.writing-item p {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

/* ============================================
   Thesis
   ============================================ */

.thesis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

@media (max-width: 640px) {
  .thesis-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

.thesis-column h3 {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-dim);
  margin-bottom: 1.25rem;
  font-weight: 400;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.thesis-points {
  list-style: none;
  padding-left: 0;
  counter-reset: thesis;
}

.thesis-points li {
  counter-increment: thesis;
  font-family: var(--serif);
  font-size: 1rem;
  margin-bottom: 0.85rem;
  color: var(--text);
  line-height: 1.55;
  padding-left: 1.75rem;
  position: relative;
}

.thesis-points li::before {
  content: counter(thesis);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--accent-dim);
  letter-spacing: 0.05em;
}

.ingredients {
  list-style: none;
  padding-left: 0;
}

.ingredients li {
  font-family: var(--serif);
  font-size: 1rem;
  margin-bottom: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}

.ingredients li strong {
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.thesis-coda {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text);
  border-left: 2px solid var(--accent-dim);
  padding: 1.5rem 0 1.5rem 2rem;
  font-style: italic;
  background: linear-gradient(90deg, var(--accent-glow), transparent 60%);
  position: relative;
}

.influences {
  color: var(--text-dim);
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 2;
  letter-spacing: 0.01em;
}

/* ============================================
   Footer / Connect
   ============================================ */

.footer {
  border-bottom: none;
  padding-bottom: 6rem;
}

.connect-links {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.connect-links a {
  font-size: 0.8rem;
  font-family: var(--mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
}

.connect-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.connect-links a:hover {
  color: var(--accent);
}

.connect-links a:hover::after {
  width: 100%;
}

.connect-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 640px) {
  .connect-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.connect-influences h3 {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-dim);
  margin-bottom: 0.75rem;
  font-weight: 400;
}

.footer-note {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text-dim);
  font-style: italic;
  letter-spacing: 0.01em;
}

/* ============================================
   Writing Pages (Base.astro / Post.astro)
   ============================================ */

.writing-page {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.writing-page-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem 8rem;
}

.back-link {
  display: inline-block;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-dim);
  margin-bottom: 2.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.writing-header {
  margin-bottom: 3rem;
}

.writing-header h1 {
  font-family: var(--serif);
  font-size: 2.2rem;
  color: var(--text-bright);
  font-weight: 500;
}

/* Writing list page */

.writing-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.writing-card {
  display: block;
  padding: 1.5rem 2rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.writing-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.4);
}

.card-date {
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--text-bright);
  margin: 0.5rem 0 0.4rem;
  font-weight: 500;
}

.card-description {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

.card-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.6rem;
  font-family: var(--mono);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Post detail page */

.post-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem 8rem;
}

.post-header {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header time {
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-title {
  font-family: var(--serif);
  font-size: 2.4rem;
  margin: 1rem 0 0.75rem;
  color: var(--text-bright);
  letter-spacing: -0.015em;
  line-height: 1.2;
  font-weight: 500;
}

.post-description {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.6;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* Prose — essay body */

.prose {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text);
}

.prose h2 {
  font-size: 1.6rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text-bright);
  font-weight: 500;
}

.prose h3 {
  font-size: 1.2rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-bright);
  font-weight: 500;
}

.prose p {
  margin-bottom: 1.35rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-dim);
}

.prose a:hover {
  color: var(--text-bright);
  text-decoration-color: var(--text-bright);
}

.prose blockquote {
  border-left: 2px solid var(--accent-dim);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 1.75rem 0;
  color: var(--text);
  font-style: italic;
  background: linear-gradient(90deg, var(--accent-glow), transparent 50%);
}

.prose ul, .prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1.35rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.75rem 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
}

.prose code {
  background: var(--bg-surface);
  padding: 0.15rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.8em;
  border: 1px solid var(--border);
}

.prose pre code {
  background: none;
  padding: 0;
  border: none;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.prose img {
  max-width: 100%;
  margin: 2rem 0;
}

.prose strong {
  color: var(--text-bright);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .site {
    padding: 0 1.25rem;
  }

  .hero {
    padding: 4rem 0 3rem;
    min-height: 70vh;
  }

  .name {
    font-size: 2.4rem;
  }

  .hook {
    font-size: 1.1rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  .section-intro {
    font-size: 1.05rem;
  }

  .project {
    padding: 1.5rem;
  }

  .project-image {
    height: 140px;
    margin: -1.5rem -1.5rem 1.25rem -1.5rem;
    width: calc(100% + 3rem);
  }

  .project-name {
    font-size: 1.3rem;
  }

  .hero-portrait {
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.35) 0%, transparent 80%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.35) 0%, transparent 80%);
  }

  .nav {
    gap: 1.25rem;
  }

  .post-title {
    font-size: 1.8rem;
  }

  .thesis-coda {
    padding-left: 1.25rem;
  }
}
