/*
 Theme Name:   Farhan Munim
 Theme URI:    https://farhan.app/
 Description:  A Bricks child theme.
 Author:       Farhan Munim
 Author URI:   https://farhan.app/
 Template:     bricks
 Version:      1.0.0
*/

:root {
  /* Colour */
  --bg: #fcfcfb;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --subtle: #a8a49e;
  --rule: #ebe9e5;
  --surface: #f6f5f1;
  --surface-sunken: #f1efea;
  --info: #3b7ea1;
  --info-bg: #eef4f8;
  --warn: #b8860b;
  --warn-bg: #fbf5e7;

  /* Type */
  --font: "Geist", "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-h3: 1.0625rem;
  --t-lede: 1.125rem;
  --t-h2: 1.1875rem;
  --t-h1: clamp(1.5rem, 1.25rem + 1.1vw, 1.875rem);
  --t-pill: 0.6875rem;

  --lh-tight: 1.25;
  --lh-body: 1.7;
  --lh-relaxed: 1.55;

  --w-regular: 400;
  --w-medium: 500;

  /* Shape */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-full: 999px;

  /* Layout */
  --measure: 36rem;
  --gutter: clamp(1.25rem, 4vw, 2rem);

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 200ms;
}

:root[data-brx-theme="dark"] {
  --bg: #111111;
  --fg: #ececea;
  --muted: #9c9c9a;
  --subtle: #6a6a68;
  --rule: #262625;
  --surface: #1a1a1a;
  --surface-sunken: #222220;
  --info: #7ab9d8;
  --info-bg: #16242d;
  --warn: #e0b859;
  --warn-bg: #2a2315;

  color-scheme: dark;
}

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:root[data-brx-theme="dark"] ::selection {
  background: #ececea;
  color: #111111;
}

:where(p + p) {
  margin-block: 1.25rem 0;
}

.theme-toggle:hover {
  background: var(--surface-sunken);
  border-color: var(--rule);
}

.theme-icon {
  display: none;
  color: var(--fg);
}

[data-brx-theme='light'] .theme-icon--sun { display: block; }
[data-brx-theme='dark'] .theme-icon--moon { display: block; }

.list__item::before {
  content: '';
  position: absolute;
  inset: 0 -0.75rem;
  background-color: transparent;
  border-radius: var(--r-md);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.list__item:hover::before {
  background-color: var(--surface-sunken);
  opacity: 1;
}

.list__title {
  font-size: var(--t-base);
  line-height: 1.5;
  font-weight: 400;
  min-width: 0;
  margin: unset;
}

.list__title a::after{
	content:'';
	position: absolute;
	inset: 0;
}

/* .list__title a[target="_blank"]::after {
  content: '';
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.3em;
  background-color: currentColor;
  opacity: 0.5;
  transition: opacity var(--dur) var(--ease);

  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><line x1='7' y1='17' x2='17' y2='7'/><polyline points='7 7 17 7 17 17'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><line x1='7' y1='17' x2='17' y2='7'/><polyline points='7 7 17 7 17 17'/></svg>") center / contain no-repeat;
} */

.list__item:hover > .list__title a[target="_blank"]::after {
  opacity: 1;
}

.socials__link:hover {
  border-bottom-color: var(--fg);
}

.socials__inner + .socials__inner::before {
  content: '∙';
  margin-inline: 0.25rem;
}

.card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
}

.card__item:hover {
  background-color: var(--surface);
}

.search { background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a8a49e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") left center no-repeat; }

.search input:focus-visible {
  outline: none;
  border-bottom: 1px solid currentcolor;
}

.page-numbers a {
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.page-numbers a:hover {
  background-color: var(--surface);
}

.pagination .bricks-pagination ul .page-numbers.current {
  box-shadow: 0 1px 2px #0000000a;
}

/* =========================================
   Prose — rendered WP post body
   ========================================= */

.external-link__hint{
	color: var(--subtle);
    font-size: var(--t-xs);
	font-family: var(--font-mono);
}

.prose {
  color: var(--fg);
  font-size: var(--t-base);
  line-height: var(--lh-body);
}

/* Paragraphs */
.prose p {
  margin-bottom: 1.25rem;
}

/* Headings */
.prose h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.prose h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

/* Lists */
.prose ul,
.prose ol {
  padding-left: 1.25rem;
  margin-bottom: 1.25rem;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
  margin-bottom: 0.5rem;
}

/* Media */
.prose img,
.prose video,
.prose iframe {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-sm);
}

.prose figure {
  margin: 1.5rem 0;
}

.prose figcaption {
  margin-top: 0.5rem;
  color: var(--subtle);
  font-size: var(--t-xs);
  font-family: var(--font-mono);
}

/* Links */
.prose a {
  border-bottom: 1px solid var(--rule);
}

.prose a:hover {
  border-bottom-color: var(--fg);
}

/* Blockquote */
.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

/* Code (shared) */
.prose pre,
.prose code {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
}

/* Code blocks */
.prose pre {
  position: relative;
  overflow: auto;
  max-height: 28rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;

  background: var(--surface);
  border-radius: var(--r-sm);
  line-height: 1.5;

  scrollbar-width: thin;
  scrollbar-color: var(--subtle) transparent;
}

.prose pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.prose pre::-webkit-scrollbar-thumb {
  background: var(--subtle);
  border-radius: var(--r-full);
}

.prose pre::-webkit-scrollbar-track {
  background: transparent;
}

/* Copy button */
.prose pre .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  color: var(--subtle);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);

  cursor: pointer;
  opacity: 0.4;

  transition:
    opacity var(--dur) var(--ease),
    color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.prose pre .copy-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.prose pre:hover .copy-btn,
.prose pre .copy-btn:focus-visible {
  opacity: 1;
}

.prose pre .copy-btn:hover {
  color: var(--fg);
  background: var(--bg);
}

.prose pre code{
	color: var(--fg);
}

.prose pre .copy-btn[data-copied] {
  color: var(--fg);
  opacity: 1;
}

/* Inline code */
.prose :not(pre) > code {
  background: var(--surface-sunken);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Tables */
.prose table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: var(--t-sm);
  line-height: 1.5;
}

.prose thead th {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--rule);

  text-align: left;
  font-weight: var(--w-medium);
  color: var(--muted);

  font-size: var(--t-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prose tbody td,
.prose tbody th {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--rule);

  vertical-align: top;
  text-align: left;
  font-weight: var(--w-regular);
}

.prose tbody tr:last-child td,
.prose tbody tr:last-child th {
  border-bottom: 0;
}

.prose table code {
  font-size: 0.8em;
}

/* Table wrapper */
.prose figure:has(> table) {
  margin: 1.5rem 0;
  overflow-x: auto;
}

.prose figure:has(> table) > table {
  margin: 0;
}

.prose figure:has(> table) > figcaption {
  text-align: left;
}

/* Alerts */
.prose .alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;

  margin: 1.5rem 0;
  padding: 0.875rem 1rem;

  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--r-md);

  background: var(--surface);
  font-size: var(--t-sm);
  line-height: var(--lh-relaxed);
}

.prose .alert svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
}

.prose .alert p {
  margin: 0;
}

.prose .alert p + p {
  margin-top: 0.5rem;
}

.prose .alert--info {
  border-left-color: var(--info);
  background: var(--info-bg);
}

.prose .alert--info svg {
  color: var(--info);
}

.prose .alert--warning {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}

.prose .alert--warning svg {
  color: var(--warn);
}

.top:hover {
  color: var(--fg);
}

/* Read progress */
.read-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 5px;
  z-index: 1000;
  pointer-events: none;
}

.read-progress__bar {
  height: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 80ms linear;
}

@media (max-width: 520px) {
  .list__item {
    grid-template-columns: 1fr;
    row-gap: 0.375rem;
  }

  .list__tags {
    position: absolute;
    top: 0.5rem;
    right: 0;
  }

  .list {
    gap: 0.75rem;
  }
}