/* ==========================================================================
   Ibis Tech: styles
   --------------------------------------------------------------------------
   REBRAND HERE: every colour, font, size, space and corner radius used on the
   site comes from this :root block. Change a value here and it changes
   everywhere. The current palette is a neutral placeholder.
   ========================================================================== */

:root {
  /* ---- Colours ---- */
  --color-bg: #ffffff;              /* page background */
  --color-bg-alt: #f4f5f7;          /* alternate section background */
  --color-surface: #ffffff;         /* cards and form */
  --color-text: #1f2328;            /* main text */
  --color-text-muted: #545c66;      /* secondary text */
  --color-border: #d6dae0;          /* lines and input borders */

  --color-primary: #37475a;         /* main buttons, links, accents */
  --color-primary-hover: #26323f;
  --color-on-primary: #ffffff;      /* text on primary buttons */

  --color-header-bg: #ffffff;
  --color-footer-bg: #1f2328;
  --color-footer-text: #c9ced4;

  --color-focus: #2563eb;           /* keyboard focus outline */

  --color-success-bg: #e7f4eb;
  --color-success-text: #1d5631;
  --color-error-bg: #fbeaea;
  --color-error-text: #8a1c1c;
  --color-info-bg: #eef2f7;
  --color-info-text: #2c3a4a;

  /* ---- Fonts ---- */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);

  --font-size-base: 1.0625rem;      /* 17px body text */
  --font-size-small: 0.9375rem;
  --font-size-h1: clamp(2rem, 1.6rem + 1.8vw, 2.75rem);
  --font-size-h2: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  --font-size-h3: 1.1875rem;
  --font-size-tagline: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  --font-weight-normal: 400;
  --font-weight-bold: 650;
  --line-height: 1.6;
  --line-height-heading: 1.25;

  /* ---- Spacing ---- */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: clamp(3rem, 2.5rem + 2.5vw, 5rem);  /* section padding */

  --container-width: 68rem;         /* max content width */
  --narrow-width: 44rem;            /* max width for long text */
  --gutter: clamp(1rem, 4vw, 2rem); /* page side padding */

  /* ---- Corners and shadows ---- */
  --radius-sm: 4px;                 /* inputs */
  --radius: 8px;                    /* buttons */
  --radius-lg: 12px;                /* cards and form */
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);

  /* ---- Misc ---- */
  --header-offset: 5rem;            /* stops the sticky header covering section titles */
  --transition: 150ms ease;
}


/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: var(--header-offset);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height);
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-md);
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
}

p {
  margin: 0 0 var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-primary);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-primary-hover);
}

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

img {
  max-width: 100%;
  height: auto;
}

/* Layout helpers */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.narrow {
  max-width: calc(var(--narrow-width) + 2 * var(--gutter));
}

/* "Skip to content" link, visible only when focused with the keyboard */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  z-index: 100;
  padding: var(--space-xs) var(--space-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-xs);
}


/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-lg);
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
}

.brand {
  color: var(--color-text);
  font-size: 1.1875rem;
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-primary);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: var(--space-2xs) 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;              /* comfortable tap target */
  padding: var(--space-xs) var(--space-lg);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  font: inherit;
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.button--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.button--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-on-primary);
}

.button--secondary {
  background: transparent;
  color: var(--color-primary);
}

.button--secondary:hover {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}


/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding: var(--space-2xl) 0;
}

.hero-title {
  font-size: var(--font-size-h1);
  margin-bottom: var(--space-xs);
}

.hero-tagline {
  font-size: var(--font-size-tagline);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

.hero-text {
  max-width: 36rem;
  color: var(--color-text-muted);
}


/* ==========================================================================
   Sections and cards
   ========================================================================== */

.section {
  padding: var(--space-2xl) 0;
}

.section--alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-size: var(--font-size-h2);
}

.card-grid {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.card {
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: var(--font-size-h3);
  margin-bottom: var(--space-xs);
}

.card p {
  color: var(--color-text-muted);
}


/* ==========================================================================
   Contact
   ========================================================================== */

.contact-grid {
  display: grid;
  gap: var(--space-xl);
}

.contact-list {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
}

.contact-list li {
  margin-bottom: var(--space-md);
}

.contact-label {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.contact-list a {
  font-weight: var(--font-weight-bold);
  word-break: break-word;
}

/* Form */
.contact-form {
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.form-row {
  display: grid;
  gap: 0 var(--space-md);
}

.field {
  margin-bottom: var(--space-md);
}

.field label {
  display: block;
  margin-bottom: var(--space-2xs);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-small);
}

.optional {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-normal);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;               /* 16px+ stops iPhones zooming in on tap */
}

.field textarea {
  resize: vertical;
  min-height: 8rem;
}

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

/* Red border only after someone has typed something invalid */
.field input:user-invalid,
.field select:user-invalid,
.field textarea:user-invalid {
  border-color: var(--color-error-text);
}

/* Honeypot: moved off screen so people never see it */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Turnstile security check (only takes up space when it's switched on) */
.turnstile-widget:not(:empty) {
  margin-bottom: var(--space-md);
}

/* Inline success / error / info message */
.form-status {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-small);
}

.form-status--success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.form-status--error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.form-status--info {
  background: var(--color-info-bg);
  color: var(--color-info-text);
}


/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding: var(--space-xl) 0;
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  font-size: var(--font-size-small);
}

.footer-inner p {
  margin-bottom: var(--space-2xs);
}

.footer-brand {
  color: var(--color-on-primary);
  font-weight: var(--font-weight-bold);
}


/* ==========================================================================
   Larger screens (mobile styles above are the default)
   ========================================================================== */

/* Tablets and up */
@media (min-width: 40em) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-xl);
  }
}

/* Laptops and up */
@media (min-width: 56em) {
  .site-nav ul {
    gap: var(--space-lg);
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }

  .contact-grid {
    grid-template-columns: 1fr 1.5fr;
    align-items: start;
  }
}
