:root {
  --tile-height: 60vh;
  --bg: #000000;
  --text: #ffffff;
  --overlay: rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cousine', 'Andale Mono', 'Courier New', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

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

.hero {
  position: relative;
  background-image: url('assets/background.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14vh 4vw 14vh;
}

.hero__gif {
  display: block;
  width: 20vw;
  min-width: 180px;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
}

.hero__caption {
  font-family: 'Cousine', 'Andale Mono', 'Courier New', ui-monospace, monospace;
  color: #8EC7C8;
  font-weight: 400;
  font-size: clamp(11px, 1.2vw, 18px);
  letter-spacing: 0.02em;
  margin: 1vh 0 0 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 0;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

.tile {
  position: relative;
  display: block;
  height: var(--tile-height);
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  overflow: hidden;
  cursor: pointer;
  background-color: #000;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  font: inherit;
  color: inherit;
  line-height: 0;
  -webkit-appearance: none;
  appearance: none;
}

.tile__overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tile:hover .tile__overlay,
.tile:focus-visible .tile__overlay {
  opacity: 1;
}

.tile__title {
  font-family: 'Cousine', 'Andale Mono', 'Courier New', ui-monospace, monospace;
  font-weight: 400;
  font-size: clamp(13px, 1.5vw, 22px);
  line-height: 1.4;
  margin: 0;
  color: #ffffff;
}

/* On touch / hover-less devices (or narrow viewports), always show the title
   as a bottom strip instead of a hover overlay. Placed after the base rules
   above so we win source-order for same-specificity selectors. */
@media (hover: none), (max-width: 768px) {
  .tile {
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .tile__overlay {
    opacity: 1;
    inset: auto 0 0 0;             /* anchor to bottom edge only */
    background: rgba(0, 0, 0, 0.35);
    padding: 3.6px 11.2px 1.2px 7.2px;   /* +2px top / -2px bottom keeps strip height,
                                            shifts text 2px lower; -4px left moves it left */
    align-items: flex-end;
    justify-content: flex-start;
    transition: none;
  }
  .tile__title {
    text-align: left;
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.15;
  }
}

.contact {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: block;
  line-height: 0;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.contact img {
  display: block;
  width: clamp(160px, 18vw, 260px);
  height: auto;
  margin: 0;
}

.contact__label {
  position: absolute;
  right: 11%;
  top: 6%;
  transform: rotate(-18deg);
  transform-origin: right center;
  font-family: 'Cousine', 'Andale Mono', 'Courier New', ui-monospace, monospace;
  font-size: clamp(16px, 1.8vw, 26px);
  letter-spacing: 0.04em;
  color: #8EC7C8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.contact:hover .contact__label,
.contact:focus-visible .contact__label {
  opacity: 1;
}

.contact-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 4vh 4vw;
}

.contact-modal.is-open { display: flex; }

.contact-modal__form {
  position: relative;
  width: min(560px, 100%);
  background: #111;
  color: #fff;
  border: 1px solid #333;
  padding: 2.5rem 2rem 2rem;
  font-family: 'Cousine', 'Andale Mono', 'Courier New', ui-monospace, monospace;
}

.contact-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 22px;
  line-height: 32px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.contact-modal__field {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #000;
  color: #fff;
  border: 1px solid #333;
  font-family: inherit;
  font-size: 14px;
}

.contact-modal__field:focus {
  outline: 0;
  border-color: #8EC7C8;
}

textarea.contact-modal__field {
  min-height: 140px;
  resize: vertical;
}

.contact-modal__send {
  display: inline-block;
  padding: 0.7rem 2rem;
  background: #8EC7C8;
  color: #000;
  border: 0;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.contact-modal__send:hover { background: #b3dadb; }
.contact-modal__send:disabled { opacity: 0.4; cursor: not-allowed; }

.contact-modal__status {
  margin: 1rem 0 0;
  font-size: 12px;
  color: #888;
  min-height: 1em;
}
.contact-modal__status.ok { color: #8EC7C8; }
.contact-modal__status.err { color: #e88; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 4vh 4vw;
}

.modal.is-open { display: flex; }

.modal__inner {
  position: relative;
  width: 100%;
  max-width: 1400px;
  aspect-ratio: 16 / 9;
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: background 0.2s ease;
}

.modal__close:hover { background: rgba(0, 0, 0, 0.85); }

.modal__iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
