/* bacarella.com main page (index.html, index-script.js). Hand-written, no build step. */

/* ---------- Reset: only what the page relies on ---------- */

*, ::before, ::after {
  box-sizing: border-box;
  border: 0 solid #e5e7eb;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  color: #f9fafb;
}

h1, h2, h3, p, pre {
  margin: 0;
}

h1, h2, h3 {
  font-size: inherit;
  font-weight: inherit;
}

button, input, textarea {
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button {
  -webkit-appearance: button;
  background: transparent;
  cursor: pointer;
}

:disabled {
  cursor: default;
}

textarea {
  resize: vertical;
}

svg, canvas {
  display: block;
  vertical-align: middle;
}

/* Firefox: keep the focus ring, drop the red glow on untouched required fields. */
:-moz-focusring {
  outline: auto;
}

:-moz-ui-invalid {
  box-shadow: none;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  margin: 0 auto;
  padding: 4rem 1rem;
}

@media (min-width: 640px)  { .container { max-width: 640px; } }
@media (min-width: 768px)  { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }
@media (min-width: 1536px) { .container { max-width: 1536px; } }

.grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Background effects ---------- */

#grid-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

.scanline-overlay::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    0deg,
    transparent 0%,
    rgba(6, 182, 212, 0.03) 50%,
    transparent 100%
  );
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* ---------- Hero ---------- */

.hero {
  overflow: hidden;
}

.hero .container {
  padding-top: 7rem;
  padding-bottom: 7rem;
  text-align: center;
}

.hero-title {
  position: relative;
  margin-bottom: 1.5rem;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1;
  color: transparent;
  background-image: linear-gradient(to right, #06b6d4, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #06b6d4, #a855f7, transparent);
  box-shadow: 0 0 10px #06b6d4, 0 0 20px rgba(6, 182, 212, 0.5);
}

.tagline {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: 0.025em;
  color: #67e8f9;
  text-shadow: 0 0 10px rgba(103, 232, 249, 0.6),
               0 0 20px rgba(103, 232, 249, 0.4),
               0 0 40px rgba(103, 232, 249, 0.2),
               0 0 80px rgba(103, 232, 249, 0.1);
  animation: flicker 4s infinite;
}

@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.8; }
  97% { opacity: 1; }
  98% { opacity: 0.6; }
}

/* ---------- Section headings ---------- */

.section-title {
  margin-bottom: 2rem;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  color: #22d3ee;
  text-align: center;
}

.section-title span {
  position: relative;
  display: inline-block;
}

.section-title span::before,
.section-title span::after {
  content: '//';
  position: relative;
  padding: 0 0.5rem;
  font-family: monospace;
  font-size: 0.8em;
  color: rgba(6, 182, 212, 0.4);
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border-radius: 0.5rem;
  background: rgba(17, 17, 23, 0.85);
  border: 1px solid rgba(6, 182, 212, 0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow:
    0 0 8px rgba(6, 182, 212, 0.15),
    inset 0 0 20px rgba(6, 182, 212, 0.03);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(6, 182, 212, 0.8);
  box-shadow:
    0 0 15px rgba(6, 182, 212, 0.3),
    0 0 30px rgba(6, 182, 212, 0.1),
    inset 0 0 20px rgba(6, 182, 212, 0.05);
}

/* A light sweep across the card on hover or when a field inside has focus. */
.card:hover::before,
.card:focus-within::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(6, 182, 212, 0.15), transparent);
  animation: shine 1.5s;
}

@keyframes shine {
  100% { left: 100%; }
}

/* Thin glowing top edge. */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.6), transparent);
}

/* scale(1), not none: the hover transitions from it, and Firefox renders the card's
   text a little differently once it has a transform, so it doesn't change on hover. */
.card-lift {
  transform: scale(1);
}

.card-lift:hover {
  transform: scale(1.02);
}

.card h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: #22d3ee;
}

.card p {
  color: #d1d5db;
}

@media (max-width: 768px) {
  .card {
    margin: 0.5rem;
  }
}

/* Expertise: one wide card with its heading inside. */
.expertise {
  padding: 2rem;
}

.expertise .section-title {
  margin-bottom: 1.5rem;
  text-align: left;
}

.expertise p {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
}

/* Testimonials */
.card .quote {
  margin-bottom: 1rem;
  font-style: italic;
}

.card .quote-by {
  color: #22d3ee;
}

.footnote {
  margin-top: 2rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #6b7280;
  text-align: center;
}

/* ---------- Contact form ---------- */

/* No width: 100%: as a plain block it fills the column minus its margins, so the
   0.5rem phone margin doesn't push it past the right edge. */
.contact {
  max-width: 42rem;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .contact {
    margin: 0.5rem;
  }
}

/* Gradient bars along the top and bottom edges. */
.contact-bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 0.25rem;
  opacity: 0.75;
}

.contact-bar.top {
  top: 0;
  background-image: linear-gradient(to right, #06b6d4, #a855f7);
}

.contact-bar.bottom {
  bottom: 0;
  background-image: linear-gradient(to left, #06b6d4, #a855f7);
}

.contact-head {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.contact-head svg {
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.5rem;
  color: #06b6d4;
}

.contact-head h2 {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: #f3f4f6;
}

#contactForm > * + * {
  margin-top: 1rem;
}

#contactForm label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #d1d5db;
}

#contactForm input,
#contactForm textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  color: #f3f4f6;
}

#contactForm input:focus,
#contactForm textarea:focus,
.send-btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #06b6d4;
}

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  background: #0891b2;
  color: #fff;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn:hover {
  background: #0e7490;
}

.send-btn:disabled {
  opacity: 0.5;
}

.send-btn > * + * {
  margin-left: 0.5rem;
}

.send-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.send-btn .spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

.send-btn .fail {
  color: #ef4444;
}

/* Proof-of-work progress: the leading digest bytes. */
.send-btn .digest {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
  line-height: 1rem;
}

/* ---------- Sent: the encrypted message, replayed ---------- */

.sent {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  background: #111827;
  border: 2px solid #06b6d4;
  border-radius: 0.375rem;
  animation: sent-glow 6s ease-in-out infinite;
}

@keyframes sent-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.3), 0 0 25px rgba(6, 182, 212, 0.1),
      inset 0 0 20px rgba(6, 182, 212, 0.05);
    border-color: rgba(6, 182, 212, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.45), 0 0 35px rgba(6, 182, 212, 0.15),
      inset 0 0 25px rgba(6, 182, 212, 0.07);
    border-color: rgba(6, 182, 212, 0.7);
  }
}

.sent-head {
  margin-bottom: 0.75rem;
}

.sent-label {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #67e8f9;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.8), 0 0 20px rgba(6, 182, 212, 0.4);
}

.sent-rule {
  height: 1px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.6), transparent);
}

.sent-box {
  margin-top: 1rem;
  padding: 1rem;
  overflow: hidden;
  border-radius: 0.25rem;
  background: rgba(3, 7, 18, 0.6);
  animation: reveal 1.5s ease-out forwards;
}

@keyframes reveal {
  from { max-height: 0; }
  to { max-height: 600px; }
}

.sent-box pre {
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
  line-height: 1.625;
  color: #06b6d4;
  text-shadow: 0 0 3px rgba(6, 182, 212, 0.4);
}
