/*
Theme Name: obscure.band
Theme URI: https://obscure.band
Author: Colin Kavanagh
Description: Editorial theme for obscure.band — Modern DIY music. ob ligature mark, cream-first design, Instrument Serif + Inter Tight.
Version: 2.0.0
Requires at least: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: obscure-band
*/

/* ================================================================
   FONTS
   ================================================================ */

@font-face {
  font-family: 'Instrument Serif';
  src: url('assets/fonts/InstrumentSerif-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  font-style: normal;
}

@font-face {
  font-family: 'Inter Tight';
  src: url('assets/fonts/InterTight-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  font-style: normal;
}

/* ================================================================
   CUSTOM PROPERTIES
   ================================================================ */

:root {
  color-scheme: light dark;

  /* Light / cream (default) */
  --bg: #f3efe6;
  --bg-elevated: #eae5da;
  --text: #111110;
  --text-secondary: #6a655c;
  --text-tertiary: #9e9889;
  --border: #d4cfc5;
  --border-subtle: #e4e0d7;
  --hover: #e8e3d9;
  --overlay: rgba(243, 239, 230, 0.6);
  --overlay-heavy: rgba(243, 239, 230, 0.9);
  --accent: #b6432d;

  /* Typography */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Inter Tight', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --size-display: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  --size-h1: clamp(2rem, 3vw + 1rem, 3.25rem);
  --size-h2: clamp(1.5rem, 2vw + 0.75rem, 2.25rem);
  --size-h3: clamp(1.25rem, 1.5vw + 0.5rem, 1.75rem);
  --size-body: clamp(1.0625rem, 0.5vw + 0.9rem, 1.1875rem);
  --size-small: clamp(0.75rem, 0.3vw + 0.65rem, 0.875rem);
  --size-tiny: clamp(0.625rem, 0.2vw + 0.55rem, 0.75rem);

  /* Spacing */
  --space-xs: clamp(0.5rem, 1vw, 0.75rem);
  --space-s: clamp(0.75rem, 1.5vw, 1rem);
  --space-m: clamp(1.25rem, 2.5vw, 2rem);
  --space-l: clamp(2rem, 4vw, 3.5rem);
  --space-xl: clamp(3rem, 6vw, 5rem);
  --space-2xl: clamp(4rem, 8vw, 8rem);

  /* Layout */
  --content-width: 720px;
  --wide-width: 1100px;
  --max-width: 1400px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration: 0.3s;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --bg-elevated: #1a1918;
    --text: #f3efe6;
    --text-secondary: #9e9889;
    --text-tertiary: #6a655c;
    --border: #2e2c28;
    --border-subtle: #222120;
    --hover: #1e1d1b;
    --overlay: rgba(17, 17, 16, 0.6);
    --overlay-heavy: rgba(17, 17, 16, 0.9);
  }
}

/* Manual overrides */
[data-theme="dark"] {
  --bg: #111110;
  --bg-elevated: #1a1918;
  --text: #f3efe6;
  --text-secondary: #9e9889;
  --text-tertiary: #6a655c;
  --border: #2e2c28;
  --border-subtle: #222120;
  --hover: #1e1d1b;
  --overlay: rgba(17, 17, 16, 0.6);
  --overlay-heavy: rgba(17, 17, 16, 0.9);
}

[data-theme="light"] {
  --bg: #f3efe6;
  --bg-elevated: #eae5da;
  --text: #111110;
  --text-secondary: #6a655c;
  --text-tertiary: #9e9889;
  --border: #d4cfc5;
  --border-subtle: #e4e0d7;
  --hover: #e8e3d9;
  --overlay: rgba(243, 239, 230, 0.6);
  --overlay-heavy: rgba(243, 239, 230, 0.9);
}

/* ================================================================
   RESET & BASE
   ================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--size-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--text);
  text-decoration-color: var(--text-tertiary);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color var(--duration) var(--ease-out);
}

a:hover {
  text-decoration-color: var(--text);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  text-wrap: balance;
}

h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

p {
  text-wrap: pretty;
  margin-block: 0.75em;
}

blockquote {
  border-inline-start: 2px solid var(--border);
  padding-inline-start: var(--space-s);
  font-style: italic;
  color: var(--text-secondary);
}

figure {
  margin: 0;
}

figcaption {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  color: var(--text-tertiary);
  margin-block-start: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: var(--space-l);
}

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

/* ================================================================
   VIEW TRANSITIONS
   ================================================================ */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
  animation-timing-function: var(--ease-in-out);
}

/* ================================================================
   LAYOUT — FULL-BLEED GRID
   ================================================================ */

.site-content {
  display: grid;
  grid-template-columns:
    [full-start] 1fr
    [wide-start] minmax(0, calc((var(--wide-width) - var(--content-width)) / 2))
    [content-start] min(var(--content-width), calc(100% - var(--gutter) * 2))
    [content-end] minmax(0, calc((var(--wide-width) - var(--content-width)) / 2))
    [wide-end] 1fr
    [full-end];
}

.site-content > * {
  grid-column: content;
}

.site-content > .alignwide {
  grid-column: wide;
}

.site-content > .alignfull,
.site-content > .full-bleed {
  grid-column: full;
}

/* ================================================================
   SITE HEADER
   ================================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--overlay-heavy);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: padding var(--duration) var(--ease-out);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space-s) var(--gutter);
}

/* ob lockup */
.ob-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  color: var(--text);
  text-decoration: none;
  font: 500 clamp(1.125rem, 1.5vw + 0.5rem, 1.375rem)/1 var(--font-body);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.ob-lockup:hover {
  text-decoration: none;
}

.ob-mark {
  height: 1.4em;
  width: auto;
  flex: 0 0 auto;
}

.ob-wordmark {
  white-space: nowrap;
}

.ob-tld {
  opacity: 0.4;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-m);
}

.site-nav__menu {
  display: flex;
  list-style: none;
  gap: var(--space-m);
}

.site-nav__menu a {
  font-family: var(--font-body);
  font-size: var(--size-small);
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--duration) var(--ease-out);
}

.site-nav__menu a:hover,
.site-nav__menu .current-menu-item a,
.site-nav__menu .current_page_item a {
  color: var(--text);
}

/* Theme toggle */
.theme-toggle {
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: color var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out);
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

/* Cream-first: default shows moon (switch to dark), dark shows sun (switch to cream) */
:root:not([data-theme]) .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  appearance: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
}

@media (max-width: 48rem) {
  .nav-toggle {
    display: block;
  }

  .site-nav__menu {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-l);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration) var(--ease-out),
                visibility var(--duration) var(--ease-out);
    padding: var(--space-xl) var(--gutter);
    overflow-y: auto;
  }

  .site-nav__menu.is-open {
    opacity: 1;
    visibility: visible;
  }

  .site-nav__menu a {
    font-size: var(--size-h2);
    font-family: var(--font-display);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
  }

  .nav-close {
    position: absolute;
    top: var(--space-s);
    right: var(--gutter);
    appearance: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
  }
}

@media (min-width: 48.0625rem) {
  .nav-close { display: none; }
}

/* ================================================================
   HERO (Homepage)
   ================================================================ */

.hero {
  position: relative;
  width: 100%;
  min-height: min(85vh, 900px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero__image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    #111110 0%,
    rgba(17, 17, 16, 0.6) 40%,
    rgba(17, 17, 16, 0.15) 100%
  );
  z-index: 1;
}

/* Hero text always on dark overlay — use stable light tokens */
.hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space-xl) var(--gutter) var(--space-l);
}

.hero__meta {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9e9889;
  margin-block-end: var(--space-xs);
}

.hero__meta a {
  color: #f3efe6;
  text-decoration: none;
}

.hero__title {
  font-size: var(--size-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  max-width: 18ch;
  color: #f3efe6;
}

.hero__title a {
  text-decoration: none;
  color: inherit;
}

/* ================================================================
   POST GRID
   ================================================================ */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--space-l);
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: var(--space-xl);
}

.post-grid--home {
  padding-block-start: var(--space-l);
}

.post-card {
  display: flex;
  flex-direction: column;
}

.post-card__image {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-elevated);
  margin-block-end: var(--space-s);
}

.post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.post-card:hover .post-card__image img {
  transform: scale(1.03);
}

.post-card__meta {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
  margin-block-end: 0.25rem;
}

.post-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.375rem);
  font-weight: 400;
  line-height: 1.25;
}

.post-card__title a {
  text-decoration: none;
}

/* Scroll-driven reveal */
@supports (animation-timeline: view()) {
  .post-card {
    animation: card-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }

  @keyframes card-reveal {
    from {
      opacity: 0;
      transform: translateY(2rem);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ================================================================
   SINGLE POST
   ================================================================ */

.single-header {
  text-align: center;
  padding-block: var(--space-xl) var(--space-m);
  padding-inline: var(--gutter);
  max-width: var(--max-width);
  margin-inline: auto;
}

.single-header__meta {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
  margin-block-end: var(--space-xs);
}

.single-header__meta a {
  color: var(--text-secondary);
  text-decoration: none;
}

.single-header__title {
  font-size: var(--size-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  max-width: 20ch;
  margin-inline: auto;
}

.single-featured {
  width: 100%;
  max-width: var(--wide-width);
  margin-inline: auto;
  margin-block: var(--space-m) var(--space-l);
  padding-inline: var(--gutter);
}

.single-featured img {
  width: 100%;
  height: auto;
}

/* Post content */
.entry-content {
  padding-inline: var(--gutter);
  max-width: calc(var(--content-width) + var(--gutter) * 2);
  margin-inline: auto;
}

.entry-content > * + * {
  margin-block-start: 1.5em;
}

.entry-content h2 {
  margin-block-start: 2em;
  margin-block-end: 0.5em;
}

.entry-content h3 {
  margin-block-start: 1.75em;
  margin-block-end: 0.5em;
}

.entry-content a {
  text-decoration-color: var(--text-secondary);
}

.entry-content a:hover {
  text-decoration-color: var(--text);
}

.entry-content em {
  color: var(--text-secondary);
}

.entry-content strong {
  font-weight: 600;
}

/* Embeds — wider breakout */
.entry-content .wp-block-embed,
.entry-content iframe,
.entry-content .wp-block-html {
  max-width: var(--wide-width);
  margin-inline: auto;
}

.entry-content .wp-block-embed {
  margin-block: var(--space-l);
}

.entry-content .wp-block-embed__wrapper {
  position: relative;
  padding-block-end: 56.25%;
  height: 0;
  overflow: hidden;
}

.entry-content .wp-block-embed__wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Standalone iframes (Bandcamp etc) */
.entry-content iframe {
  border: none;
  margin-block: var(--space-m);
}

/* Images — wider breakout */
.entry-content .wp-block-image {
  max-width: var(--wide-width);
  margin-inline: auto;
  margin-block: var(--space-l);
}

.entry-content .wp-block-image img {
  width: 100%;
  height: auto;
}

.entry-content .wp-block-image figcaption {
  text-align: center;
}

/* Lists */
.entry-content ol,
.entry-content ul {
  padding-inline-start: 1.5em;
}

.entry-content li {
  margin-block: 0.25em;
}

/* Spacer blocks */
.entry-content .wp-block-spacer {
  margin: 0 !important;
}

/* ================================================================
   POST NAVIGATION
   ================================================================ */

.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--space-m);
  padding-block: var(--space-xl);
  padding-inline: var(--gutter);
  max-width: calc(var(--content-width) + var(--gutter) * 2);
  margin-inline: auto;
  border-top: 1px solid var(--border);
}

.post-navigation a {
  font-family: var(--font-mono);
  font-size: var(--size-small);
  text-decoration: none;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--duration) var(--ease-out);
}

.post-navigation a:hover {
  color: var(--text);
}

.post-navigation__next {
  margin-inline-start: auto;
  text-align: right;
}

/* ================================================================
   ARCHIVE HEADER
   ================================================================ */

.archive-header {
  padding-block: var(--space-xl) var(--space-m);
  padding-inline: var(--gutter);
  max-width: var(--max-width);
  margin-inline: auto;
}

.archive-header__title {
  font-size: var(--size-h1);
  font-weight: 400;
}

.archive-header__description {
  font-size: var(--size-body);
  color: var(--text-secondary);
  margin-block-start: var(--space-xs);
}

/* ================================================================
   PAGE
   ================================================================ */

.page-header {
  text-align: center;
  padding-block: var(--space-xl) var(--space-m);
  padding-inline: var(--gutter);
}

.page-header__title {
  font-size: var(--size-h1);
  font-weight: 400;
}

.page-content {
  padding-inline: var(--gutter);
  max-width: calc(var(--content-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-block-end: var(--space-xl);
}

.page-content > * + * {
  margin-block-start: 1.5em;
}

/* ================================================================
   PAGINATION
   ================================================================ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-m);
  padding-block: var(--space-l) var(--space-xl);
  font-family: var(--font-mono);
  font-size: var(--size-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pagination a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

.pagination a:hover {
  color: var(--text);
}

.pagination .current {
  color: var(--text);
}

/* ================================================================
   FOOTER
   ================================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-m) var(--gutter);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin-inline: auto;
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.site-footer a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

.site-footer a:hover {
  color: var(--text);
}

.footer-social {
  display: flex;
  gap: var(--space-s);
  list-style: none;
}

/* ================================================================
   404
   ================================================================ */

.error-404 {
  text-align: center;
  padding-block: var(--space-2xl);
  padding-inline: var(--gutter);
}

.error-404__code {
  font-family: var(--font-display);
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 400;
  line-height: 1;
  color: var(--border);
}

.error-404__message {
  font-size: var(--size-h3);
  color: var(--text-secondary);
  margin-block-start: var(--space-s);
}

.error-404__link {
  display: inline-block;
  margin-block-start: var(--space-m);
  font-family: var(--font-mono);
  font-size: var(--size-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ================================================================
   SEARCH
   ================================================================ */

.search-form {
  display: flex;
  max-width: 24rem;
}

.search-form input[type="search"] {
  flex: 1;
  font-family: var(--font-body);
  font-size: var(--size-body);
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  outline: none;
  transition: border-color var(--duration) var(--ease-out);
}

.search-form input[type="search"]:focus {
  border-color: var(--text-secondary);
}

.search-form button {
  font-family: var(--font-mono);
  font-size: var(--size-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  cursor: pointer;
}

/* ================================================================
   FORMS (Ninja Forms compat)
   ================================================================ */

.nf-form-cont .nf-field-element input,
.nf-form-cont .nf-field-element textarea {
  font-family: var(--font-body) !important;
  font-size: var(--size-body) !important;
  background: var(--bg-elevated) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  padding: 0.5rem 0.75rem !important;
}

.nf-form-cont .nf-field-element input:focus,
.nf-form-cont .nf-field-element textarea:focus {
  border-color: var(--text-secondary) !important;
  outline: none !important;
}

.nf-form-cont input[type="submit"],
.nf-form-cont .nf-field-element input[type="button"] {
  font-family: var(--font-mono) !important;
  font-size: var(--size-small) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  background: var(--text) !important;
  color: var(--bg) !important;
  border: 1px solid var(--text) !important;
  padding: 0.75rem 1.5rem !important;
  cursor: pointer !important;
}

.nf-form-cont .nf-field-label label {
  font-family: var(--font-mono) !important;
  font-size: var(--size-small) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--text-secondary) !important;
}

/* ================================================================
   UTILITIES
   ================================================================ */

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  word-wrap: normal !important;
}

.no-scroll {
  overflow: hidden;
}
