/* Main stylesheet - replicating stephango.com design */

/* ===== Reset and base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%; /* 10px base for easy rem calculation */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.8rem;
  line-height: 1.6;
  color: var(--color-tx);
  background-color: var(--color-bg);
  transition: background-color 0.2s, color 0.2s;
}

/* ===== Layout ===== */
.container {
  max-width: 40em;
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 600px) {
  .container {
    max-width: 88vw;
    padding: 0 1rem;
  }
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: 1.3;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 3.2rem;
}

h2 {
  font-size: 2.4rem;
}

h3 {
  font-size: 2.0rem;
}

h4 {
  font-size: 1.8rem;
}

@media (max-width: 860px) {
  h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
  }
}

p {
  margin-bottom: 1.5em;
  line-height: 1.5;
}

a {
  color: var(--color-tx);
  text-decoration: underline;
  text-decoration-color: var(--color-ui-2);
  text-underline-offset: 0.15em;
  transition: color 0.15s, text-decoration-color 0.15s;
}

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

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

/* Lists - matching stephango.com */
ul, ol {
  padding-left: 1em;
  margin: 0.5rem 0 1rem 0.5em;
}

ul > li, ol > li {
  padding: 0.15rem 0;
  line-height: 1.5;
}

ul > li::marker {
  color: var(--color-tx-3);
  font-size: 85%;
}

ol > li::marker {
  color: var(--color-tx-3);
}

@media (max-width: 600px) {
  ul > li, ol > li {
    padding: 0.25rem 0;
  }
}

/* Horizontal rule - subtle like stephango.com */
hr {
  border: none;
  border-top: 1px solid var(--color-ui-2);
  margin: 3em 0;
  opacity: 0.5;
}

code {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", "SF Mono", Menlo, "Courier New", monospace;
  font-size: 0.9em;
  background-color: var(--color-ui);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre {
  background-color: var(--color-ui);
  padding: 1.5rem;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 2rem;
}

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

blockquote {
  border-left: 3px solid var(--color-ui-2);
  padding-left: 1.5rem;
  margin: 2rem 0;
  color: var(--color-tx-2);
  font-style: italic;
}

/* ===== Header / Navigation ===== */
.site-header {
  padding: 2rem 0;
}

.site-nav {
  display: flex;
  align-items: center;
  margin-bottom: 4rem;
}

.nav-home {
  flex-grow: 1;
}

.nav-links {
  display: flex;
  gap: 2rem;
  margin-right: 1rem;
}

.site-nav a {
  color: var(--color-tx-2);
  text-decoration: none;
  border: none;
  font-size: 2rem;
  transition: color 0.15s ease;
  padding: 0.2em 0;
  border-radius: 0;
}

.site-nav a:hover {
  color: var(--color-tx);
  border: none;
}

.site-nav a:active {
  background-color: color-mix(in srgb, var(--color-action) 20%, transparent);
  color: var(--color-tx);
}

/* Theme toggle - matching stephango.com */
.theme-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--color-ui-2);
  border-radius: 24px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 24px;
  position: relative;
  transition: border-color 0.15s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--color-tx-2);
}

.theme-toggle-switch {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--color-tx);
  transition: left 0.2s ease, background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-dark .theme-toggle-switch {
  left: 18px;
}

.light-icon,
.dark-icon {
  font-size: 12px;
  position: absolute;
  transition: opacity 0.15s ease;
}

.light-icon {
  opacity: 1;
}

.dark-icon {
  opacity: 0;
}

.theme-dark .light-icon {
  opacity: 0;
}

.theme-dark .dark-icon {
  opacity: 1;
}

/* ===== Section titles (stephango style) ===== */
.section-title {
  margin: 0 0 1.5rem;
  font-weight: 400;
  color: var(--color-tx-2);
}

.section-title a {
  color: var(--color-tx-2);
  text-decoration: none;
}

.section-title a:hover {
  color: var(--color-action);
}

/* Section dividers */
.section-divider {
  margin: 4rem 0;
}

/* ===== Latest post preview ===== */
.latest-post {
  margin: 0 0 2rem;
}

.latest-post h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 2.2rem;
  font-weight: 400;
}

.latest-post h3 a {
  text-decoration: none;
  color: var(--color-tx);
}

.latest-post h3 a:hover {
  color: var(--color-action);
}

.latest-post .post-meta {
  color: var(--color-tx-3);
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.latest-post .post-excerpt {
  color: var(--color-tx-2);
  font-size: 1.6rem;
  line-height: 1.5;
  margin-bottom: 0;
}

/* ===== Post list (homepage style) ===== */
.post-list {
  list-style: none;
  margin: 3rem 0;
}

.post-item {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.post-date {
  color: var(--color-tx-3);
  font-size: 1.6rem;
  white-space: nowrap;
  min-width: 8rem;
}

.post-title {
  color: var(--color-tx);
  font-size: 1.8rem;
  text-decoration: none;
}

.post-title:hover {
  color: var(--color-action);
  border: none;
}

@media (max-width: 600px) {
  .post-item {
    flex-direction: column;
    gap: 0.3rem;
  }

  .post-date {
    font-size: 1.4rem;
  }
}

/* ===== Writing archive list (stephango style) ===== */
.writing-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.writing-list li {
  padding: 0.6rem 0;
}

.writing-list a {
  text-decoration: none;
}

.writing-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.writing-date {
  color: var(--color-tx-3);
  font-size: 1.4rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.writing-title {
  color: var(--color-tx);
}

.writing-title:hover {
  color: var(--color-action);
}

/* ===== Topics / Tags ===== */
.tag-cloud {
  margin: 0 0 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0;
}

.tag-link {
  color: var(--color-tx-2);
  font-size: 1.6rem;
  text-decoration: none;
}

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

.tag-comma {
  color: var(--color-tx-3);
}

/* ===== Post content ===== */
.post-header {
  margin-bottom: 3rem;
}

.post-meta {
  color: var(--color-tx-3);
  font-size: 1.4rem;
  margin-top: 0.5rem;
}

.post-content {
  margin-bottom: 6rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 2rem 0;
}

.post-content ul,
.post-content ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

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

/* ===== Footer ===== */
.site-footer {
  padding: 6rem 0 4rem;
  border-top: 1px solid var(--color-ui-3);
  margin-top: 6rem;
}

.social-links {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.social-links a {
  color: var(--color-tx-2);
  font-size: 1.6rem;
}

.social-links a:hover {
  color: var(--color-action);
}

.copyright {
  color: var(--color-tx-3);
  font-size: 1.4rem;
}

/* ===== Utilities ===== */
.hidden {
  display: none;
}

/* Spacing utilities (matching stephango.com) */
.p { padding: 1rem; }
.pp { padding: 2rem; }
.m { margin-top: 2rem; margin-bottom: 2rem; }
.s { margin-top: 4rem; margin-bottom: 4rem; }
.ss { margin-top: 6rem; margin-bottom: 6rem; }
.l { margin-top: 8rem; margin-bottom: 8rem; }
.st { margin-top: 1rem; }
.sr { margin-right: 1rem; }
.sb { margin-bottom: 1rem; }
.sl { margin-left: 1rem; }

/* Mobile visibility */
@media (max-width: 600px) {
  .hide-mobile {
    display: none;
  }
}

@media (min-width: 601px) {
  .show-mobile {
    display: none;
  }
}
