/* Root variables describe the palette and spacing system */
:root {
  --card-bg: #fefdf9;
  --accent: #0f172a;
  --muted: #6b7280;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 40px 80px rgba(15, 23, 42, 0.18);
}

/* Global reset ensures consistent layout across devices */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Body styling establishes the off-white background and typography */
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12), rgba(8, 15, 27, 0)),
    linear-gradient(180deg, #0b1521 0%, #060b14 100%);
  color: var(--accent);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow-x: hidden;
}

body.scroll-locked,
html.scroll-locked {
  overflow: hidden;
  height: 100vh;
}

/* Shell centers the hero card while leaving breathing room for the CTA */
.shell {
  --shell-light-x: 50%;
  --shell-light-y: 20%;
  --shell-light-strength: 0.45;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  padding: 6rem 0 6rem;
  position: relative;
  background: transparent;
  transition: background 250ms ease;
}

.shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
      circle at var(--shell-light-x) var(--shell-light-y),
      rgba(255, 255, 255, var(--shell-light-strength)),
      rgba(6, 14, 26, 0) 65%
    );
  transition:
    background-position 200ms ease,
    background-size 200ms ease,
    opacity 200ms ease;
  pointer-events: none;
  z-index: 0;
}

.shell > * {
  position: relative;
  z-index: 1;
}

/* Card stage establishes the 3D context for tilt interactions */
.card-stage {
  width: min(720px, 92vw);
  aspect-ratio: 3.5 / 2;
  perspective: 1600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Business card styling combines texture, shadow, and layout */
.business-card {
  --gloss-x: 25%;
  --gloss-y: 18%;
  --shadow-strength: 0.22;
  --texture-depth: 0.5;
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(1.5rem, 3vw, 2.75rem) clamp(1.75rem, 3.2vw, 3rem);
  background-color: var(--card-bg);
  background-image: linear-gradient(130deg, rgba(255, 255, 255, 0.85), rgba(235, 229, 210, 0.35)),
    url('./assets/textures/eggshell-texture.svg'),
    url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"160\" height=\"160\" viewBox=\"0 0 160 160\"%3E%3Crect width=\"160\" height=\"160\" fill=\"none\"/%3E%3Ccircle cx=\"18\" cy=\"30\" r=\"1.4\" fill=\"%23c9baa1\" opacity=\"0.35\"/%3E%3Ccircle cx=\"88\" cy=\"20\" r=\"0.9\" fill=\"%23dcd0b8\" opacity=\"0.3\"/%3E%3Ccircle cx=\"140\" cy=\"70\" r=\"1.2\" fill=\"%23d4c6ae\" opacity=\"0.25\"/%3E%3Ccircle cx=\"52\" cy=\"110\" r=\"0.8\" fill=\"%23bfae94\" opacity=\"0.32\"/%3E%3Ccircle cx=\"22\" cy=\"135\" r=\"1\" fill=\"%23cab69c\" opacity=\"0.26\"/%3E%3Ccircle cx=\"120\" cy=\"140\" r=\"0.9\" fill=\"%23c3b097\" opacity=\"0.28\"/%3E%3C/svg%3E');
  background-size: 180% 180%, 320px 320px, 160px 160px;
  background-repeat: no-repeat, repeat, repeat;
  background-blend-mode: soft-light, multiply, multiply;
  background-position: top, center, center;
  border-radius: 12px;
  border: 1px solid rgba(106, 91, 63, 0.12);
  box-shadow: 0 35px 60px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transform: scale(0.92);
  transform-origin: center;
  transform-style: preserve-3d;
  transition:
    transform 300ms ease,
    box-shadow 200ms ease;
  will-change: transform;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* Texture overlay mimics eggshell paper using subtle noise */
.business-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gloss-x) var(--gloss-y), rgba(255, 255, 255, 0.75), transparent 55%),
    radial-gradient(circle at calc(100% - var(--gloss-x)) calc(100% - var(--gloss-y)), rgba(176, 159, 134, var(--shadow-strength)), transparent 40%);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
}

/* Secondary overlay deepens the visible grain of the paper */
.business-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url('./assets/textures/eggshell-texture.svg');
  background-size: 260px 260px;
  background-position: center;
  opacity: var(--texture-depth);
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

.business-card .spotlight {
  position: absolute;
  inset: -20%;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18), rgba(17, 28, 41, 0) 62%);
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  transition: opacity 250ms ease;
  z-index: 3;
}

/* Card content maintains stacking above the texture overlay */
.card-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
}

/* Card grid mirrors traditional business card composition */
.card-grid {
  display: grid;
  grid-template-columns: minmax(90px, 0.9fr) minmax(0, 1.8fr);
  gap: clamp(1rem, 2vw, 2.5rem);
  height: 100%;
  align-items: center;
}

.monogram {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.identity-block {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
}

.title {
  font-size: 1rem;
  color: #374151;
}

.divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.35), transparent);
  margin: 0.5rem 0 0.25rem;
}

/* Contact list looks like printed card details with simple layout */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 500;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
  padding-bottom: 0.1rem;
  display: inline-block;
  font-size: 0.95rem;
}

.contact-list a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: rgba(15, 23, 42, 0.4);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}

.contact-list a:hover::after,
.contact-list a:focus-visible::after {
  transform: scaleX(1);
}

/* CTA keeps button fixed near the fold for discoverability */
.blog-cta {
  margin-top: auto;
}

.blog-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: white;
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.blog-button:hover,
.blog-button:focus-visible {
  transform: translateY(2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}

.chevron {
  font-size: 1.35rem;
}

/* Blog section introduces depth below the fold */
.blog-section {
  width: 100%;
  border-radius: 32px 32px 0 0;
  padding: 3rem min(8vw, 4rem) 4rem;
  box-shadow: 0 -24px 50px rgba(15, 23, 42, 0.08);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2.5rem;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 20% 0%, rgba(16, 94, 78, 0.06), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(16, 94, 78, 0.05), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fbfcf8 100%);
}

.blog-section::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(180deg, rgba(8, 15, 27, 0.6) 0%, rgba(251, 252, 248, 0) 100%);
  z-index: -1;
}

.blog-section.reading-mode .blog-grid,
.blog-section.reading-mode .blog-intro {
  display: none;
}

/* Delay showing blog grid until article panel has faded out */
.blog-section.closing-article .blog-grid,
.blog-section.closing-article .blog-intro {
  display: none;
}

.blog-section.reading-mode .article-panel {
  display: block;
  align-self: stretch;
}

.blog-intro {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.blog-subtitle {
  color: #4b5563;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.blog-post {
  position: relative;
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.blog-post.featured {
  grid-column: span 2;
  padding: 1.75rem;
  min-height: 240px;
}

.post-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.85rem;
}

.blog-post h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.blog-post h3 {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
}

.blog-post p {
  color: #374151;
  line-height: 1.6;
}

.read-link {
  margin-top: auto;
  font-weight: 600;
  color: #0f172a;
  background: none;
  border: none;
  padding: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.35);
  width: fit-content;
  padding-bottom: 0.25rem;
  cursor: pointer;
}

.article-panel {
  margin-top: 0;
  padding: 2.25rem;
  border-radius: 28px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #ffffff;
  box-shadow: 0 40px 80px rgba(15, 23, 42, 0.08);
  animation: fadeIn 550ms ease;
  align-self: stretch;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  transition: opacity 300ms ease, transform 300ms ease;
}

/* Closing state fades out the article panel before blog grid appears */
.article-panel.closing {
  animation: fadeOut 300ms ease forwards;
}

.article-panel[hidden] {
  display: none !important;
}

.back-button {
  align-self: flex-start;
  background: none;
  border: none;
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

.article-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  padding-top: 1rem;
}

/* Typography styling for article content */
.article-content h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.article-content h3 {
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.article-content p {
  color: #374151;
  line-height: 1.75;
  font-size: 1rem;
  margin-bottom: 1rem;
}

/* Styling for the tech stack list (unordered list) */
.article-content .tech-stack-list {
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-content .tech-stack-list li {
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.03);
  border-left: 3px solid rgba(15, 23, 42, 0.15);
  border-radius: 4px;
  color: #374151;
  line-height: 1.6;
}

.article-content .tech-stack-list li strong {
  color: var(--accent);
  font-weight: 600;
}

/* Styling for the numbered explanation list (ordered list) */
.article-content .tech-explanation-list {
  list-style: none;
  counter-reset: tech-counter;
  padding-left: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.article-content .tech-explanation-list li {
  counter-increment: tech-counter;
  position: relative;
  padding-left: 3rem;
}

.article-content .tech-explanation-list li::before {
  content: counter(tech-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.article-content .tech-explanation-list li p {
  margin-bottom: 0;
  color: #374151;
  line-height: 1.75;
}

.article-content .tech-explanation-list li strong {
  color: var(--accent);
  font-weight: 600;
}

/* Code block styling for inline code and code blocks */
.article-content code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 4px;
  color: #0f172a;
}

.article-content pre {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.6;
}

.article-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.9em;
  color: #0f172a;
  display: block;
  white-space: pre;
}

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

/* Fade out animation for closing article panel */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.post-date {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 0.85rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Responsive tweaks maintain readability on narrow screens */
@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .monogram {
    justify-self: center;
  }

  .identity-block {
    align-items: center;
  }

  .business-card {
    padding: 2rem;
  }

  .contact-list {
    align-items: center;
    gap: 0.5rem;
  }
}
