/* Colours and font match the Literacy Centre website (Elementor global settings) */
@font-face {
  font-family: 'Archivo';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/archivo-700-latin.woff2') format('woff2');
}

:root {
  --color-primary: #CF5723;
  --color-text: #565656;
  --color-page-bg: #F0F0F0;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Archivo', Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-page-bg);
}

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

/* Header: white card with the orange slanted logo panel, like the website */
header {
  max-width: 1100px; margin: 16px auto 0;
  background: #fff; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex; justify-content: space-between;
}
.logo-link {
  display: inline-block; vertical-align: top; background: var(--color-primary);
  padding: 20px 72px 20px 32px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 48px) 100%, 0 100%);
}
.logo-link:focus-visible { outline: 4px solid var(--color-text); outline-offset: -6px; }
/* Orange panel: clip-path cuts the link's own outline, so ring the logo in white instead */
.logo-link:not(.ties-link):focus-visible { outline: none; }
.logo-link:not(.ties-link):focus-visible img { outline: 3px solid #fff; outline-offset: 6px; }
.logo-link img { display: block; height: 56px; width: auto; }
.hub-title {
  flex: 1; align-self: center; margin: 0; padding: 0 16px 0 40px; text-align: left;
  font-size: 36px; font-weight: 700; color: var(--color-primary);
}
/* Main TIES logo: red logo straight on the white banner, at the right end */
.ties-link { background: none; clip-path: none; padding: 22px 32px 16px; }
.ties-link img { height: 48px; }

/* Grid of 8 app buttons: 4 across on desktop */
main { max-width: 1100px; margin: 0 auto; padding: 56px 32px 32px; }
.apps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px;
}
.app {
  display: flex; flex-direction: column; height: 100%;
  padding: 16px; gap: 16px;
  background: #fff; border: 3px solid transparent; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  color: var(--color-text); text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.app:hover { border-color: var(--color-primary); transform: translateY(-3px); }
.app:focus-visible { outline: 4px solid var(--color-primary); outline-offset: 4px; }
.pic {
  aspect-ratio: 3 / 2; border-radius: var(--radius-sm); overflow: hidden;
  background: #fff;
}
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic img.top { object-position: center top; }
.pic img.fit { object-fit: contain; padding: 4px; }
.pic img.lockup { padding: 0 12%; }
.name {
  font-size: 22px; font-weight: 700; line-height: 1.3; text-align: center;
  margin-top: auto; margin-bottom: auto;
}
.mobile-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  .app { transition: none; }
  .app:hover { transform: none; }
}

/* Tablet and phone: 2 across */
@media (max-width: 900px) {
  .apps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  main { padding: 32px 16px 16px; }
  .app { padding: 10px; }
  header { margin: 16px 16px 0; }
  .logo-link { padding: 14px 56px 14px 16px; clip-path: polygon(0 0, 100% 0, calc(100% - 36px) 100%, 0 100%); }
  .logo-link img { height: 40px; }
  .ties-link { padding: 15px 16px 10px; }
  .ties-link img { height: 34px; }
  .mobile-only { display: inline; }
  .desktop-only { display: none; }
  /* Every name gets room for two lines so all buttons are the same height */
  .name { margin: 0; min-height: 2.6em; }
}

/* Phones: both logo panels share the banner width and the logos shrink to fit */
@media (max-width: 600px) {
  .logo-link { flex: 0 1 63%; padding: 12px 40px 12px 12px; clip-path: polygon(0 0, 100% 0, calc(100% - 28px) 100%, 0 100%); }
  .ties-link { flex: 0 1 35%; padding: 12px; clip-path: none; }
  .logo-link img { width: 100%; height: auto; }
  /* No room between the logos: the title gets its own row under them */
  header { flex-wrap: wrap; }
  .hub-title { order: 3; flex-basis: 100%; padding: 8px 16px 12px; font-size: 28px; text-align: center; }
}

/* Narrow phones (e.g. 360px Android): smaller names so "Adults Learn to Print" fits two lines */
@media (max-width: 374px) {
  .name { font-size: 20px; }
}
