@font-face {
  font-family: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/bebas-neue-regular.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-regular.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-regular.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-medium.woff2") format("woff2");
}

:root {
  --accent: #588891;
  --accent-rgb: 88, 136, 145;
  --bg: #0a0a0b;
  --fg: #ededed;
  --muted: #8a8a8a;
  --border: rgba(255, 255, 255, 0.12);
  --font-bebas: "Bebas Neue", "Arial Narrow", sans-serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --tile-size: clamp(3.5rem, 13vw, 12rem);
}

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

html,
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  position: relative;
}

/* Grid background */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Noise overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* Side nav */
.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 80px;
  background: rgba(10, 10, 11, 0.8);
  z-index: 5;
}

@media (max-width: 767px) {
  .side-nav {
    display: none;
  }
}

/* Hero */
main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 4rem 1.5rem;
}

@media (min-width: 768px) {
  .hero {
    padding: 4rem 4rem 4rem 6rem;
  }
}

@media (min-width: 1200px) {
  .hero {
    padding: 4rem 6rem 4rem 8rem;
  }
}

.hero-inner {
  width: 100%;
  max-width: 100%;
}

/* Animated word */
.word {
  display: inline-flex;
  gap: 0.08em;
  align-items: center;
  cursor: pointer;
  user-select: none;
  /* shift left so the visible D aligns with the text below */
  margin-left: calc(var(--tile-size) * -0.08);
}

.letter {
  position: relative;
  display: inline-block;
  overflow: hidden;
  font-family: var(--font-bebas);
  font-weight: 400;
  font-size: var(--tile-size);
  line-height: 1;
  width: 0.65em;
  height: 1.05em;
  background-color: rgba(var(--accent-rgb), 0.18);
  transition: background-color 0.45s ease;
  opacity: 0;
  transform: translateY(16px);
}

.letter.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s ease, transform 0.45s ease, background-color 0.45s ease;
}

/* split line across each tile */
.letter::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.28);
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

/* Final state: no tint, no split line, letter in white */
.letter.final {
  background-color: transparent;
}

.letter.final::after {
  opacity: 0;
}

.letter.final .letter-half {
  color: var(--fg);
}

.letter-half {
  position: absolute;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  color: var(--accent);
  transition: color 0.45s ease;
}

.letter-half.top {
  top: 0;
  bottom: 50%;
  align-items: flex-end;
}

.letter-half.top span {
  transform: translateY(0.52em);
  display: block;
  line-height: 1;
}

.letter-half.bottom {
  top: 50%;
  bottom: 0;
  align-items: flex-start;
}

.letter-half.bottom span {
  transform: translateY(-0.52em);
  display: block;
  line-height: 1;
}

/* Name (matches webinsane.com <h2>) */
.name {
  font-family: var(--font-sans);
  font-weight: 400;
  color: rgba(140, 140, 140, 0.6);
  color: oklab(0.55 0 0 / 0.6);
  font-size: clamp(1rem, 3vw, 2rem);
  letter-spacing: 0.025em;
  line-height: 1.5;
  margin-top: 1rem;
}

/* Tagline */
.tagline {
  margin-top: 1.75rem;
  max-width: 32rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.9;
}

/* Actions */
.actions {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.contact-btn,
.medium-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 11rem;
  border: 1px solid rgba(237, 237, 237, 0.2);
  background: transparent;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--fg);
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.contact-btn:hover,
.medium-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  animation: fade-in 0.25s ease forwards;
}

.modal-panel {
  contain: layout paint;
}

body.modal-open .noise-overlay,
body.modal-open .grid-bg {
  display: none;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #0f0f11;
  border: 1px solid var(--border);
  padding: 2.5rem 2rem 2rem;
  animation: panel-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-title {
  font-family: var(--font-bebas);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.04em;
  color: var(--fg);
  margin-bottom: 1.5rem;
}

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea {
  font-family: var(--font-sans);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  padding: 0.6rem 0.1rem;
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  border-bottom-color: var(--accent);
}

.submit-btn {
  margin-top: 0.5rem;
  display: inline-block;
  width: 100%;
  border: 1px solid rgba(237, 237, 237, 0.2);
  background: transparent;
  padding: 0.95rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  color: var(--fg);
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.submit-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.form-feedback {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  min-height: 1em;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tablet / iPad tweaks */
@media (min-width: 768px) and (max-width: 1024px) {
  .hero {
    padding-left: 6rem;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .hero {
    padding: 4rem 1.25rem;
  }

  .actions {
    margin-top: 2rem;
  }
}
