/* ---------- fonts + base ---------- */
@font-face {
  font-family: 'Kramerized';
  src: url('../fonts/Kramerized.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Ticketing';
  src: url('../fonts/Ticketing.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'YDGothic 140 Pro';
  src: url('../fonts/YDGothic%20140%20Pro.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

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

:root {
  --scale: 1.5;
  --header-height: calc(72px * var(--scale));
  --page-px: 2rem;

  --bg: #ffffff;
  --text: #000000;
  --text-muted: #666666;
  --border: #000000;
  --border-muted: #cccccc;

  --header-bg: #ffffff;

  --brand-color: #ffe600;

  --subscribe-btn-bg: #000000;
  --subscribe-btn-color: #ffffff;
  --subscribe-loading-bg: #808080;
  --subscribe-loading-color: #ffffff;
  --subscribe-success-bg: #000000;
  --subscribe-success-color: #ffffff;
}

html {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: calc(14px * var(--scale));
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 768px) {
  :root {
    --page-px: 1rem;
  }
}

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

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

/* ---------- layout ---------- */
.layout-main {
  padding-top: var(--header-height);
  min-height: 100vh;
}

.header__inner,
.page-gutter {
  width: 100%;
  padding-inline: var(--page-px);
}

/* ---------- header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-block: 1rem;
  height: var(--header-height);
  background-color: var(--header-bg);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
}

.header__logo {
  font-family: 'Kramerized', serif;
  font-size: 2rem;
  color: #000000;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.header__filter-toggle {
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 0.5rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: width 0.15s;
  width: 1.6rem;
}

.header__filter-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.header__filter-toggle-label {
  display: none;
}

.header__filter-toggle--open {
  padding: 0 0.75rem;
  width: 100%;
  justify-content: flex-start;
}

.header__filter-toggle--open .header__filter-toggle-icon {
  display: none;
}

.header__filter-toggle--open .header__filter-toggle-label {
  display: inline;
}

.header__spacer {
  flex: 1;
}

.header__break {
  display: none;
}

.header__about {
  font-family: 'Kramerized', serif;
  font-size: 2rem;
  color: #000000;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

/* Filter wrapper — sized to button so panel anchors flush to button bottom */
.filter-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px; /* shared width contract with panel */
}

/* Filter dropdown panel */
.filter-panel {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%; /* matches wrapper width */
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  padding: 0.35rem 0.6rem;
}

.filter-panel[hidden] {
  display: none;
}

.filter-panel__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.filter-panel__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}

.filter-panel__item label {
  cursor: pointer;
}

.filter-panel__item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  background: #fff;
  border: 1.5px solid var(--text);
  border-radius: 2px;
  position: relative;
}

.filter-panel__item input[type="checkbox"]:checked::before {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: #000;
  font-weight: 900;
  -webkit-text-stroke: 0.5px #000;
}

/* Tablet: filters wrap to second row */
@media (max-width: 1200px) {
  :root {
    --header-height: 150px;
  }

  .header {
    height: auto;
  }

  .header__inner {
    flex-wrap: wrap;
    align-content: flex-start;
    height: auto;
  }

  .filter-wrapper {
    order: 10;
    flex: 0 0 100%;
    min-width: 0;
    padding-bottom: 0.5rem;
  }
}

/* Mobile: two independent flex rows via zero-height break element */
@media (max-width: 930px) {
  .header__break {
    display: block;
    order: 5;
    flex: 0 0 100%;
    height: 0;
  }

  .filter-wrapper {
    flex: 0 0 auto;
    padding-bottom: 0;
  }

  .header__inner .subscribe-form {
    order: 11;
    flex: 1 1 auto;
  }

  .header__inner .subscribe-form input[type="email"] {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .header__inner:has(.header__filter-toggle--open) .subscribe-form {
    display: none;
  }

  .header__inner:has(.header__filter-toggle--open) .filter-wrapper {
    flex: 1 1 auto;
  }
}

/* Mobile: font size reductions */
@media (max-width: 768px) {
  :root {
    --header-height: 120px;
  }

  .header {
    padding-block: 0.75rem;
  }
}

/* ---------- explore grid ---------- */
.grid {
  columns: 6 180px;
  column-gap: 6px;
}

@media (max-width: 900px) {
  .grid {
    columns: 3;
  }
}

@media (max-width: 560px) {
  .grid {
    columns: 2;
  }
}

.grid-item {
  break-inside: avoid;
  margin-bottom: 6px;
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.grid-item--hidden {
  display: none;
}

.grid-item .grid-item__image {
  width: 100%;
  height: auto;
  display: block;
}

.grid-item .grid-item__overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.grid-item:hover .grid-item__overlay {
  opacity: 1;
}

.grid-item .grid-item__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.grid-item .grid-item__title {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.75rem;
  font-weight: normal;
  line-height: 1;
  color: #000;
  background-color: #fff;
  padding: 0.1rem 0.35rem;
}

.grid-item .grid-item__info {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.65rem;
  color: #666;
  background-color: #fff;
  padding: 0.1rem 0.35rem;
}

.grid-item--text .grid-item__text-card {
  display: block;
  padding: 1rem 0.75rem;
  min-height: 210px;
  background: #f5f5f5;
}

.grid-item--text:hover .grid-item__title {
  text-decoration: underline;
}

.grid-item--text .grid-item__title {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.8rem;
  font-weight: normal;
  line-height: 1.3;
  color: #000;
}

.grid-item--text .grid-item__info {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.65rem;
  color: #999;
  margin-top: 0.3rem;
}

/* ---------- about page ---------- */
.about-page {
  padding: 3rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3rem;
  width: 100%;
}

.about-body {
  width: 100%;
  max-width: none;
}

.about-body :where(p, ul, ol) {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.85rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1rem;
}

.about-body :where(p, ul, ol):last-child {
  margin-bottom: 0;
}

.about-body :where(.kg-card, figure) {
  margin-inline: 0;
  max-width: none;
}

.about-links-section {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.85rem;
}

.about-links-section__heading {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.about-links-section__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.about-links-section__list a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.about-links-section__list a:hover {
  opacity: 0.7;
}

.about-contact {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.85rem;
  color: var(--text);
}

.about-contact a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (max-width: 900px) {
  .about-page {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 0;
  }
}

/* ---------- post page ---------- */
.post-header {
  padding: 2.5rem 0 1rem;
  text-align: center;
}

.post-title {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 2.5rem;
  font-weight: normal;
  line-height: 1.15;
  color: var(--text);
}

.post-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.post-tag {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  padding: 0.2em 0.55em;
  white-space: nowrap;
}

.post-feature {
  display: block;
  width: 100%;
  height: auto;
}

.post-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0 2rem;
  width: 100%;
}

.post-body {
  flex: 1;
  min-width: 0;
  max-width: 32rem;
  margin-inline: auto;
  text-align: left;
}

.post-body :where(img) {
  max-width: 100%;
  height: auto;
}

.post-links {
  flex-shrink: 0;
  text-align: left;
}

.post-links__label {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.75rem;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.post-links__icons {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.post-links__icon {
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.post-links__icon svg {
  width: 100%;
  height: 100%;
}

.post-links__icon:hover {
  opacity: 0.6;
}

.post-links__icon--copied {
  color: var(--text-muted);
}

.post-body :where(p, h2, h3, h4, ul, ol) {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.post-body :where(p, h2, h3, h4, ul, ol):last-child {
  margin-bottom: 0;
}

.post-body :where(h2, h3, h4) {
  font-family: 'Kramerized', serif;
  font-size: 1.4rem;
  font-weight: normal;
  margin-bottom: 0.75rem;
}

.post-body :where(p, h2, h3, h4, ul, ol, blockquote) {
  text-align: left;
}

.post-body :where(ul, ol) {
  padding-left: 0;
  list-style-position: inside;
}

.post-body :where(a) {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.post-body :where(blockquote) {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
}

.post-body :where(pre) {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 1rem;
  overflow-x: auto;
  background: rgba(128, 128, 128, 0.1);
  margin-bottom: 1.25rem;
}

.post-body :where(figure) {
  margin: 1.5rem 0;
}

.post-body :where(figcaption) {
  font-family: 'YDGothic 140 Pro', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.post-body :where(.kg-card, .kg-image-card, figure.kg-card-hascaption) {
  margin-inline: 0;
  width: 100%;
  max-width: none;
}

.post-body :where(.kg-width-wide) {
  position: relative;
  left: 50%;
  right: 50%;
  width: 100vw;
  max-width: 1000px;
  margin-left: -50vw;
  margin-right: -50vw;
}

.post-body :where(.kg-width-full) {
  position: relative;
  left: 50%;
  right: 50%;
  width: 100vw;
  max-width: 100vw;
  margin-left: -50vw;
  margin-right: -50vw;
}

.post-body :where(hr) {
  border: none;
  border-top: 1px solid var(--border-muted);
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .post-header {
    padding: 1.5rem 0 1rem;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .post-content {
    flex-direction: column;
    padding: 0.75rem 0 1.5rem;
    gap: 0.75rem;
  }

  .post-body {
    max-width: none;
    margin-inline: 0;
  }
}

/* ---------- error page ---------- */
.error-content {
  padding: 4rem 0;
  text-align: center;
}

.error-content p {
  font-family: 'YDGothic 140 Pro', monospace;
  margin-top: 1rem;
}

/* ---------- subscribe form (Ghost native member form) ---------- */
.subscribe-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
  position: relative;
}

.subscribe-form input[type="email"] {
  box-sizing: border-box;
  height: 1.75rem;
  width: 300px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
  font-family: 'YDGothic 140 Pro', monospace;
  font-weight: bold;
  text-align: center;
  outline: none;
}

.subscribe-form input[type="email"]::placeholder {
  color: var(--text-muted);
  font-weight: bold;
}

.subscribe-form button[type="submit"] {
  box-sizing: border-box;
  height: 1.75rem;
  padding: 0 1.25rem;
  background-color: var(--subscribe-btn-bg);
  color: var(--subscribe-btn-color);
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: 'YDGothic 140 Pro', monospace;
  font-weight: bold;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.subscribe-form button[type="submit"]:hover:not(:disabled) {
  opacity: 0.85;
}

.subscribe-form button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.subscribe-form__label-loading {
  display: none;
}

.subscribe-form.loading button[type="submit"] {
  background-color: var(--subscribe-loading-bg);
  color: var(--subscribe-loading-color);
  opacity: 1;
  cursor: wait;
}

.subscribe-form.loading input[type="email"] {
  opacity: 0.65;
}

.subscribe-form.loading .subscribe-form__label-default {
  display: none;
}

.subscribe-form.loading .subscribe-form__label-loading {
  display: inline;
}

.subscribe-form__error {
  position: absolute;
  top: 100%;
  left: 0;
  font-size: 0.7rem;
  color: #c62828;
  margin-top: 0.25rem;
  white-space: nowrap;
  display: none;
}

.subscribe-form.error .subscribe-form__error {
  display: block;
}

.subscribe-form__success {
  box-sizing: border-box;
  display: none;
  align-items: center;
  justify-content: center;
  height: 1.75rem;
  padding: 0 1.25rem;
  background-color: var(--subscribe-success-bg);
  color: var(--subscribe-success-color);
  font-size: 0.75rem;
  font-family: 'YDGothic 140 Pro', monospace;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

.subscribe-form.success input[type="email"],
.subscribe-form.success button[type="submit"] {
  display: none;
}

.subscribe-form.success .subscribe-form__success {
  display: inline-flex;
}

@media (max-width: 600px) {
  .subscribe-form input[type="email"] {
    width: 195px;
  }
}
