/*
 * screen.css — ItWorkSmart Ghost theme.
 *
 * Preserves the legacy visual identity (Old/styles.css) while adapting the
 * markup to Ghost's structure. All brand values come from tokens.css so the
 * gradient signature and colour system stay the single source of truth.
 */

@import "tokens.css";

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-background);
  color: var(--text);
  /* --gh-font-body / --gh-font-heading are injected by Ghost when an editor
     picks a custom font; they fall back to the brand token (--font-sans). */
  font-family: var(--gh-font-body, var(--font-sans));
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--gh-font-heading, var(--font-sans));
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

/* Layout containers ------------------------------------------------------- */

.site-header,
.section,
.site-footer {
  width: min(var(--content-width), calc(100% - 2rem));
  margin: 0 auto;
}

.section {
  padding: 2rem 0 4rem;
}

/* Top bar ----------------------------------------------------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0 0;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: var(--spectrum);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: rgba(20, 23, 30, 0.95);
  border-radius: var(--radius-pill);
}

.brand-mark::before {
  inset: 0.45rem 0.95rem;
}

.brand-mark::after {
  inset: 0.95rem 0.45rem;
}

.nav-link {
  color: var(--muted);
  transition: var(--transition);
}

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

/* Hero -------------------------------------------------------------------- */

.hero {
  padding: 5rem 0 3rem;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.78rem;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  line-height: 1.05;
  max-width: 16ch;
  margin: 0 0 1.25rem;
}

.lead {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
  max-width: 60ch;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

/* Buttons ----------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0 1.15rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.button.primary {
  background: var(--spectrum);
  background-size: 180% 180%;
  color: var(--on-gradient);
}

.button.primary:hover {
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--line);
  color: var(--muted);
}

.button.secondary:hover {
  color: var(--text);
}

/* Section heading --------------------------------------------------------- */

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  max-width: 24ch;
}

/* Post grid --------------------------------------------------------------- */

.post-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius-md);
  padding: 1.4rem;
}

.post-card .cover {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.post-type {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(106, 168, 255, 0.12);
  color: var(--primary);
}

.post-card h3 {
  margin-bottom: 0.5rem;
}

.post-card p,
.post-meta {
  color: var(--muted);
  line-height: 1.7;
}

.post-meta {
  font-size: 0.92rem;
}

.post-card footer {
  margin-top: auto;
}

.post-link {
  font-weight: 700;
  color: var(--text);
}

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

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(168, 85, 247, 0.14);
  color: var(--violet);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 1rem 0;
  color: var(--muted);
  line-height: 1.7;
}

/* Pagination -------------------------------------------------------------- */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0 0;
  color: var(--muted);
}

.pagination a {
  color: var(--text);
}

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

/* Article detail ---------------------------------------------------------- */

.article-shell {
  width: min(var(--article-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.article-back {
  color: var(--muted);
  display: inline-block;
  margin-bottom: 1.5rem;
}

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

.article-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.article-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.article-meta {
  color: var(--muted);
  margin-bottom: 1rem;
}

.article-body {
  color: var(--text);
  line-height: 1.8;
  font-size: 1.08rem;
}

.article-body h2 {
  margin-top: 2rem;
}

/* Koenig editor card widths (required by Ghost). */
.article-body :is(.kg-width-wide) {
  position: relative;
  width: 85vw;
  min-width: 100%;
  margin-left: calc(50% - 42.5vw);
  transform: none;
}

.article-body :is(.kg-width-full) {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  border-radius: 0;
}

.article-body :is(.kg-width-full) img {
  border-radius: 0;
}

.article-body img,
.article-body video,
.article-body audio {
  max-width: 100%;
  border-radius: 1rem;
}

/* Author card ------------------------------------------------------------- */

.author-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 2.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.author-avatar {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--on-gradient);
  background: var(--spectrum);
  object-fit: cover;
}

.author-name {
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.author-role {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.author-bio {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 900px) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}
