/*
Theme Name: HumanTangle
Theme URI: https://humantangle.com/
Author: Rehan Anjum
Description: Native WordPress block theme for HumanTangle, an independent publication investigating recurring human patterns and the interacting forces behind them.
Version: 1.1.0
Requires at least: 7.1
Requires PHP: 7.4
Text Domain: humantangle
*/

:root {
  --ht-bg: var(--wp--preset--color--blackened-violet, #17141C);
  --ht-surface: var(--wp--preset--color--deep-violet-surface, #211B29);
  --ht-text: var(--wp--preset--color--human-bone, #E9E4DC);
  --ht-muted: var(--wp--preset--color--muted-mauve, #9A8A99);
  --ht-accent: var(--wp--preset--color--interface-carmine, #D85C72);
  --ht-soft: var(--wp--preset--color--soft-mauve, #A98695);
  --ht-brand: var(--wp--preset--color--brand-carmine, #B8324A);
  --ht-line: color-mix(in srgb, var(--ht-soft) 24%, transparent);
  --ht-content: 760px;
  --ht-wide: 1180px;
  --ht-radius: 18px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--ht-bg);
  color: var(--ht-text);
  font-family: Literata, Georgia, "Times New Roman", serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { text-underline-offset: .18em; }
:where(a, button, input, textarea, select, .wp-element-button, .wp-block-navigation-item__content):focus-visible {
  outline: 2px solid var(--ht-accent);
  outline-offset: 4px;
}

img, video, iframe { max-width: 100%; }

.ht-site-header {
  position: relative;
  border-bottom: 1px solid color-mix(in srgb, var(--ht-soft) 18%, transparent);
  background: color-mix(in srgb, var(--ht-bg) 96%, transparent);
}
.ht-site-header .wp-block-site-title,
.ht-site-header .wp-block-site-title a {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: .01em;
  text-decoration: none;
}
.ht-site-header .wp-block-navigation,
.ht-site-footer .wp-block-navigation,
.ht-kicker,
.ht-meta,
.ht-eyebrow {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.ht-site-header .wp-block-navigation-item__content,
.ht-site-footer .wp-block-navigation-item__content {
  text-decoration: none;
}
.ht-site-header .wp-block-navigation-item__content {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.ht-section {
  position: relative;
  padding-top: clamp(4rem, 8vw, 8rem);
  padding-bottom: clamp(4rem, 8vw, 8rem);
}
.ht-section--surface { background: var(--ht-surface); }
.ht-section--bordered { border-top: 1px solid color-mix(in srgb, var(--ht-soft) 20%, transparent); }
.ht-section > * { position: relative; z-index: 1; }

.ht-hero {
  overflow: hidden;
  min-height: min(78vh, 780px);
  display: flex;
  align-items: center;
  padding-top: clamp(5rem, 9vw, 9rem);
  padding-bottom: clamp(5rem, 9vw, 9rem);
  isolation: isolate;
}
.ht-hero::before,
.ht-hero::after {
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}
.ht-hero::before {
  width: min(50vw, 620px);
  aspect-ratio: 1;
  right: -9%;
  top: 8%;
  border: 1px solid color-mix(in srgb, var(--ht-accent) 30%, transparent);
  border-radius: 48% 52% 42% 58% / 63% 44% 56% 37%;
  transform: rotate(17deg);
}
.ht-hero::after {
  width: min(62vw, 820px);
  height: 1px;
  right: -8%;
  top: 48%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ht-brand) 76%, transparent), transparent);
  box-shadow:
    0 104px 0 color-mix(in srgb, var(--ht-soft) 18%, transparent),
    0 -124px 0 color-mix(in srgb, var(--ht-soft) 13%, transparent);
  transform: rotate(-12deg);
}
.ht-hero h1,
.ht-display,
.wp-block-post-title,
h1, h2, h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
}
.ht-hero h1 {
  max-width: 12ch;
  font-size: clamp(4.2rem, 10vw, 8.8rem);
  line-height: .88;
  letter-spacing: -.035em;
  margin-bottom: .25em;
}
.ht-hero .ht-subtitle {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  color: var(--ht-soft);
  margin-top: 0;
}
.ht-hero .ht-lede {
  max-width: 46rem;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.55;
}
.ht-kicker, .ht-eyebrow, .ht-meta {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .76rem;
  color: var(--ht-muted);
}
.ht-eyebrow { color: var(--ht-accent); }

.wp-block-button .wp-block-button__link,
.wp-element-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
}
.wp-block-button .wp-block-button__link:hover { transform: translateY(-2px); }
.ht-button--ghost .wp-block-button__link {
  background: transparent;
  color: var(--ht-text);
  border: 1px solid color-mix(in srgb, var(--ht-text) 34%, transparent);
}

.ht-card {
  height: 100%;
  padding: clamp(1.4rem, 2.6vw, 2.2rem);
  background: color-mix(in srgb, var(--ht-surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--ht-soft) 20%, transparent);
  border-radius: var(--ht-radius);
  transition: transform .18s ease, border-color .18s ease;
}
.ht-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--ht-accent) 50%, transparent);
}
.ht-card h3 { margin-top: 0; font-size: clamp(1.55rem, 2vw, 2.15rem); }
.ht-grid { gap: clamp(1rem, 2vw, 1.5rem); }
.ht-sample {
  border-left: 2px solid var(--ht-brand);
  padding: clamp(1.6rem, 4vw, 3rem);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ht-surface) 98%, transparent), color-mix(in srgb, var(--ht-bg) 78%, transparent));
  border-radius: 0 var(--ht-radius) var(--ht-radius) 0;
}
.ht-sample p { font-size: clamp(1.08rem, 1.5vw, 1.24rem); line-height: 1.78; }
.ht-chapter-list {
  list-style: none;
  padding: 0;
  counter-reset: htchapter;
  border-top: 1px solid color-mix(in srgb, var(--ht-soft) 20%, transparent);
}
.ht-chapter-list li {
  counter-increment: htchapter;
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ht-soft) 20%, transparent);
}
.ht-chapter-list li::before {
  content: counter(htchapter, decimal-leading-zero);
  color: var(--ht-accent);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .78rem;
  letter-spacing: .12em;
}
.ht-question { font-size: clamp(2rem, 6vw, 5.2rem); line-height: .95; color: var(--ht-text); }

.ht-reading-surface,
:where(.single-post .wp-block-post-content) {
  max-width: var(--ht-content);
  margin-left: auto;
  margin-right: auto;
}
:where(.single-post .wp-block-post-content) p,
:where(.single-post .wp-block-post-content) li,
.ht-reading-surface p,
.ht-reading-surface li {
  font-size: clamp(1.05rem, 1.25vw, 1.18rem);
  line-height: 1.78;
}
:where(.single-post .wp-block-post-content) a,
.ht-reading-surface a { overflow-wrap: anywhere; }
:where(.single-post .wp-block-post-content) blockquote,
.ht-reading-surface blockquote {
  border-left: 2px solid var(--ht-accent);
  margin-left: 0;
  padding-left: 1.5rem;
  color: var(--ht-text);
}
:where(.single-post .wp-block-post-content) .wp-block-table,
.ht-reading-surface .wp-block-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
:where(.single-post .wp-block-post-content) table,
.ht-reading-surface table {
  width: 100%;
  border-collapse: collapse;
}
:where(.single-post .wp-block-post-content) th,
:where(.single-post .wp-block-post-content) td,
.ht-reading-surface th,
.ht-reading-surface td {
  border: 1px solid color-mix(in srgb, var(--ht-soft) 25%, transparent);
  padding: .8rem;
  vertical-align: top;
}
:where(.single-post .wp-block-post-content) pre,
.ht-reading-surface pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--ht-line);
  border-radius: 10px;
}

.ht-archive-card {
  padding: 1.4rem 0 1.7rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ht-soft) 20%, transparent);
}
.ht-archive-card .wp-block-post-title a { text-decoration: none; }
.ht-archive-card .wp-block-post-excerpt { color: var(--ht-muted); }

.ht-page-shell { padding-top: clamp(4rem, 7vw, 7rem); padding-bottom: clamp(5rem, 8vw, 9rem); }
.ht-page-shell > .wp-block-post-content { max-width: var(--ht-content); margin-inline: auto; }
.ht-page-shell .wp-block-post-title { max-width: 14ch; font-size: clamp(3.2rem, 7vw, 6.4rem); line-height: .92; }

.ht-site-footer {
  border-top: 1px solid color-mix(in srgb, var(--ht-soft) 20%, transparent);
  background: color-mix(in srgb, var(--ht-bg) 86%, black);
  padding-top: 3.5rem;
  padding-bottom: 2.5rem;
}
.ht-site-footer .wp-block-site-title { font-family: "Instrument Serif", Georgia, serif; }
.ht-site-footer .ht-disclaimer { max-width: 60rem; color: var(--ht-muted); font-size: .86rem; }
.ht-site-footer .wp-block-social-links { margin-top: 1.2rem; }
.ht-site-footer .wp-block-social-links .wp-social-link {
  transition: transform .18s ease, opacity .18s ease;
}
.ht-site-footer .wp-block-social-links .wp-social-link:hover { transform: translateY(-2px); }

@media (max-width: 782px) {
  .ht-site-header .wp-block-buttons { display: none; }
  .ht-section, .ht-hero { padding-left: 1.1rem; padding-right: 1.1rem; }
  .ht-hero { min-height: auto; }
  .ht-hero::before { right: -36%; top: 8%; width: 90vw; opacity: .7; }
  .ht-hero::after { width: 110vw; right: -35%; top: 40%; }
  .ht-grid { gap: .85rem; }
  .ht-chapter-list li { grid-template-columns: 2.7rem 1fr; }
}

@media (max-width: 480px) {
  .ht-hero h1 { font-size: clamp(3.15rem, 17vw, 4.2rem); }
  .ht-hero .ht-subtitle { font-size: clamp(1.75rem, 10vw, 2.4rem); }
  .ht-section, .ht-hero { padding-left: .85rem; padding-right: .85rem; }
  .ht-chapter-list li { grid-template-columns: 2.35rem minmax(0, 1fr); gap: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
