/*
Theme Name: Lablog
Theme URI: https://lablog.cloudlabs.fun
Description: A quiet, readable block theme for a homelab build log. Long-form
             text first, generous code blocks, progressive disclosure via
             styled details elements, and a persistent AI-authorship notice.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lablog
*/

/* ---------------------------------------------------------------------------
   Colour tokens.

   theme.json carries the palette WordPress exposes in the editor; these
   variables carry the same values plus the dark-mode overrides, which
   theme.json cannot express. Keep the two in sync when changing either.
   --------------------------------------------------------------------------- */

:root {
  --lab-bg:         #fbfaf8;
  --lab-surface:    #f2efea;
  --lab-text:       #1c1b19;
  --lab-muted:      #5c574f;
  --lab-border:     #d9d4cb;
  --lab-accent:     #7a4b1e;
  --lab-code-bg:    #f4f1ec;
  --lab-code-text:  #2a2723;

  --lab-live:       #2f6b3d;
  --lab-progress:   #8a5a12;
  --lab-blocked:    #8c2f2a;

  --lab-measure:    42rem;
  --lab-wide:       62rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --lab-bg:        #16151a;
    --lab-surface:   #1e1d24;
    --lab-text:      #e6e3dd;
    --lab-muted:     #a09a90;
    --lab-border:    #33313a;
    --lab-accent:    #d99a5b;
    --lab-code-bg:   #1b1a20;
    --lab-code-text: #ddd8d0;

    --lab-live:      #6fbf82;
    --lab-progress:  #d8ad5c;
    --lab-blocked:   #e08b84;
  }
}

body {
  background: var(--lab-bg);
  color: var(--lab-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------------------
   Reading
   --------------------------------------------------------------------------- */

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

.wp-site-blocks h1,
.wp-site-blocks h2,
.wp-site-blocks h3 {
  line-height: 1.25;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.wp-site-blocks h2 {
  margin-top: 2.75em;
  padding-top: 0.6em;
  border-top: 1px solid var(--lab-border);
}

.wp-site-blocks h3 { margin-top: 2em; }

/* First heading in an entry shouldn't carry the divider. */
.entry-content > h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

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

/* ---------------------------------------------------------------------------
   Code. Long command lines scroll inside the block; the page never scrolls
   sideways.
   --------------------------------------------------------------------------- */

code, kbd, samp, pre {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Menlo",
               "Consolas", monospace;
}

:not(pre) > code {
  background: var(--lab-code-bg);
  color: var(--lab-code-text);
  border: 1px solid var(--lab-border);
  border-radius: 4px;
  padding: 0.12em 0.36em;
  font-size: 0.88em;
  word-break: break-word;
}

pre.wp-block-code,
pre.wp-block-preformatted {
  background: var(--lab-code-bg);
  color: var(--lab-code-text);
  border: 1px solid var(--lab-border);
  border-left: 3px solid var(--lab-accent);
  border-radius: 5px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

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

/* ---------------------------------------------------------------------------
   Tables. Wide tables scroll within their own figure.
   --------------------------------------------------------------------------- */

.wp-block-table { overflow-x: auto; }

.wp-block-table table {
  border-collapse: collapse;
  font-size: 0.94rem;
  width: 100%;
}

.wp-block-table th,
.wp-block-table td {
  border: 1px solid var(--lab-border);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.wp-block-table th { background: var(--lab-surface); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Progressive disclosure. The mixed-audience device: plain prose on the
   surface, command-level depth one click away.
   --------------------------------------------------------------------------- */

details {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  padding: 0.35rem 1.1rem;
  margin: 1.75rem 0;
}

details > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.65rem 0;
  list-style: none;
  color: var(--lab-accent);
}

details > summary::-webkit-details-marker { display: none; }

details > summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 0.55rem;
  transition: transform 0.15s ease;
}

details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { border-bottom: 1px solid var(--lab-border); margin-bottom: 0.5rem; }

details > summary:focus-visible { outline: 2px solid var(--lab-accent); outline-offset: 3px; }

/* ---------------------------------------------------------------------------
   Status badges. Shared by the Status page and post headers.
   --------------------------------------------------------------------------- */

.lab-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.16em 0.55em;
  border-radius: 3px;
  border: 1px solid currentColor;
  vertical-align: middle;
}

.lab-badge--live     { color: var(--lab-live); }
.lab-badge--progress { color: var(--lab-progress); }
.lab-badge--blocked  { color: var(--lab-blocked); }

/* ---------------------------------------------------------------------------
   AI-authorship disclosure.

   Two components, deliberately quiet: honest and always present, never a
   banner. See content/pages/how-this-site-is-written.md.
   --------------------------------------------------------------------------- */

.lab-ai-notice {
  font-size: 0.85rem;
  color: var(--lab-muted);
  border: 1px solid var(--lab-border);
  border-left: 3px solid var(--lab-accent);
  border-radius: 4px;
  background: var(--lab-surface);
  padding: 0.7rem 0.95rem;
  margin: 0 0 2.25rem;
  line-height: 1.55;
}

.lab-ai-notice a { color: var(--lab-accent); }

.lab-site-disclosure {
  font-size: 0.85rem;
  color: var(--lab-muted);
  line-height: 1.6;
  max-width: var(--lab-measure);
}

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

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

.lab-site-title a {
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.lab-post-meta {
  font-size: 0.86rem;
  color: var(--lab-muted);
  margin-bottom: 1.75rem;
}

/* Post listings */
.wp-block-post-title a { text-decoration: none; }
.wp-block-post-title a:hover { text-decoration: underline; }

.wp-block-post-excerpt__excerpt { color: var(--lab-muted); }

/* Blockquotes */
.wp-block-quote {
  border-left: 3px solid var(--lab-accent);
  padding-left: 1.1rem;
  margin-left: 0;
  font-style: normal;
  color: var(--lab-muted);
}

/* Images never overflow */
img, svg, video { max-width: 100%; height: auto; }

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

@media (max-width: 600px) {
  pre.wp-block-code, pre.wp-block-preformatted {
    font-size: 0.8rem;
    padding: 0.8rem 0.9rem;
  }
  /* Let narrow screens scroll the table rather than crushing columns that
     contain filenames or commands. The figure already has overflow-x:auto. */
  .wp-block-table table { font-size: 0.86rem; min-width: 30rem; }
  details { padding: 0.3rem 0.85rem; }
  .wp-site-blocks h2 { margin-top: 2.25em; }
}

/* ---------------------------------------------------------------------------
   Print - posts are long and occasionally get printed for reference.
   --------------------------------------------------------------------------- */

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