.page-container {
  margin: 3rem 0 0;
  justify-content: center;
}

.page-container h1 {
  font-size: 2.0rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .page-container h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .page-container h1 {
    font-size: 1.3rem;
  }
}

.page-container h1, .page-container h3 {
  text-align: center;
  margin: 1rem;
}

.text-primary {
  color: #2A0A0A;
}

hr {
  border-color: #2A0A0A;
  border-width: 2px;
  max-width: 3rem;
  margin: auto;
}

hr.light { border-color: #2A0A0A; }

p {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
}

.text-center {
  text-align: center;
}

.page__image {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  object-fit: cover;
}

.page__article {
  text-align: center;
  margin: 1rem auto;
}

.page__article_white {
  background-color: #FDF6EC;
  color: #1A1A1A;
  text-align: left;
  margin: 2rem auto;
  padding: 1rem;
}

@media screen and (max-width: 768px) {
  .page__article_white {
    margin: 1rem;
    padding: 0.75rem;
  }
}

@media screen and (min-width: 900px) {
  .page__article_white {
    max-width: 860px;
    padding: 1rem 3rem;
  }
}

.page__article_white2 {
  background-color: #FDF6EC;
  color: #1A1A1A;
  text-align: center;
  margin: 2rem auto;
  padding: 1rem;
}

@media screen and (max-width: 768px) {
  .page__article_white2 {
    margin: 1rem;
    padding: 0.75rem;
  }
}

@media screen and (min-width: 900px) {
  .page__article {
    text-align: center;
    margin: 1rem auto;
  }
}

.page__article p {
  padding: 0.5rem 2.5rem;
}

@media screen and (max-width: 768px) {
  .page__article p {
    padding: 0.5rem 1rem;
  }
}

@media screen and (max-width: 480px) {
  .page__article p {
    padding: 0.5rem 0.5rem;
  }
}

.page__article ul, .page__article ol{
  list-style-position: inside;
  margin-left: 1rem;
}

@media screen and (max-width: 480px) {
  .page__article ul, .page__article ol {
    margin-left: 0.5rem;
  }
}

.page__article li {
  padding: 0.2rem 0;
}

.page__article a, .page__article a:visited {
  color: #2A0A0A;
}

.page__image {
  text-align: center;
}

h2 {
  margin: 1rem 0;
}

@media (max-width: 768px) {
  h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  h2 {
    font-size: 1.3rem;
  }
}

.page-post-card__link {
  display: block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius, 0.375rem);
  background: #2A0A0A;
  text-align: center;
  max-width: 30rem;
  margin: 2rem auto;
  transition: transform 0.2s ease;
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  box-sizing: border-box;
}

.page-post-card__link:hover {
  transform: translateY(-5px);
}

.page-post-card__link a {
  text-decoration: none;
  color: #FDF6EC;
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  .page-post-card__link {
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    max-width: 90%;
    margin: 1.5rem auto;
  }
}

@media (max-width: 480px) {
  .page-post-card__link {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    max-width: 95%;
    margin: 1rem auto;
  }
}

/* Service box styling */

.service-column {
  float: left;
  width: 25%;
  margin: auto;
}

.service-row:after {
  content: "";
  display: table;
  clear: both;
}

@media screen and (max-width: 900px) {
  .service-column {
    width: 100%;
    margin: auto;
  }
}

.service-box {
  margin: 50px auto 0;
  padding: 1rem;
}

@media (max-width: 768px) {
  .service-box {
    margin: 30px auto 0;
    padding: 0.75rem;
  }
}

@media (min-width: 800px) {
  .service-box {
    margin: 20px auto 0;
  }
}

.service-box h3 {
  color: #2A0A0A;
}

@media (max-width: 768px) {
  .service-box h3 {
    font-size: 1.2rem;
  }
}

.service-box p {
  margin-bottom: 0;
}

.text-muted {
  color: rgba(26,26,26,0.55);
}

/* Contact form styling */

input[type=text], input[type=email], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #2A0A0A;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 1rem;
  margin-bottom: 1rem;
  resize: vertical;
  font-size: 1.0rem;
}

@media (max-width: 480px) {
  input[type=text], input[type=email], select, textarea {
    padding: 10px;
    font-size: 0.95rem;
  }
}

input[type=submit] {
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.0rem;
}

@media (max-width: 480px) {
  input[type=submit] {
    padding: 10px 16px;
    font-size: 0.95rem;
  }
}

input[type=submit]:hover {
  color: white;
}

.form {
  margin: 0 2.5rem 0 2.5rem;
  text-align: left;
}

@media (max-width: 768px) {
  .form {
    margin: 0 1.5rem;
  }
}

@media (max-width: 480px) {
  .form {
    margin: 0 1rem;
  }
}

/* Form column layout */

.form-column {
  float: left;
  padding-right: 1em;
  width: 50%;
}

@media (max-width: 768px) {
  .form-column {
    width: 100%;
    padding-right: 0;
  }
}

.form-row:after {
  content: "";
  display: table;
  clear: both;
}

#toc_container {
    background: #FDF6EC none repeat scroll 0 0;
    border: 1px solid #2A0A0A;
    display: table;
    font-size: 95%;
    margin-bottom: 1em;
    padding: 20px;
    width: auto;
}

@media (max-width: 480px) {
  #toc_container {
    padding: 15px;
    font-size: 90%;
  }
}

.toc_title {
    font-weight: 700;
    text-align: center;
}

#toc_container li, #toc_container ul, #toc_container ul li{
    list-style: outside none none !important;
}

/* Flex container */
.flex-container {
  display: flex;
  flex-direction: row;
}

@media (max-width: 800px) {
  .flex-container {
    flex-direction: column;
  }
}

/* Flexible responsive image grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 0;
}

.portfolio-grid-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.portfolio-grid-item:first-child {
  align-self: start;
}

.portfolio-grid-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.portfolio-grid-item a {
  display: block;
  text-decoration: none;
  position: relative;
}

.portfolio-grid-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.portfolio-grid-item:hover img {
  opacity: 0.8;
}

.portfolio-grid-item .portfolio-tooltip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #FDF6EC;
  padding: 1rem;
  text-align: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.portfolio-grid-item:hover .portfolio-tooltip,
.portfolio-grid-item:focus-within .portfolio-tooltip {
  transform: translateY(0);
}

/* Description that unfolds under the title on hover or keyboard focus */
.portfolio-grid-item .portfolio-tooltip__desc {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.portfolio-grid-item:hover .portfolio-tooltip__desc,
.portfolio-grid-item:focus-within .portfolio-tooltip__desc {
  max-height: 14rem;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-grid-item .portfolio-tooltip,
  .portfolio-grid-item .portfolio-tooltip__desc {
    transition: none;
  }
}

/* Text-only variant for the home index */
.portfolio-grid-item--text {
  background: rgba(253, 246, 236, 0.95);
  border: 1px solid #2A0A0A;
  border-radius: var(--radius);
  align-self: stretch;
  overflow: visible;
}

.portfolio-grid--home .portfolio-grid-item:first-child {
  align-self: stretch;
}

.portfolio-grid-item--text a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.25rem 1.5rem;
  color: inherit;
}

.portfolio-grid-item--text a:visited {
  color: inherit;
}

.portfolio-grid-item.portfolio-grid-item--text h3 {
  margin: 0 0 0.6rem;
  color: #2A0A0A;
  font-size: 1.15rem;
  line-height: 1.3;
}

.portfolio-grid-item.portfolio-grid-item--text p {
  margin: 0;
  color: #1A1A1A;
  font-size: 0.95rem;
  line-height: 1.55;
}

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

/* Home index grid: smaller cards, edge breathing room, smoother reflow */
.portfolio-grid.portfolio-grid--home {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  padding: 0 1.5rem;
  margin: 2rem 0;
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  .portfolio-grid.portfolio-grid--home {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 0 1rem;
  }
}

@media screen and (max-width: 480px) {
  .portfolio-grid.portfolio-grid--home {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0 0.75rem;
    margin: 1rem 0;
  }
}

@media screen and (max-width: 480px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
  }

  .portfolio-grid-item .portfolio-tooltip {
    font-size: 0.95rem;
    padding: 0.75rem;
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  .portfolio-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
  }
}

@media screen and (min-width: 769px) and (max-width: 1080px) {
  .portfolio-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
  }
}

@media screen and (min-width: 1081px) {
  .portfolio-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
  }
}

/* Jenga Tower */

.full-bleed-img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    width: 100%;
}

.jenga-tower-map {
    position: relative;
    max-width: 1280px;
    width: 100%;
    margin: 2em auto;
}

@media (max-width: 768px) {
  .jenga-tower-map {
    margin: 1em auto;
  }
}

.tower-link img {
    display: block;
    width: 100%;
    height: auto;
}

/* Page container adjustments for small screens */
@media screen and (max-width: 480px) {
  .page-container {
    margin: 2rem 1rem 0; /* shrink top and horizontal margin */
    padding: 0; /* remove extra padding if any */
  }

  .page__article, .page__article_white, .page__article_white2 {
    margin: 1rem 0.5rem; /* reduce side margins */
    padding: 0.75rem;     /* tighten padding */
  }

  .page__article p {
    padding: 0.5rem 0.5rem; /* ensure text fits screen */
  }

  /* Flex containers collapse correctly */
  .flex-container {
    flex-direction: column;
    gap: 1rem; /* optional spacing between items */
  }

  /* Service columns stack nicely */
  .service-column {
    width: 100%;
    float: none;
    margin: 0 auto;
  }

  /* Portfolio grid adjustments */
  .portfolio-grid {
    grid-template-columns: 1fr; /* single column on phone */
    gap: 1rem;
    margin: 1rem 0;
  }

  .portfolio-grid-item .portfolio-tooltip {
    font-size: 0.95rem;
    padding: 0.75rem;
  }

  /* Jenga tower map scaling */
  .jenga-tower-map {
    margin: 1em auto;
    max-width: 100%;
  }

  .hover-note {
    font-size: 1em;
    padding: 0.3em 0.6em;
  }
}

/* PHONE-SIZE RESPONSIVENESS FOR PORTFOLIO GRID */
@media screen and (max-width: 480px) {
  .portfolio-grid {
    grid-template-columns: 1fr; /* stack everything vertically */
    gap: 1rem;                  /* smaller gap for tight screens */
    margin: 1rem 0;             /* reduce page margin */
    padding: 0 0.5rem;          /* prevent content hitting edges */
  }

  .portfolio-grid-item {
    width: 100%;                /* force full width */
    margin: 0 auto;             /* centre items */
  }

  .portfolio-grid-item h2,
  .portfolio-grid-item p {
    margin-left: 0.5rem;
    margin-right: 0.5rem;       /* reduce side margin for small screens */
  }

  .portfolio-grid-item img {
    width: 100%;                /* images scale down properly */
    height: auto;
  }

  .portfolio-grid-item .portfolio-tooltip {
    font-size: 0.95rem;
    padding: 0.75rem;
  }

  .page-post-card__link {
    max-width: 95%;             /* fit smaller screens */
    margin: 1rem auto;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

/* Portfolio grid items: margins for desktop/tablet only */
.portfolio-grid-item h2,
.portfolio-grid-item p {
  margin-left: 20px;
  margin-right: 20px;
}

/* Remove horizontal margins on phones (max-width 480px) */
@media screen and (max-width: 480px) {
  .portfolio-grid-item h2,
  .portfolio-grid-item p {
    margin-left: 5px;
    margin-right: 5px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

/* ULTIMATE OVERRIDES - Add at the very end */

/* Target every possible container for background and spacing */
.jenga-tower-page,
.jenga-tower-page .blogpost-container,
.jenga-tower-page .card-overlay,
.jenga-tower-page .page__article_white {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    max-width: none !important;
    background-color: #2A0A0A !important;
}

/* Preserve the map container positioning */
.jenga-tower-page .jenga-tower-map {
    position: relative !important;
    max-width: 1280px !important;
    margin: 0 auto !important;  /* This centers the image */
    background-color: transparent !important;
}

/* Ensure the image itself has no extra space */
.jenga-tower-page .full-bleed-img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: bottom;
}

/* Make the link a block with no line spacing */
.jenga-tower-page .tower-link {
    display: block;
    line-height: 0;
    font-size: 0;
}

/* Small square image grid */
.small-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 128px));
  gap: 1rem;
  margin: 2rem 0 1.5rem;
  padding: 1.5rem 0 0;
  border-top: 1px solid rgba(42, 10, 10, 0.2);
  justify-content: center;
}

.small-grid-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 44px 0 rgba(0, 0, 0, 0.4);
  aspect-ratio: 1 / 1; /* Forces square aspect ratio */
}

.small-grid-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.small-grid-item a {
  display: block;
  text-decoration: none;
  position: relative;
  width: 100%;
  height: 100%;
}

.small-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures images fill the square space without distortion */
  display: block;
  transition: opacity 0.3s ease;
}

.small-grid-item:hover img {
  opacity: 0.8;
}

.small-grid-item .small-tooltip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #FDF6EC;
  padding: 0.75rem;
  text-align: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.small-grid-item:hover .small-tooltip {
  transform: translateY(0);
}

/* Responsive adjustments for small grid */
@media screen and (max-width: 480px) {
  .small-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
  }

  .small-grid-item .small-tooltip {
    font-size: 0.8rem;
    padding: 0.5rem;
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  .small-grid {
    grid-template-columns: repeat(auto-fit, minmax(110px, 128px));
    gap: 1rem;
  }
}

@media screen and (min-width: 769px) and (max-width: 1080px) {
  .small-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 128px));
    gap: 1.25rem;
  }
}

@media screen and (min-width: 1081px) {
  .small-grid {
    grid-template-columns: repeat(auto-fit, 128px);
    gap: 1.5rem;
  }
}
/* Dutch twin of each Legalities section, set in italic to tell the two languages apart */
.lang-nl {
  font-style: italic;
}

/* A 1px line under each Dutch block, so every English and Dutch pair reads as one item */
.page__article_white .lang-nl:not(:last-child) {
  border-bottom: 1px solid rgba(42, 10, 10, 0.35);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

/* 404: a small text adventure in a terminal */
.lost-terminal {
  background: #1A1A1A;
  color: #FDF6EC;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  line-height: 1.55;
  text-align: left;
  max-width: 42rem;
  margin: 1.5rem auto;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius, 0.375rem);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lost-terminal__log {
  max-height: 24rem;
  overflow-y: auto;
}

.lost-terminal__log p {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.lost-terminal__cmd {
  color: rgba(253, 246, 236, 0.6);
}

.lost-terminal__prompt {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.lost-terminal__prompt label {
  color: #FDF6EC;
}

.lost-terminal input[type=text] {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 0.25rem 0;
  border: none;
  border-bottom: 1px solid rgba(253, 246, 236, 0.35);
  border-radius: 0;
  background: transparent;
  color: #FDF6EC;
  font-family: inherit;
  font-size: 1rem;
}

.lost-terminal input[type=text]::placeholder {
  color: rgba(253, 246, 236, 0.4);
}

.lost-terminal input[type=text]:focus {
  outline: none;
  border-bottom-color: #FDF6EC;
}

@media (max-width: 768px) {
  .lost-terminal {
    margin: 1rem;
    padding: 1rem;
  }
}

/* Page intro line under a heading */
.page-intro {
  margin-bottom: 1.5rem;
  color: #1A1A1A;
}

/* The one-line professional epitaph on the about page */
.page-epitaph {
  color: rgba(42, 10, 10, 0.65);
  font-style: italic;
  margin-top: 1rem;
  font-size: 1.1em;
}

/* Monospace accents */
.page-post-card__link a {
  font-family: 'Courier New', Courier, monospace;
  text-transform: lowercase;
}

.page-post-card__link a::before {
  content: "~$ " / "";
  color: rgba(253, 246, 236, 0.55);
}

.type-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.15em;
  vertical-align: text-bottom;
  background-color: #2A0A0A;
  animation: cursor-blink 1.1s steps(1) infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* A fragment of play, terminal-style */
.play-fragment {
  display: block;
  background: #1A1A1A;
  color: #FDF6EC;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 36rem;
  margin: 1.5rem auto;
  padding: 1rem 1.25rem;
  border-radius: var(--radius, 0.375rem);
  overflow-x: auto;
  white-space: pre;
}

.play-fragment .t {
  color: rgba(253, 246, 236, 0.6);
}

/* Seat tags on game cards */
.seat-tag {
  display: block;
  margin-top: 0.2rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  color: #F5D98B;
}

@media (prefers-reduced-motion: reduce) {
  .type-cursor {
    animation: none;
  }
}
