/*
Theme Name: Cloudlabs
Theme URI: https://blog.cloudlabs.fun
Description: An editorial block theme for a mixed tech-and-lifestyle blog.
             Serif body for long-form reading, a feed that shows short posts in
             full and long ones as excerpts, and a marked convention for links
             out to the technical sister site.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cloudlabs
*/

/* ---------------------------------------------------------------------------
   Design tokens.

   Deliberately unlike the sister site, which is warm-neutral with a brown
   accent and a system sans throughout. This one is cooler, uses a serif for
   body text, and reserves sans for interface furniture. A reader landing on
   both should not have to check the URL to know which they are on.
   --------------------------------------------------------------------------- */

:root {
  --cl-bg:         #fdfcfa;
  --cl-surface:    #f4f2ee;
  --cl-text:       #1a1a1f;
  --cl-muted:      #5f5d68;
  --cl-border:     #dedbd4;
  --cl-accent:     #0f6466;
  --cl-accent-soft:#e3efee;
  --cl-code-bg:    #f3f1ed;

  --cl-serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino,
              Georgia, "Times New Roman", serif;
  --cl-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
              "Helvetica Neue", Arial, sans-serif;
  --cl-mono:  ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo,
              Consolas, monospace;

  --cl-measure: 38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cl-bg:         #14141a;
    --cl-surface:    #1d1d25;
    --cl-text:       #e9e7e2;
    --cl-muted:      #a3a0ab;
    --cl-border:     #32323d;
    --cl-accent:     #6fc7c4;
    --cl-accent-soft:#172e2f;
    --cl-code-bg:    #1a1a22;
  }
}

body {
  background: var(--cl-bg);
  color: var(--cl-text);
  font-family: var(--cl-serif);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------------
   Reading. Long-form is the priority, so the measure is narrow and the leading
   is generous.
   --------------------------------------------------------------------------- */

.wp-site-blocks p,
.wp-site-blocks li {
  line-height: 1.72;
}

.wp-site-blocks h1,
.wp-site-blocks h2,
.wp-site-blocks h3,
.wp-site-blocks h4 {
  font-family: var(--cl-serif);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.wp-site-blocks h2 { margin-top: 2.4em; }
.wp-site-blocks h3 { margin-top: 1.9em; }

a { color: var(--cl-accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

/* Interface furniture uses the sans, which keeps it out of the reading voice. */
.cl-meta, .cl-site-header, .cl-site-footer, .wp-block-navigation,
.wp-block-query-pagination, .wp-block-post-terms {
  font-family: var(--cl-sans);
}

/* ---------------------------------------------------------------------------
   Links out to the technical sister site.

   This blog references it occasionally, and a reader deserves to know they are
   being sent somewhere with a different register before they click. Applied by
   attribute selector, so it needs no effort when writing.
   --------------------------------------------------------------------------- */

.entry-content a[href*="lablog.cloudlabs.fun"]::after,
.wp-block-post-content a[href*="lablog.cloudlabs.fun"]::after {
  content: "lab";
  font-family: var(--cl-sans);
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 0.35em;
  margin-left: 0.25em;
  padding: 0.1em 0.32em;
  border-radius: 3px;
  background: var(--cl-accent-soft);
  color: var(--cl-accent);
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Code. Present and legible, but not the defining visual note the way it is on
   the sister site.
   --------------------------------------------------------------------------- */

code, kbd, samp, pre { font-family: var(--cl-mono); }

:not(pre) > code {
  background: var(--cl-code-bg);
  border: 1px solid var(--cl-border);
  border-radius: 4px;
  padding: 0.1em 0.34em;
  font-size: 0.84em;
  word-break: break-word;
}

pre.wp-block-code,
pre.wp-block-preformatted {
  background: var(--cl-code-bg);
  border: 1px solid var(--cl-border);
  border-radius: 6px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

pre.wp-block-code code { background: none; border: 0; padding: 0; font-size: inherit; }

/* ---------------------------------------------------------------------------
   Tables scroll inside their own figure; the page never scrolls sideways.
   --------------------------------------------------------------------------- */

.wp-block-table { overflow-x: auto; }
.wp-block-table table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.wp-block-table th,
.wp-block-table td { border: 1px solid var(--cl-border); padding: 0.5rem 0.7rem; text-align: left; }
.wp-block-table th { background: var(--cl-surface); font-weight: 600; }

/* ---------------------------------------------------------------------------
   The feed.

   Mixed post lengths are the whole point here. Excerpt length is set
   generously in functions.php so a short note appears in full while a long
   essay is truncated -- the difference emerges from the writing rather than
   from the author having to tag anything.
   --------------------------------------------------------------------------- */

.cl-feed-item {
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--cl-border);
}

.cl-feed-item:last-child { border-bottom: 0; }

.wp-block-post-title a { text-decoration: none; color: var(--cl-text); }
.wp-block-post-title a:hover { color: var(--cl-accent); }

.cl-meta {
  font-size: 0.82rem;
  color: var(--cl-muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.3rem 0 0.9rem;
}

.wp-block-post-excerpt__more-text { font-family: var(--cl-sans); font-size: 0.85rem; }

/* Posts filed under Notes read as asides rather than articles. WordPress puts
   the category on the wrapper, so this needs no per-post markup. */
.category-notes .wp-block-post-title { font-size: 1.15rem; }

/* ---------------------------------------------------------------------------
   Chrome
   --------------------------------------------------------------------------- */

.cl-site-header {
  border-bottom: 1px solid var(--cl-border);
  padding-bottom: 1rem;
}

.cl-site-title a {
  font-family: var(--cl-serif);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
  color: var(--cl-text);
}

.cl-site-footer {
  border-top: 1px solid var(--cl-border);
  margin-top: 4rem;
  padding-top: 1.5rem;
  color: var(--cl-muted);
  font-size: 0.87rem;
}

.wp-block-quote {
  border-left: 2px solid var(--cl-accent);
  padding-left: 1.15rem;
  margin-left: 0;
  font-style: italic;
  color: var(--cl-muted);
}

details {
  background: var(--cl-surface);
  border: 1px solid var(--cl-border);
  border-radius: 6px;
  padding: 0.35rem 1.1rem;
  margin: 1.6rem 0;
}
details > summary { cursor: pointer; font-family: var(--cl-sans); font-weight: 600; padding: 0.6rem 0; color: var(--cl-accent); }

img, svg, video { max-width: 100%; height: auto; }
figure.wp-block-image img { border-radius: 4px; }

/* ---------------------------------------------------------------------------
   Small screens
   --------------------------------------------------------------------------- */

@media (max-width: 600px) {
  pre.wp-block-code, pre.wp-block-preformatted { font-size: 0.78rem; padding: 0.8rem 0.9rem; }
  .wp-block-table table { font-size: 0.86rem; min-width: 30rem; }
  .wp-site-blocks h2 { margin-top: 2em; }
  .cl-feed-item { padding-bottom: 2rem; margin-bottom: 2rem; }
}

@media print {
  .cl-site-header, .cl-site-footer, .wp-block-navigation { display: none; }
  details { border: 0; padding: 0; }
  pre.wp-block-code { white-space: pre-wrap; word-break: break-word; }
}
