/* ============================================================
   HAKI TECH CONSULTING — MAIN DESIGN SYSTEM
   main.css: variables, reset, typography, utilities, layout
   ============================================================ */

/* --- Google Fonts ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&family=Playfair+Display:wght@400;600;700&family=Bebas+Neue&family=Dancing+Script:wght@400;600&family=Cormorant+Garamond:wght@400;500;600&family=Montserrat:wght@400;500;600;700&family=Oswald:wght@400;500;600&display=swap');

/* --- CSS Variables ---------------------------------------- */
:root {
  --color-black:      #0A0A0A;
  --color-near-black: #141414;
  --color-dark:       #1E1E1E;
  --color-white:      #FFFFFF;
  --color-off-white:  #F5F5F5;
  --color-grey-light: #E0E0E0;
  --color-grey-mid:   #888888;
  --color-accent:     #C9A84C;
  --color-accent-dim: #8A6F2E;

  --border-dark:  1px solid rgba(255, 255, 255, 0.08);
  --border-light: 1px solid rgba(0, 0, 0, 0.08);

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --nav-height: 72px;

  --radius-sm: 2px;
  --radius-md: 4px;

  --transition-base: 0.25s ease;
  --transition-slow: 0.45s ease;

  --max-width: 1200px;
  --section-pad-y: 96px;
  --section-pad-y-sm: 56px;
}

/* --- Reset ------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-white);
  background-color: var(--color-black);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Typography -------------------------------------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.125rem, 2vw, 1.375rem); }
h5 { font-size: 1rem; }

p {
  color: var(--color-grey-mid);
  max-width: 65ch;
}

p.lead {
  font-size: 1.125rem;
  line-height: 1.7;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

/* --- Layout ------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

@media (min-width: 768px) {
  .container { padding-inline: 40px; }
}
@media (min-width: 1200px) {
  .container { padding-inline: 48px; }
}

section {
  padding-block: var(--section-pad-y);
}

.section--dark  { background-color: var(--color-black); }
.section--mid   { background-color: var(--color-near-black); }
.section--raised { background-color: var(--color-dark); }
.section--light {
  background-color: var(--color-off-white);
  color: var(--color-black);
}
.section--light h1,
.section--light h2,
.section--light h3,
.section--light h4 {
  color: var(--color-black);
}
.section--light p { color: #555; }

/* --- Grid -------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 24px; }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: 24px; }

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

/* --- Section Header --------------------------------------- */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 16px;
  display: block;
}

.section-header {
  margin-bottom: 56px;
}
.section-header h2 {
  margin-bottom: 16px;
}
.section-header p {
  font-size: 1.0625rem;
  max-width: 55ch;
}

/* --- Dividers --------------------------------------------- */
.divider {
  width: 48px;
  height: 2px;
  background-color: var(--color-accent);
  margin-block: 24px;
}

/* --- Utilities -------------------------------------------- */
.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--color-grey-mid); }
.text-white   { color: var(--color-white); }
.text-black   { color: var(--color-black); }
.text-center  { text-align: center; }
.text-upper   {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8125rem;
  font-weight: 600;
}

.mt-4  { margin-top: 16px; }
.mt-8  { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mb-4  { margin-bottom: 16px; }
.mb-8  { margin-bottom: 32px; }

/* --- Global polish ----------------------------------------- */
::selection {
  background: rgba(201, 168, 76, 0.85);
  color: var(--color-black);
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--color-black); }
::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 5px;
  border: 2px solid var(--color-black);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-accent-dim); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-animate],
  .animate-children > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0,0,0,0);
  overflow: hidden;
  white-space: nowrap;
}

/* --- Scroll Animation ------------------------------------- */
[data-animate] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate]:nth-child(1) { transition-delay: 0.05s; }
[data-animate]:nth-child(2) { transition-delay: 0.12s; }
[data-animate]:nth-child(3) { transition-delay: 0.19s; }
[data-animate]:nth-child(4) { transition-delay: 0.26s; }
[data-animate]:nth-child(5) { transition-delay: 0.33s; }
[data-animate]:nth-child(6) { transition-delay: 0.40s; }

.animate-children > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.animate-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}
.animate-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.animate-children.visible > *:nth-child(2) { transition-delay: 0.14s; }
.animate-children.visible > *:nth-child(3) { transition-delay: 0.23s; }
.animate-children.visible > *:nth-child(4) { transition-delay: 0.32s; }
.animate-children.visible > *:nth-child(5) { transition-delay: 0.41s; }
.animate-children.visible > *:nth-child(6) { transition-delay: 0.50s; }

/* --- Page Hero (non-home pages) --------------------------- */
.page-hero {
  background-color: var(--color-near-black);
  padding-top: calc(var(--nav-height) + 72px);
  padding-bottom: 72px;
  border-bottom: var(--border-dark);
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C9A84C' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3Ccircle cx='0' cy='0' r='2'/%3E%3Ccircle cx='60' cy='0' r='2'/%3E%3Ccircle cx='0' cy='60' r='2'/%3E%3Ccircle cx='60' cy='60' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.page-hero .breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-grey-mid);
  margin-bottom: 24px;
}
.page-hero .breadcrumb a:hover { color: var(--color-accent); }
.page-hero .breadcrumb span { margin-inline: 8px; opacity: 0.4; }
.page-hero h1 { margin-bottom: 16px; }
.page-hero p.lead { color: var(--color-grey-mid); max-width: 52ch; }

/* --- CTA Banner ------------------------------------------- */
.cta-banner {
  background-color: var(--color-near-black);
  border-top: 2px solid var(--color-accent);
  padding-block: 80px;
  text-align: center;
}
.cta-banner h2 { margin-bottom: 12px; }
.cta-banner p  { margin-inline: auto; margin-bottom: 32px; }
.cta-banner .btn-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Inline Message (form feedback) ----------------------- */
.form-message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-top: 12px;
  display: none;
}
.form-message.success {
  background: rgba(201,168,76,0.12);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  display: block;
}
.form-message.error {
  background: rgba(220, 80, 80, 0.1);
  border: 1px solid rgba(220, 80, 80, 0.5);
  color: #e05555;
  display: block;
}

/* --- WhatsApp CTA strip ----------------------------------- */
.wa-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(201,168,76,0.06);
  border: var(--border-dark);
  border-left: 3px solid var(--color-accent);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin-top: 32px;
  flex-wrap: wrap;
}
.wa-strip p { color: var(--color-grey-mid); margin: 0; max-width: none; font-size: 0.9375rem; }
.wa-strip .btn { flex-shrink: 0; }

/* --- Floating WhatsApp Button ----------------------------- */
.wa-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;
  width: 58px;
  height: 58px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: #fff;
  /* Force GPU compositing layer — fixes iOS Safari position:fixed scroll bug */
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}
.wa-float:hover {
  -webkit-transform: scale(1.1);
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(37,211,102,0.6);
}
.wa-float svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Pulse ring */
.wa-float__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(37,211,102,0.35);
  animation: waPulse 2.4s ease-out infinite;
}
@keyframes waPulse {
  0%   { transform: scale(1);    opacity: 0.7; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* Tooltip label */
.wa-float__label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-near-black);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 2px;
  border: var(--border-dark);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.wa-float__label::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: var(--color-near-black);
}
.wa-float:hover .wa-float__label { opacity: 1; }

/* Mobile: smaller button, safe-area bottom inset for iOS home bar */
@media (max-width: 767px) {
  .wa-float {
    width: 46px;
    height: 46px;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
    right: 16px;
  }
  .wa-float svg { width: 22px; height: 22px; }
  .wa-float__label { display: none; }
}
