/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark theme colors as main colors */
  --bg: oklch(0.18 0 0); /* very dark gray, not pure black */
  --text: oklch(0.95 0 0); /* refined off-white, not pure white */
  --text-secondary: oklch(0.68 0 0); /* refined light gray */
}

body {
  font-family: "Special Gothic Expanded One", sans-serif;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

/* Top left - Address */
.top-left {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 10;
}

.top-left address {
  font-style: normal;
  color: var(--text);
}

/* 3D Logo container - centered */
.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40vw;
  max-width: 500px;
  min-width: 300px;
  height: 40vw;
  max-height: 500px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: var(--bg);
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
}

model-viewer.loaded {
  opacity: 1;
}

/* Bottom left - Description */
.bottom-left {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 10;
  max-width: 28.125rem;
}

.description {
  color: var(--text);
  line-height: 1.5;
  max-width: 45ch;
  text-transform: uppercase;
  transition: opacity 0.7s ease-in-out, visibility 0.7s ease-in-out;
}

/* Bottom right - Address and Contact */
.bottom-right {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0rem;
  align-items: flex-end;
  transition: opacity 0.7s ease-in-out;
}

.bottom-right.fade-out {
  opacity: 0;
}

.bottom-right address {
  font-style: normal;
  color: var(--text);
}

.contact-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.contact-link:hover {
  opacity: 0.6;
}

.email-message {
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  text-align: right;
  animation: fadeIn 0.7s ease;
}

.email-message a {
  color: var(--text);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.email-message a:hover {
  opacity: 0.7;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    font-size: 0.97rem;
  }

  .wrap {
    padding: 1rem;
  }

  .top-left {
    top: 1rem;
    left: 1rem;
  }

  .logo {
    width: 60vw;
    min-width: 200px;
    max-width: 350px;
    height: 70vw;
    min-height: 200px;
    max-height: 350px;
  }

  .bottom-left {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: 50%;
  }

  .bottom-right {
    bottom: 1rem;
    right: 1rem;
    gap: 0;
  }

  .email-message {
    text-align: right;
  }

  .description {
    max-width: 100%;
    word-wrap: break-word;
  }

  body.email-shown .bottom-left .description {
    opacity: 0;
    visibility: hidden;
  }
}

/* Loading state for model-viewer - hidden */
model-viewer::part(default-progress-bar) {
  display: none;
}

model-viewer::part(default-progress-mask) {
  display: none;
}

/* Contact page styles */
.contact-page {
  justify-content: center;
  align-items: center;
}

.back-link {
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.back-link:hover {
  opacity: 0.6;
}

.contact-form-container {
  max-width: 500px;
  width: 100%;
  padding: 2rem;
}

.contact-title {
  color: var(--text);
  text-transform: uppercase;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  text-align: center;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  color: var(--text);
  text-transform: uppercase;
  font-size: 0.9rem;
}

.form-group .optional {
  color: var(--text-secondary);
  font-weight: normal;
  text-transform: lowercase;
}

.form-group input {
  background: transparent;
  border: 1px solid var(--text-secondary);
  color: var(--text);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--text);
}

.form-group input::placeholder {
  color: var(--text-secondary);
}

#turnstile-widget {
  display: flex;
  justify-content: flex-start;
  margin: 0;
}

.submit-button {
  background: transparent;
  border: 1px solid var(--text);
  color: var(--text);
  padding: 0.75rem 2rem;
  font-family: inherit;
  font-size: 1rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
  margin-top: 0.5rem;
}

.submit-button:hover:not(:disabled) {
  background: var(--text);
  color: var(--bg);
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-message {
  margin-top: 1rem;
  padding: 0.75rem;
  text-align: center;
  min-height: 1.5rem;
  white-space: pre-line;
}

.form-message.success {
  color: var(--text);
}

.form-message.error {
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .contact-form-container {
    padding: 1rem;
  }

  .contact-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
  }
}

/* View Transitions */
@view-transition {
  navigation: auto;
}

@media not (prefers-reduced-motion: reduce) {
  #contactLink {
    view-transition-name: navigation-contact;
  }
  #backLink {
    view-transition-name: navigation-back;
  }
}
