/* ============================================================
   MAIN.CSS — Megademy Global Sdn. Bhd.
   Reset, Variables, Typography, Layout, Base Elements, Utilities
   ============================================================ */

/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
}

svg {
  display: block;
}

svg:not(.illustration-svg) {
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

/* --- Root Variables --- */
:root {
  /* Colors - Merged from DESIGN.docx + Prompt */
  --color-background: #ffffff;
  --color-surface: #f7f8fa;
  --color-surface-strong: #f3f5f7;
  --color-text: #111827;
  --color-text-muted: #68707d;
  --color-text-muted-2: #8b94a3;
  --color-border: #e5e7eb;
  --color-divider: #d6dae1;
  --color-primary: #168c82;
  --color-primary-hover: #11756d;
  --color-primary-active: #0f675f;
  --color-primary-dark: #0f5d56;
  --color-accent: #d9f1ee;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-link: #168c82;

  /* Typography Scale */
  --text-display: 4.125rem;  /* 66px */
  --text-h1: 3.25rem;        /* 52px */
  --text-h2: 2.5rem;         /* 40px */
  --text-h3: 1.875rem;       /* 30px */
  --text-h4: 1.375rem;       /* 22px */
  --text-body-large: 1.125rem; /* 18px */
  --text-body: 1rem;         /* 16px */
  --text-small: 0.9375rem;   /* 15px */
  --text-caption: 0.875rem;  /* 14px */
  --text-label: 0.8125rem;   /* 13px */
  --text-nav: 0.9375rem;     /* 15px */
  --text-button: 1rem;       /* 16px */

  /* Font Weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights */
  --leading-display: 1.05;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.6;

  /* Spacing Scale */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-24: 6rem;     /* 96px */
  --space-32: 8rem;     /* 128px */

  /* Layout */
  --container-max: 1180px;
  --container-content: 1080px;
  --container-hero: 900px;
  --container-padding: 1.5rem;

  /* Section Padding */
  --section-padding-desktop: 7.5rem;  /* 120px */
  --section-padding-tablet: 5rem;     /* 80px */
  --section-padding-mobile: 4rem;     /* 64px */

  /* Border Radius */
  --radius-button: 12px;
  --radius-card: 16px;
  --radius-small: 8px;
  --radius-medium: 14px;
  --radius-large: 22px;

  /* Shadows */
  --shadow-small: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-medium: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-large: 0 20px 60px rgba(15, 23, 42, 0.1);
  --shadow-hover: 0 12px 28px rgba(15, 23, 42, 0.12);

  /* Navigation */
  --nav-height: 80px;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-h1);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-4);
}

h3 {
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--text-h4);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

p:last-child {
  margin-bottom: 0;
}

.display-heading {
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-display);
  letter-spacing: -0.03em;
}

.text-large {
  font-size: var(--text-body-large);
}

.text-small {
  font-size: var(--text-small);
}

.text-caption {
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
}

.text-label {
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.site-container {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.container-content {
  max-width: var(--container-content);
}

.container-hero {
  max-width: var(--container-hero);
}

/* --- Section --- */
.section {
  padding-top: var(--section-padding-desktop);
  padding-bottom: var(--section-padding-desktop);
}

.section-surface {
  background-color: var(--color-surface);
}

.section-surface-strong {
  background-color: var(--color-surface-strong);
}

.section-divider {
  border-bottom: 1px solid var(--color-border);
}

/* --- Grid --- */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-12 {
  grid-template-columns: repeat(12, 1fr);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 48px;
  padding: 0 var(--space-6);
  font-size: var(--text-button);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  color: inherit;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-medium);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-primary:active {
  background-color: var(--color-primary-active);
  transform: translateY(0);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-surface);
  border-color: var(--color-divider);
  color: var(--color-text);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--color-surface);
  color: var(--color-text);
}

.btn-danger {
  background-color: var(--color-error);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #b91c1c;
  color: #ffffff;
}

.btn-lg {
  height: 56px;
  padding: 0 var(--space-8);
  font-size: var(--text-body);
}

.btn-sm {
  height: 40px;
  padding: 0 var(--space-4);
  font-size: var(--text-small);
}

.btn-full {
  width: 100%;
}

/* --- Links --- */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: var(--weight-medium);
  color: var(--color-primary);
}

.link-arrow::after {
  content: '→';
  transition: transform 0.2s ease;
}

.link-arrow:hover::after {
  transform: translateX(4px);
}

.link-arrow:hover {
  color: var(--color-primary-hover);
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  font-size: var(--text-small);
  color: var(--color-text);
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted-2);
}

.form-textarea {
  height: auto;
  min-height: 120px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.form-error {
  font-size: var(--text-caption);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.form-success {
  text-align: center;
  padding: var(--space-8);
}

.form-success h3 {
  color: var(--color-success);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  margin-bottom: var(--space-6);
  padding-top: var(--space-4);
}

.breadcrumbs a {
  color: var(--color-text-muted);
}

.breadcrumbs a:hover {
  color: var(--color-primary);
}

.breadcrumbs .separator {
  color: var(--color-divider);
}

.breadcrumbs .current {
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

/* --- Content Meta --- */
.content-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.content-meta p {
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  margin-bottom: 0;
}

/* --- Labels --- */
.label-illustrative {
  display: inline-block;
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  color: var(--color-warning);
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-small);
  margin-bottom: var(--space-4);
}

.label-placeholder {
  display: inline-block;
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  background-color: var(--color-surface);
  border: 1px dashed var(--color-border);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-small);
  margin-bottom: var(--space-4);
}

/* --- Limitation Notice --- */
.limitation-notice {
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  background-color: var(--color-surface);
  border-left: 3px solid var(--color-warning);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-small);
  margin: var(--space-6) 0;
}

.limitation-notice p {
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  margin-bottom: 0;
}

/* --- Legal Notice --- */
.legal-notice {
  font-size: var(--text-caption);
  color: var(--color-text-muted-2);
  font-style: italic;
  background-color: var(--color-surface);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-small);
  margin: var(--space-6) 0;
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background-color: var(--color-primary);
  color: #ffffff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-small);
  z-index: 10000;
  font-weight: var(--weight-semibold);
}

.skip-link:focus {
  top: var(--space-4);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Utility Classes --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }

.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none; }

.section-heading {
  text-align: center;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-12);
}

.section-heading h2 {
  margin-bottom: var(--space-4);
}

.section-heading p {
  font-size: var(--text-body);
  color: var(--color-text-muted);
}
