/*
  custom.css — site-specific tweaks layered on top of the Bearblog theme.

  This file is linked from /layouts/partials/custom_head.html and is meant to be
  the "safe" place for you to tweak UI without touching the theme itself.

  Sections:
  - Base/Layout: overall page, sidebar, typography, lists
  - Tokens: background-aware colors for subtitle/meta UI
  - Reviews: subtitle box, rating stars, meta line, “More info” link
  - Header/Footer: small layout helpers
  - Responsive: mobile-only adjustments
*/

/* ----------------------------
   Base + layout
---------------------------- */
body {
  margin: 0;
  padding: 0;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;

  font-family: var(--font-secondary);
  font-size: var(--font-scale);
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--background-color);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--selection-color);
}

a {
  color: var(--link-color);
  cursor: pointer;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

a:hover {
  color: var(--heading-color);
}

strong,
b {
  color: var(--heading-color);
}

button {
  margin: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
}

table {
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px dashed var(--border-color);
}

code {
  font-family: monospace;
  padding: 2px;
  border-radius: 3px;
}

blockquote {
  border-left: 3px solid var(--border-color);
  color: var(--blockquote-color);
  padding-left: 20px;
  font-style: italic;
}

.page {
  max-width: calc(var(--content-width) + var(--sidebar-width) + var(--gutter));
  margin: 0 auto;
  padding-left: var(--page-padding);
  padding-right: var(--page-padding);
  padding-top: calc(var(--page-padding) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--page-padding) + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: var(--gutter);
  align-items: flex-start;
}

.sidebar {
  width: var(--sidebar-width);
  position: sticky;
  top: var(--page-padding);
  padding: 6px 0;
  background: transparent;
  color: var(--text-color);
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(var(--content-width), var(--reading-measure));
}

footer {
  padding: 25px 0;
  text-align: left;
  margin-top: 2.25rem;
  border-top: 1px dashed var(--border-color);
}

/* ----------------------------
   Sidebar: title + nav
---------------------------- */
.sidebar a {
  color: var(--link-color);
}

.sidebar a:visited {
  color: var(--visited-color);
}

.sidebar .title {
  display: block;
  margin-bottom: 18px;
  text-decoration: none;
}

.sidebar .title:hover {
  text-decoration: none;
}

.sidebar .title h1,
.sidebar .title h2 {
  margin: 0;
  color: var(--heading-color);
  font-family: var(--font-main);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.05;
  font-size: 1.85em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.sidebar nav a {
  display: block;
  padding: 3px 0;
  text-decoration: none;
  color: var(--muted-color);
  font-family: var(--font-secondary);
  font-weight: 500;
  letter-spacing: 0.002em;
  width: fit-content;
  transition: color 0.15s ease;
}

.sidebar nav a:hover {
  color: var(--text-color);
  text-decoration: none;
}

.sidebar nav a.active {
  color: var(--heading-color);
  font-weight: 700;
}

/* ----------------------------
   Content typography
---------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-main);
  font-weight: var(--font-headings-weight, 700);
  color: var(--heading-color);
  line-height: 1.2;
  margin: 1.3em 0 0.4em;
  text-wrap: pretty;
}

h1 {
  margin-top: 0;
  margin-bottom: 0.15em;
  font-size: clamp(2.7rem, 2.7vw + 1.4rem, 4.6rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-top: 1.6em;
  margin-bottom: 0.45em;
}

h3 {
  margin-top: 1.3em;
  margin-bottom: 0.4em;
}

/* Bearblog's default single.html renders a <p><i><time>...</time></i></p> under the h1 */
h1 + p {
  margin-top: 0.1em;
  margin-bottom: 1.4em;
}

h1 + p i {
  font-style: normal;
}

time {
  font-family: var(--font-secondary);
  font-style: normal;
  font-size: 0.95em;
  color: var(--muted-color);
  font-variant-numeric: tabular-nums;
}

main {
  line-height: 1.8;
  letter-spacing: 0;
  font-size: 1.03em;
}

main p {
  margin: 1.05em 0;
}

main li {
  margin: 0.35em 0;
}

.highlight,
.code {
  border-radius: 3px;
  margin-block-start: 1em;
  margin-block-end: 1em;
  overflow-x: auto;
}

.inline {
  width: auto !important;
}

/* ----------------------------
   Lists (post index pages)
---------------------------- */
ul.blog-posts {
  list-style-type: none;
  padding: unset;
}

ul.blog-posts li {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

ul.blog-posts li + li {
  margin-top: 0.85rem;
}

ul.blog-posts li .post-list-date {
  flex: 0 0 auto;
  min-width: 11ch;
  color: var(--muted-color);
}

ul.blog-posts li a:visited {
  color: var(--visited-color);
}

/* ----------------------------
   Reviews: list page (title + rating + summary)
---------------------------- */
ul.review-posts {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.review-item {
  background: transparent;
  padding: 0;
}

.review-card {
  display: block;
  padding: 0.45rem 0.55rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  z-index: 0;
  border-radius: 10px;
}

.review-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.review-card:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 3px;
  border-radius: 10px;
}

.review-title {
  display: block;
}

.review-link {
  font-family: var(--font-main);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  text-decoration-color: var(--accent);
  /* Use em so sizing tracks the site's base font scale */
  font-size: clamp(1.06em, 1.02em + 0.25vw, 1.22em);
  line-height: 1.2;
}

.review-card:hover .review-link {
  text-decoration: underline;
}

.review-card .meta-line {
  margin-top: 0.28rem;
  margin-bottom: 0.32rem;
}

.review-summary {
  margin: 0.25rem 0 0;
  color: var(--muted-color);
  line-height: 1.65;
}

.review-empty {
  color: var(--muted-color);
}

@media (max-width: 620px) {
  .review-card {
    padding: 0.6rem 0.65rem;
  }
}

/* ----------------------------
   Home: latest review
---------------------------- */
.latest-review {
  margin: 1.2rem 0 1.5rem;
  border: 1px solid var(--subtitle-border);
  border-left: 4px solid var(--heading-color);
  background: rgba(0, 0, 0, 0.12);
}

.latest-review.review-card {
  padding: 1rem 1.1rem;
  border-radius: 10px;
}

.latest-review-label {
  color: var(--meta-color);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.latest-review .review-link {
  font-size: clamp(1.25em, 1.1em + 0.6vw, 1.6em);
  line-height: 1.2;
}

.latest-review .meta-line {
  margin-top: 0.4rem;
  margin-bottom: 0.6rem;
}

.latest-review-summary {
  margin: 0;
  color: var(--muted-color);
  line-height: 1.6;
}

/* ----------------------------
   Reviews: subtitle / deck
---------------------------- */
.post-subtitle {
  padding: 1.2rem 1.4rem;
  margin-top: 0.6rem;
  margin-bottom: 1.6rem;

  background: var(--subtitle-bg);
  border: 1px solid var(--subtitle-border);
  border-left: 4px solid var(--heading-color);

  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);

  color: var(--text-color);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.55rem);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.1px;
}

/* ----------------------------
   Reviews: rating stars
---------------------------- */
.post-rating {
  font-size: 1.05rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--meta-color);
}

.post-rating-stars {
  display: inline-flex;
  letter-spacing: 0.03em;
}

.rating-star {
  line-height: 1;
}

.rating-star.full {
  color: var(--rating-color);
}

.rating-star.empty {
  color: var(--rating-empty-color);
}

.rating-star.half {
  color: transparent;
  background: linear-gradient(90deg, var(--rating-color) 50%, var(--rating-empty-color) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ----------------------------
   Reviews: meta line + “More info”
---------------------------- */
.meta-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.15rem;
  margin-bottom: 1rem;
  font-size: clamp(0.9rem, 0.86rem + 0.2vw, 0.98rem);
  color: var(--meta-color);
  flex-wrap: wrap;
}

.meta-line time {
  font-family: var(--font-secondary);
  font-size: inherit;
  color: var(--meta-color);
}

.meta-line .post-rating {
  margin-left: 0;
}

.meta-separator {
  line-height: 1;
  opacity: 0.75;
}

.meta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--meta-link-text);
  text-decoration: underline;
  text-decoration-color: var(--heading-color);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  white-space: nowrap;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.2;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.meta-link:hover {
  text-decoration-color: var(--accent);
}

.meta-link:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

.meta-link-icon {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px;
}

.post-list-date time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------
   Header nav
---------------------------- */
header nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

header nav a {
  margin-right: 0;
}

/* ----------------------------
   Footer
---------------------------- */
.footer-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 0.9em;
  color: var(--muted-color);
}

.footer-copy {
  white-space: nowrap;
}

.footer-separator {
  opacity: 0.65;
  line-height: 1;
}

.footer-human {
  margin: 0;
  line-height: 0;
}

.footer-human a {
  display: inline-flex;
  align-items: center;
}

.footer-human img {
  width: min(140px, 100%);
  height: auto;
}

/* ----------------------------
   Responsive
---------------------------- */
@media (max-width: 1180px) {
  .page {
    --gutter: 44px;
  }
}

@media (max-width: 980px) {
  :root {
    --page-padding: 22px;
  }

  .page {
    flex-direction: column;
    gap: 18px;
  }

  .sidebar {
    width: auto;
    position: static;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 14px;
  }

  .sidebar nav a {
    padding: 2px 6px;
    border-radius: 6px;
  }

  .content {
    max-width: none;
  }
}

@media (max-width: 640px) {
  footer {
    padding-bottom: 72px;
  }

  ul.blog-posts li {
    flex-direction: column;
    gap: 6px;
  }

  ul.blog-posts li .post-list-date {
    min-width: 0;
  }

  .post-subtitle {
    padding: 1rem 1.1rem;
    border-radius: 8px;
  }

  .meta-line {
    gap: 0.25rem;
    flex-wrap: wrap;
    white-space: normal;
  }

  .meta-link {
    flex: 0 0 auto;
  }

  .post-rating {
    gap: 0.25rem;
  }

  .meta-link-label {
    display: none;
  }

}
