:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #686868;
  --line: #dedede;
  --paper: #ffffff;
  --soft: #f3f4f5;
  --accent: #d82731;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(222, 222, 222, 0.86);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
}

.brand-mark {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.shuffle-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.shuffle-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.shuffle-button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.shuffle-icon {
  font-size: 20px;
  line-height: 1;
}

main {
  min-height: calc(100vh - 150px);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  align-items: end;
  gap: 8vw;
  padding: 9vh 4vw 6vh;
}

.kicker {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  max-width: 850px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 108px;
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 410px;
  margin: 0 0 7px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.55;
}

.gallery-wrap {
  padding: 0 4vw 5vh;
}

.gallery-status {
  min-height: 56vh;
  display: grid;
  place-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.gallery-status[hidden] {
  display: none;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 8px;
  gap: 16px;
}

.gallery-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--placeholder-color, var(--soft));
  cursor: zoom-in;
  isolation: isolate;
  transform: translateZ(0);
}

.gallery-item img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 320ms ease, transform 420ms ease;
}

.gallery-item.is-loaded img {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.018);
}

.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 20%,
    color-mix(in srgb, var(--placeholder-highlight, #fff) 48%, transparent) 45%,
    transparent 70%
  );
  transform: translateX(-110%);
  animation: gallery-placeholder 1.9s ease-in-out infinite;
  transition: opacity 220ms ease;
}

.gallery-item.is-loaded::before,
.gallery-item.is-error::before {
  opacity: 0;
  animation: none;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: inherit;
  pointer-events: none;
}

.gallery-item.is-error {
  cursor: default;
}

.gallery-item:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 3px;
}

@keyframes gallery-placeholder {
  55%,
  100% {
    transform: translateX(110%);
  }
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 28px;
  margin: 0 4vw;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

footer a {
  color: inherit;
  text-underline-offset: 3px;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 28px 74px 24px;
  border: 0;
  background: rgba(12, 12, 12, 0.97);
  color: #fff;
}

.lightbox[open] {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.lightbox figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  height: 100%;
  margin: 0;
}

.lightbox img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.lightbox figcaption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 22px;
  color: #c6c6c6;
  font-size: 12px;
}

.lightbox button {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 34px;
  line-height: 1;
}

.lightbox button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-close {
  top: 18px;
  right: 18px;
  font-size: 28px !important;
}

.lightbox-nav {
  top: calc(50% - 22px);
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 8vh;
  }

  h1 {
    font-size: 72px;
  }

  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    min-height: 58px;
  }

  .brand {
    font-size: 16px;
  }

  .shuffle-button span:last-child {
    display: none;
  }

  .shuffle-button {
    width: 38px;
    justify-content: center;
    border: 0;
  }

  .intro {
    padding: 7vh 4vw 5vh;
  }

  h1 {
    font-size: 52px;
  }

  .intro-copy {
    font-size: 16px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .lightbox {
    padding: 56px 10px 18px;
  }

  .lightbox-nav {
    top: auto;
    bottom: 14px;
  }

  .lightbox figcaption {
    padding: 0 54px;
  }

  .lightbox-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .gallery-item img {
    transition: none;
  }

  .gallery-item::before {
    animation: none;
  }
}

/* Community and member access */

.header-actions,
.site-nav {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 28px;
}

.site-nav {
  gap: 24px;
}

.site-nav a,
.text-command {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.is-active,
.text-command:hover {
  color: var(--ink);
}

.site-nav a.is-active {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.community-main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 4vw 8vh;
}

.community-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  align-items: end;
  gap: 7vw;
  padding: 8vh 0 6vh;
  border-bottom: 1px solid var(--line);
}

.community-intro h1,
.auth-heading h1,
.application-intro h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

.community-intro h1 {
  max-width: 780px;
  font-size: 76px;
  line-height: 1;
}

.community-intro > p {
  max-width: 430px;
  margin: 0 0 5px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.55;
}

.community-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 5vw;
  padding-top: 44px;
}

.board-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.board-heading h2,
.community-aside h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

.board-heading h2 {
  font-size: 30px;
}

.new-topic-link,
.primary-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}

.new-topic-link:hover,
.primary-command:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-tabs {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.category-tab {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
}

.category-tab:hover,
.category-tab.is-selected {
  background: var(--soft);
  color: var(--ink);
}

.topic-list {
  border-top: 1px solid var(--line);
}

.topic-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.topic-row[hidden] {
  display: none;
}

.topic-thumb {
  width: 148px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--soft);
}

.topic-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 260ms ease;
}

.topic-thumb.is-loaded img {
  opacity: 1;
}

.topic-copy {
  min-width: 0;
}

.topic-category {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.topic-copy h3 {
  margin: 7px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: 0;
}

.topic-copy h3 a {
  color: var(--ink);
  text-decoration: none;
}

.topic-copy h3 a:hover {
  color: var(--accent);
}

.topic-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: #8a8a8a;
  font-size: 11px;
}

.topic-meta span + span::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 9px 2px 0;
  border-radius: 50%;
  background: #aaa;
}

.community-aside {
  border-left: 1px solid var(--line);
  padding-left: 30px;
}

.community-aside section {
  padding: 0 0 30px;
}

.community-aside section + section {
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.community-aside h2 {
  font-size: 27px;
  line-height: 1.1;
}

.community-aside p:not(.section-label) {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.community-numbers {
  display: grid;
  gap: 18px;
}

.community-numbers div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.community-numbers strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 400;
}

.community-numbers span {
  color: var(--muted);
  font-size: 11px;
}

.community-guidelines {
  display: grid;
  gap: 11px;
}

.community-guidelines .section-label {
  margin-bottom: 2px;
}

.community-guidelines a {
  color: var(--ink);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}

.auth-main {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 150px);
  padding: 56px 20px;
  background: #f7f7f6;
}

.login-page .auth-main {
  justify-content: end;
  min-height: calc(100vh - 68px);
  padding: clamp(38px, 6vh, 76px) 7vw;
  background-image: url("/assets/tokyo-rainbow-bridge.webp");
  background-position: center;
  background-size: cover;
}

.auth-panel {
  width: min(100%, 480px);
  padding: 38px 40px 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.login-page .auth-panel {
  width: min(440px, 100%);
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(0, 11, 35, 0.34);
  backdrop-filter: blur(12px);
}

.auth-heading {
  margin-bottom: 30px;
}

.auth-heading h1 {
  font-size: 46px;
  line-height: 1.05;
}

.auth-heading > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.secure-session {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: -10px 0 24px;
  padding: 0 11px;
  border: 1px solid #d6dfda;
  border-radius: 3px;
  background: #f4f8f5;
  color: #385147;
  font-size: 11px;
}

.secure-session-mark {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3b8061;
  box-shadow: 0 0 0 3px rgba(59, 128, 97, 0.12);
}

.secure-session time {
  margin-left: auto;
  color: #60746b;
  font-variant-numeric: tabular-nums;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.field label,
.interest-field legend {
  color: #343434;
  font-size: 12px;
  font-weight: 600;
}

.label-row,
.field-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.label-row a,
.auth-footnote a,
.form-caption a {
  color: var(--ink);
  font-size: 12px;
  text-underline-offset: 3px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.field input {
  height: 44px;
  padding: 0 12px;
}

.field textarea {
  min-height: 138px;
  padding: 11px 12px;
  line-height: 1.5;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.field-error {
  min-height: 15px;
  color: #b4232c;
  font-size: 11px;
  line-height: 1.35;
}

.turnstile-wrap {
  min-height: 78px;
  margin: 4px 0 18px;
  overflow: hidden;
}

.form-message {
  min-height: 18px;
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.45;
}

.form-message.is-error {
  padding: 11px 12px;
  border-left: 3px solid var(--accent);
  background: #fff2f2;
  color: #8b1f26;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.primary-button:hover {
  background: #333;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.auth-footnote,
.form-caption {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.application-main {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 0.65fr);
  gap: 9vw;
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding: 8vh 0 9vh;
}

.application-intro {
  align-self: start;
  position: sticky;
  top: 120px;
}

.application-intro h1 {
  max-width: 620px;
  font-size: 68px;
  line-height: 1;
}

.application-intro > p:not(.kicker) {
  max-width: 560px;
  margin: 24px 0 38px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
}

.application-notes {
  display: grid;
  max-width: 560px;
  border-top: 1px solid var(--line);
}

.application-notes div {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.application-notes strong {
  color: var(--accent);
  font-size: 11px;
}

.application-form-wrap {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.interest-field {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.interest-field legend {
  margin-bottom: 10px;
}

.interest-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.interest-options label {
  position: relative;
}

.interest-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.interest-options span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.interest-options input:checked + span {
  border-color: var(--ink);
  background: var(--soft);
  color: var(--ink);
}

.field-detail {
  color: #8a8a8a;
  font-size: 10px;
}

.privacy-note {
  margin: 2px 0 22px;
  padding: 12px 13px;
  border-left: 3px solid #7b8c80;
  background: #f1f5f2;
  color: #4a5b4e;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .community-intro {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .community-intro h1 {
    font-size: 58px;
  }

  .community-layout {
    grid-template-columns: 1fr;
  }

  .community-aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 34px 0 0;
  }

  .community-aside section + section {
    border-top: 0;
    padding-top: 0;
  }

  .application-main {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .application-intro {
    position: static;
  }
}

@media (max-width: 640px) {
  .site-nav {
    gap: 14px;
  }

  .site-nav a {
    font-size: 12px;
  }

  .header-actions {
    gap: 13px;
  }

  .site-header .text-command {
    display: none;
  }

  .community-intro {
    padding: 6vh 0 5vh;
  }

  .community-intro h1 {
    font-size: 46px;
  }

  .community-layout {
    padding-top: 30px;
  }

  .board-heading {
    align-items: start;
    flex-direction: column;
  }

  .topic-row {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 0;
  }

  .topic-thumb {
    width: 92px;
  }

  .topic-copy h3 {
    margin-top: 5px;
    font-size: 18px;
  }

  .topic-copy p {
    display: none;
  }

  .topic-meta {
    gap: 7px;
    margin-top: 8px;
  }

  .topic-meta span:nth-child(2) {
    display: none;
  }

  .community-aside {
    grid-template-columns: 1fr;
  }

  .auth-main {
    display: block;
    padding: 34px 4vw;
    background: #fff;
  }

  .login-page .auth-main {
    display: grid;
    align-items: end;
    min-height: calc(100svh - 58px);
    padding: 32vh 4vw 5vw;
    background-position: 43% center;
  }

  .auth-panel {
    padding: 20px 0;
    border: 0;
  }

  .login-page .auth-panel {
    width: 100%;
    padding: 24px 22px;
    border: 1px solid rgba(255, 255, 255, 0.72);
  }

  .auth-heading h1 {
    font-size: 40px;
  }

  .application-main {
    width: 92vw;
    padding-top: 6vh;
  }

  .application-intro h1 {
    font-size: 48px;
  }

  .application-form-wrap {
    padding: 0;
    border: 0;
  }

  .interest-options {
    grid-template-columns: 1fr;
  }
}
