@import url('https://fonts.googleapis.com/css2?family=Jua&family=Spectral:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Jua&family=Manjari:wght@100;400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Jua&family=Manjari:wght@100;400;700&family=Sono:wght@200..800&display=swap');

:root {
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --secondary-text: #666666;
  --border-color: #e0e0e0;
  --link-color: #0066cc;
  --link-hover: #004499;
  --code-bg: #f5f5f5;
  --mono-font: "Sono", "SF Mono", "Monaco", "Inconsolata", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --secondary-text: #999999;
  --border-color: #333333;
  --link-color: #6699ff;
  --link-hover: #99bbff;
  --code-bg: #2a2a2a;
}

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

body {
  font-size: 1.3rem;
  font-family: 'Manjari', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  border-bottom: 1px solid var(--border-color);
}

nav {
  padding: 1rem 0;
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
}

.site-logo {
  height: 120px;
  width: 120px;
}

[data-theme="dark"] .site-logo {
  background-color: white;
  border-radius: 24px;
  padding: 8px;
  box-sizing: content-box;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  font-size: 1.2rem;
  list-style: none;
  align-items: center;
  font-family: 'Jua', sans-serif;
  text-transform: uppercase;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  transition: color 0.2s;
}

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

#theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  border-radius: 16px;
  transition: all 0.2s;
}

#theme-toggle:hover {
  background-color: var(--code-bg);
}

main {
  min-height: calc(100vh - 200px);
  padding: 3rem 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  font-family: 'Jua', sans-serif;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}


#hook {
  line-height: 1.1;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#hook .hook-word {
  display: block;
}

#hook .xlerb,
span.xlerb {
  color: #b87bb8;
}

#hook .colon,
#hook .semicolon {
  color: #333;
}

[data-theme="dark"] #hook .colon,
[data-theme="dark"] #hook .semicolon {
  color: #ccc;
}

#hook .is {
  color: #6ba3d4;
}

#hook .forth {
  color: #6bb88a;
}

#hook .flavoured {
  color: #e0ab5d;
}

#hook .erlang {
  color: #d46b6b;
}

#hook .semicolon {
  display: inline-block;
  transition: transform 1s ease-out;
}

#hook .erlang.growing~.semicolon {
  transform: translateX(25px);
  transition: transform 5s ease-in-out;
}

.center {
  text-align: center;
  margin-bottom: 2rem;
}

p.caption {
  font-size: 0.9rem;
  font-style: italic;
}

code {
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: var(--mono-font);
  font-size: 0.95em;
}

pre {
  background-color: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-family: var(--mono-font);
  font-size: 0.95rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

ul,
ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

table {
  border-collapse: collapse;
  margin-bottom: 1rem;
}

th,
td {
  padding: 0.5rem 1rem;
  text-align: left;
}

th {
  border-bottom: 1px solid var(--text-color);
  font-weight: bold;
}

.post-list {
  list-style: none;
  margin-left: 0;
}

.post-list li {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

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

.post-list h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.post-list time {
  color: var(--secondary-text);
  font-size: 0.9rem;
}

.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  margin-top: 0;
}

.post-header time {
  color: var(--secondary-text);
}

footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  margin-top: 3rem;
  font-size: 0.8rem;
  text-align: center;
  color: var(--secondary-text);
}

.intro {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.section-list {
  list-style: none;
  margin-left: 0;
}

.section-list li {
  margin-bottom: 1rem;
}

.learning-list {
  list-style: decimal;
  margin-left: 2rem;
  counter-reset: learning-counter;
}

.learning-list li {
  margin-bottom: 1.5rem;
}

.learning-item {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.learning-title {
  font-weight: bold;
  flex-shrink: 0;
}

.learning-description {
  color: var(--secondary-text);
  font-style: italic;
}

.learning-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.learning-nav-top {
  margin-bottom: 2rem;
}

.learning-nav-bottom {
  margin-top: 3rem;
}

.learning-nav-link {
  text-decoration: none;
  color: var(--link-color);
  transition: color 0.2s;
  white-space: nowrap;
}

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

.learning-nav-prev {
  text-align: left;
}

.learning-nav-next {
  text-align: right;
  margin-left: auto;
}

@media (max-width: 768px) {
  .learning-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .learning-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .learning-nav-next {
    margin-left: 0;
  }
}

.home-hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.home-hero h1 {
  margin-top: 0;
  flex-shrink: 0;
}

.carousel-stage {
  flex: 1;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.carousel-wrapper {
  background-color: var(--code-bg);
  padding: 0.2rem;
  border-radius: 24px;
  flex: 1;
}

.carousel-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  height: 220px;
}

.carousel {
  height: 100%;
}

.carousel-track {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.carousel-track-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.carousel-item {
  min-height: 100%;
  width: 100%;
  flex: 0 0 auto;
}

.carousel-content {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.carousel-code {
  max-width: 100%;
  overflow-x: auto;
}

.carousel-code pre {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  font-family: var(--mono-font);
}

.carousel-description h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.carousel-description p {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 0;
}

.carousel-controls {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.carousel-prev,
.carousel-next {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: 'Jua', sans-serif;
  line-height: 1;
}

.carousel-prev {
  transform: rotate(180deg);
}

.carousel-prev:hover,
.carousel-next:hover {
  background-color: var(--border-color);
}

@media (max-width: 768px) {
  .home-hero {
    flex-direction: column;
    gap: 2rem;
  }

  #hook {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: baseline;
  }

  #hook .hook-word {
    display: inline;
  }

  /* Break after "FORTH" on mobile */
  #hook .forth::after {
    content: "\A";
    white-space: pre;
  }

  .carousel-stage {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .carousel-wrapper {
    width: 100%;
  }

  .carousel-controls {
    flex-direction: row;
    justify-content: center;
  }

  .carousel-prev {
    transform: rotate(90deg);
  }

  .carousel-next {
    transform: rotate(-90deg);
  }

  .carousel-container {
    height: 300px;
    padding: 0 10px;
  }

  .carousel-content {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  .carousel-description {
    order: -1;
  }

  .carousel-code pre {
    font-size: 0.75rem;
    line-height: 1.4;
    max-width: 100%;
    overflow-x: auto;
    padding: 0.75rem;
  }

  .carousel-code pre code {
    font-family: var(--mono-font);
    letter-spacing: -0.02em;
  }

  .carousel-description h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .carousel-description p {
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

@media (max-width: 600px) {
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

#hook .erlang {
  cursor: help;
  display: inline-block;
  transition: transform 1.5s ease-out;
  transform-origin: center;
}

#hook .erlang.growing {
  animation: grow-pulse 5s ease-in-out;
  transform: scale(1.5);
}

@keyframes grow-pulse {
  0% {
    transform: scale(1);
  }

  20% {
    transform: scale(1.05);
  }

  40% {
    transform: scale(1.1);
  }

  60% {
    transform: scale(1.2);
  }

  80% {
    transform: scale(1.35);
  }

  100% {
    transform: scale(1.5);
  }
}

.erlang-movie-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.erlang-movie-overlay.active {
  opacity: 1;
}

.erlang-movie-overlay iframe {
  max-width: 90vw;
  max-height: 90vh;
  aspect-ratio: 16 / 9;
}

.close-overlay {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  z-index: 10001;
  opacity: 0.7;
  transition: opacity 0.2s;
  font-family: Arial, sans-serif;
  line-height: 1;
  padding: 0;
  width: 50px;
  height: 50px;
}

.close-overlay:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   Spec Page Styles
   ═══════════════════════════════════════════════════════════════ */

.spec-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.spec-sidebar {
  position: relative;
}

.spec-toc {
  position: sticky;
  top: 2rem;
  background-color: var(--code-bg);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.spec-toc h2 {
  margin-top: 0;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary-text);
}

.spec-toc ul {
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.spec-toc li {
  margin: 0;
}

.spec-toc a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.95rem;
  display: block;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.spec-toc a:hover {
  color: var(--link-color);
}

.spec-page {
  max-width: 900px;
}

.spec-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.spec-header h1 {
  margin-top: 0;
  font-size: 2.5rem;
}

.spec-header .tagline {
  font-size: 1.2rem;
  color: var(--secondary-text);
  font-style: italic;
}

.spec-section {
  margin-bottom: 4rem;
  padding-top: 1rem;
}

.spec-section>h2 {
  font-size: 2rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 2rem;
}

.spec-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.spec-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.spec-code {
  background-color: var(--code-bg);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}

.spec-code pre {
  margin: 0;
  background: none;
  padding: 0;
}

.spec-explain h3 {
  margin-top: 0;
  color: var(--link-color);
  font-size: 1.3rem;
}

.spec-explain p {
  margin-bottom: 0.75rem;
}

.spec-explain p:last-child {
  margin-bottom: 0;
}

.spec-note {
  font-size: 0.9rem;
  color: var(--secondary-text);
  font-style: italic;
}

.syntax-marker {
  background-color: var(--link-color);
  color: var(--bg-color);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-family: var(--mono-font);
  font-weight: bold;
  font-size: 0.9em;
}

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

  .spec-sidebar {
    order: -1;
  }

  .spec-toc {
    position: static;
    max-height: none;
  }

  .spec-toc ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
  }

  .spec-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .spec-header h1 {
    font-size: 2rem;
  }
}
