/* ==========================================================================
   lostsgnl.com — NYT-inspired design with rainbow accents
   ========================================================================== */

/* --- Custom properties --- */
:root {
  --color-coral: #D4796A;
  --color-amber: #D4A04A;
  --color-teal: #6BA397;
  --color-blue: #5B7FA5;

  --color-text: #1a1a1a;
  --color-text-muted: #666;
  --color-bg: #fff;
  --color-border: #e5e5e5;
  --color-callout-bg: #f5f5f5;

  --content-width: 680px;
  --header-height: auto;

  --font-serif: "EB Garamond", Garamond, Georgia, serif;
  --font-heading: "EB Garamond", Garamond, Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-body: clamp(1.1875rem, 1.1rem + 0.4vw, 1.3125rem);
  --fs-h1: clamp(2rem, 1.7rem + 1.4vw, 2.75rem);
  --fs-h2: clamp(1.5rem, 1.35rem + 0.7vw, 1.875rem);
  --fs-small: 0.9375rem;
  --fs-tag: 0.875rem;

  --leading: 1.7;
}

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

/* --- Base --- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: var(--leading);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* --- Links --- */
a {
  color: var(--color-text);
  text-decoration-color: var(--color-border);
  text-underline-offset: 0.15em;
  transition: text-decoration-color 0.15s;
}

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

/* --- Header --- */
body > header {
  background: var(--color-bg);
  z-index: 100;
}

@media (min-width: 768px) {
  body > header {
    position: sticky;
    top: 0;
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.08);
  }
}

nav {
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-name {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.signal-icon {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

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

.nav-links a {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  text-decoration: none;
  color: var(--color-text-muted);
  transition: color 0.15s;
}

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

/* --- Rainbow divider --- */
.rainbow-divider {
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--color-coral),
    var(--color-amber),
    var(--color-teal),
    var(--color-blue)
  );
}

/* --- Main content --- */
main {
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 2rem 1rem 4rem;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: var(--fs-h1);
  margin-block-end: 0.5rem;
}

h2 {
  font-size: var(--fs-h2);
  margin-block: 1.5rem 0.5rem;
}

h3 {
  font-size: 1.25rem;
  margin-block: 1.25rem 0.5rem;
}

p {
  margin-block-end: 1.25rem;
}

blockquote {
  border-inline-start: 3px solid var(--color-border);
  padding-inline-start: 1.25rem;
  color: var(--color-text-muted);
  margin-block: 1.5rem;
  font-style: italic;
}

hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin-block: 2rem;
}

img {
  max-width: 100%;
  max-height: 400px;
  width: 100%;
  object-fit: cover;
  border-radius: 4px;
}

/* --- Code --- */
code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--color-callout-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--color-callout-bg);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-block: 1.5rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
}

/* --- Callout / aside boxes --- */
aside,
.callout {
  background: var(--color-callout-bg);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-block: 1.5rem;
  font-size: var(--fs-small);
}

/* --- Tags --- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block-end: 0.75rem;
}

.tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-tag);
  font-weight: 600;
  color: #fff;
  background: var(--color-teal);
  padding: 0.2em 0.75em;
  border-radius: 9999px;
  text-decoration: none;
  line-height: 1.6;
  transition: opacity 0.15s;
}

.tag:hover {
  opacity: 0.85;
  color: #fff;
}

.tag-count {
  font-weight: 400;
  opacity: 0.85;
}

/* --- Tag cloud on /tags/ page --- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: 1rem;
}

.tag-cloud .tag {
  font-size: var(--fs-small);
  padding: 0.35em 1em;
}

/* --- Post list (homepage) --- */
.post-list h1 {
  margin-block-end: 1.5rem;
  padding-block-end: 0.75rem;
  border-block-end: 1px solid var(--color-border);
}

.post-summary {
  padding-block: 1.5rem;
  border-block-end: 1px solid var(--color-border);
}

.post-summary h2 {
  margin-block: 0 0.25rem;
  font-size: var(--fs-h2);
}

.post-summary h2 a {
  text-decoration: none;
}

.post-summary h2 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-text);
}

.post-summary time {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--color-text-muted);
}

.post-summary p {
  margin-block: 0.5rem 0;
  color: var(--color-text-muted);
}

/* --- Single post --- */
.post-header {
  margin-block-end: 2rem;
}

.post-meta {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--color-text-muted);
  margin-block-start: 0.75rem;
  display: flex;
  gap: 0.75rem;
}

.post-content {
  margin-block-start: 1.5rem;
}

/* --- Page --- */
.page h1 {
  margin-block-end: 1.5rem;
  padding-block-end: 0.75rem;
  border-block-end: 1px solid var(--color-border);
}

/* --- Tag page --- */
.tag-page h1 {
  margin-block-end: 1.5rem;
}

.tag-page h1 .tag {
  vertical-align: middle;
  font-size: var(--fs-small);
  padding: 0.25em 0.85em;
}

/* --- Footer --- */
footer {
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 2rem 1rem;
  border-block-start: 1px solid var(--color-border);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--color-text-muted);
  text-align: center;
}

/* --- Lists in content --- */
.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
  padding-inline-start: 1.5rem;
  margin-block-end: 1.25rem;
}

.post-content li,
.page-content li {
  margin-block-end: 0.35rem;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 1.5rem;
  font-size: var(--fs-small);
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-block-end: 1px solid var(--color-border);
}

th {
  font-family: var(--font-sans);
  font-weight: 600;
}

/* --- Print --- */
@media print {
  header,
  footer,
  .rainbow-divider {
    display: none;
  }

  main {
    max-width: 100%;
    padding: 0;
  }
}
