/*
Theme Name: Taunton School Support
Theme URI: https://www.tauntonschool.co.uk/
Author: Taunton School IT
Description: Lightweight, mobile-first Taunton School branded WordPress theme for the eduroam support site, BYOD certificate portal and installation guides.
Version: 1.1.4
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: taunton-school-byod
*/

:root {
  --ts-navy: #00305f;
  --ts-silver: #b7b7b7;
  --ts-red: #c80b0e;
  --ts-green: #58b998;
  --ts-purple: #9b90c5;
  --ts-orange: #f08159;
  --ts-teal: #56accb;
  --ts-ink: #122238;
  --ts-muted: #667487;
  --ts-soft: #f4f6f8;
  --ts-white: #ffffff;
  --ts-border: #dfe5eb;
  --ts-radius: 18px;
  --ts-shadow: 0 8px 28px rgba(0, 48, 95, .08);
  --ts-heading: "Trajan Sans Pro", "Arial Narrow", "Aptos Narrow", Arial, sans-serif;
  --ts-body: "Mr Eaves Modern", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ts-ink);
  background: var(--ts-white);
  font-family: var(--ts-body);
  font-size: 18px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--ts-navy); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
  clip: auto !important; width: auto; height: auto; padding: .8rem 1rem;
  margin: .5rem; background: #fff; color: var(--ts-navy); z-index: 100000;
}

/* Header */
.ts-site-header {
  position: relative;
  z-index: 50;
  background: var(--ts-navy);
  color: #fff;
  border-top: 5px solid var(--ts-teal);
}
.ts-support-strip {
  background: #fff;
  border-bottom: 1px solid var(--ts-border);
  color: var(--ts-navy);
}
.ts-support-strip-inner {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 8px clamp(16px, 3vw, 44px) 7px;
  font-family: var(--ts-body);
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.ts-header-inner {
  width: min(100%, 1500px);
  margin: 0 auto;
  min-height: 82px;
  padding: 14px clamp(16px, 3vw, 44px);
  display: flex;
  align-items: center;
  gap: 24px;
}
.ts-brand { display: flex; align-items: center; gap: 16px; min-width: 0; text-decoration: none; color: #fff; }
.ts-brand:hover { color: #fff; }
.custom-logo-link { display: flex; align-items: center; flex: 0 0 auto; }
.custom-logo, .ts-uploaded-logo { display: block; width: auto; max-width: var(--ts-logo-desktop-width, 220px); max-height: 68px; object-fit: contain; }
.ts-mobile-logo { display: none; }
.ts-brand-text { min-width: 0; }
.ts-site-name {
  margin: 0;
  color: #fff;
  font-family: var(--ts-heading);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 400;
  letter-spacing: .045em;
  line-height: 1.08;
  text-transform: uppercase;
}
.ts-site-tagline { margin: 4px 0 0; color: rgba(255,255,255,.76); font-size: .84rem; line-height: 1.25; }
.ts-header-spacer { flex: 1 1 auto; }
.ts-nav-toggle {
  display: none;
  border: 1px solid rgba(255,255,255,.35);
  background: transparent;
  color: #fff;
  border-radius: 10px;
  padding: 10px 13px;
  cursor: pointer;
}
.ts-primary-nav ul { list-style: none; display: flex; gap: 6px; align-items: center; margin: 0; padding: 0; }
.ts-primary-nav a {
  display: block; color: #fff; text-decoration: none; font-size: .95rem; font-weight: 650;
  padding: 10px 12px; border-radius: 9px;
}
.ts-primary-nav a:hover, .ts-primary-nav .current-menu-item > a { background: rgba(255,255,255,.12); color: #fff; }
.ts-school-link {
  display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.42); color: #fff; text-decoration: none;
  border-radius: 999px; font-size: .86rem; white-space: nowrap;
}
.ts-school-link:hover { background: #fff; color: var(--ts-navy); }

/* Main layout */
.ts-main { width: 100%; min-height: calc(100vh - 240px); }
.ts-page-shell {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 54px) clamp(16px, 3.3vw, 50px) clamp(48px, 7vw, 90px);
}
.ts-page-shell--portal { padding-top: clamp(18px, 3vw, 34px); }
.ts-content { width: min(100%, 960px); margin-inline: auto; }
.ts-content--wide { width: min(100%, 1280px); }
.ts-content--portal { width: min(100%, 1240px); }

.ts-page-header { margin: 0 auto clamp(26px, 4vw, 46px); width: min(100%, 960px); }
.ts-page-kicker {
  margin: 0 0 7px; color: var(--ts-teal); font-family: var(--ts-heading);
  font-size: .82rem; letter-spacing: .12em; text-transform: uppercase;
}
.entry-title, .ts-page-title, h1, h2, h3, h4 {
  color: var(--ts-navy);
  font-family: var(--ts-heading);
  font-weight: 400;
  letter-spacing: .01em;
}
.entry-title, .ts-page-title {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: .98;
  text-transform: uppercase;
}
.ts-title-rule { width: 78px; height: 3px; margin-top: 18px; background: var(--ts-red); }
.entry-content > *:first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content h2 { margin: 1.8em 0 .6em; font-size: clamp(1.65rem, 4vw, 2.45rem); line-height: 1.05; text-transform: uppercase; }
.entry-content h3 { margin: 1.55em 0 .55em; font-size: clamp(1.3rem, 3vw, 1.75rem); line-height: 1.15; }
.entry-content ul, .entry-content ol { padding-left: 1.35em; }
.entry-content li + li { margin-top: .35em; }
.entry-content blockquote {
  margin: 2rem 0; padding: 1.2rem 1.4rem; border-left: 5px solid var(--ts-teal);
  background: var(--ts-soft); color: var(--ts-navy); font-size: 1.08em;
}
.entry-content hr { border: 0; border-top: 1px solid var(--ts-border); margin: 2.5rem 0; }
.entry-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--ts-border); padding: .7rem .8rem; text-align: left; }
.entry-content th { background: var(--ts-navy); color: #fff; }

/* WordPress wide/full blocks */
.entry-content .alignwide { width: min(1200px, calc(100vw - 32px)); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.entry-content .alignfull { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.entry-content figure.alignwide img, .entry-content figure.alignfull img { width: 100%; }
.entry-content .wp-block-image { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.entry-content .wp-block-image img { border-radius: 10px; }
.entry-content .wp-element-caption, .wp-caption-text { color: var(--ts-muted); font-size: .85rem; }

/* Buttons */
.wp-block-button__link, .ts-button, input[type="submit"] {
  border: 0; border-radius: 10px; background: var(--ts-navy); color: #fff !important;
  padding: .72em 1.15em; text-decoration: none; font-weight: 700; line-height: 1.2;
}
.wp-block-button__link:hover, .ts-button:hover, input[type="submit"]:hover { background: var(--ts-red); }

/* Guide pages */
.single-ts_byod_guide .ts-page-shell { padding-top: clamp(28px, 5vw, 62px); }
.single-ts_byod_guide .entry-content { font-size: 1.02rem; }
.single-ts_byod_guide .entry-content img { box-shadow: 0 8px 30px rgba(0,48,95,.11); border: 1px solid #edf0f3; }
.ts-guide-back { margin-bottom: 22px; }
.ts-guide-back a { font-weight: 700; text-decoration: none; }
.ts-guide-back a::before { content: "← "; }

/* Eduroam/BYOD support integration: brand + maximize usable viewport */
.ts-content--portal .ts-byod-wrap,
.entry-content .ts-byod-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  font-family: var(--ts-body) !important;
}
.ts-byod-wrap .ts-byod-card {
  border-radius: var(--ts-radius) !important;
  box-shadow: var(--ts-shadow) !important;
  border: 1px solid #e2e8ef !important;
  border-left: 1px solid #e2e8ef !important;
}
.ts-byod-wrap .ts-byod-title,
.ts-byod-wrap h1,
.ts-byod-wrap h2,
.ts-byod-wrap h3 {
  font-family: var(--ts-heading) !important;
  font-weight: 400 !important;
}
.ts-byod-wrap .ts-byod-title { text-transform: uppercase; letter-spacing: .015em; }
.ts-byod-wrap .ts-byod-header {
  border-left: 1px solid #e2e8ef !important;
}
.ts-byod-wrap .ts-byod-btn,
.ts-byod-wrap .ts-byod-downloads a {
  border-radius: 10px !important;
  min-height: 52px;
  justify-content: center;
  font-size: 1rem;
}
.ts-byod-wrap .ts-byod-check-card,
.ts-byod-wrap .ts-byod-check-card.is-success,
.ts-byod-wrap .ts-byod-check-card.is-failed,
.ts-byod-wrap .ts-byod-check-card.is-unconfigured {
  border-left: 1px solid #e2e8ef !important;
}
/* Plugin ownership boundary
 * The support theme intentionally does not set BYOD plugin button/background colours.
 * The plugin's own settings and inline method colours remain authoritative.
 */
/* Preserve plugin colours while providing clear interaction feedback.
 * filter/transform work with any colour selected in the plugin settings. */
.ts-byod-wrap .ts-byod-downloads a,
.ts-byod-wrap .ts-byod-btn {
  cursor: pointer;
  transition: filter .16s ease, transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.ts-byod-wrap .ts-byod-downloads a:hover,
.ts-byod-wrap .ts-byod-btn:hover {
  filter: brightness(.88);
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(0,48,95,.16);
}
.ts-byod-wrap .ts-byod-downloads a:active,
.ts-byod-wrap .ts-byod-btn:active {
  filter: brightness(.78);
  transform: translateY(0) scale(.992);
  box-shadow: 0 2px 7px rgba(0,48,95,.12);
}
.ts-byod-wrap .ts-byod-downloads a:focus-visible,
.ts-byod-wrap .ts-byod-btn:focus-visible {
  outline: 3px solid var(--ts-teal);
  outline-offset: 3px;
}
/* Support page + sidebar */
.ts-support-layout {
  width: min(100%, 1280px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: clamp(28px, 4vw, 54px);
  align-items: start;
}
.ts-support-layout .ts-content { width: 100%; margin: 0; }
.ts-support-layout .ts-page-header { width: 100%; }
.ts-support-sidebar {
  min-width: 0;
  position: sticky;
  top: 24px;
}
.ts-support-sidebar-inner {
  display: block;
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--ts-border);
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(0,48,95,.055);
}
.ts-support-sidebar .widget,
.ts-support-sidebar .wp-block-group {
  margin: 0;
}
.ts-support-sidebar .widget {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.ts-support-sidebar .widget + .widget {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--ts-border);
}
.ts-support-sidebar .widget-title,
.ts-support-sidebar h2,
.ts-support-sidebar h3 {
  margin-top: 0;
  margin-bottom: .65rem;
  color: var(--ts-navy);
  font-family: var(--ts-heading);
  font-weight: 400;
  line-height: 1.08;
}
.ts-support-sidebar p:last-child,
.ts-support-sidebar ul:last-child { margin-bottom: 0; }
.ts-support-sidebar ul { padding-left: 1.15em; }
.ts-support-sidebar .wp-block-button__link { width: 100%; text-align: center; }

/* Footer */
.ts-site-footer { background: var(--ts-navy); color: rgba(255,255,255,.83); border-bottom: 6px solid var(--ts-teal); }
.ts-footer-inner {
  width: min(100%, 1500px); margin: 0 auto; padding: 28px clamp(16px, 3vw, 44px);
  display: flex; align-items: center; gap: 22px; justify-content: space-between; font-size: .88rem;
}
.ts-footer-inner p { margin: 0; }
.ts-site-footer a { color: #fff; }

/* Forms/accessibility */
:focus-visible { outline: 3px solid var(--ts-orange); outline-offset: 3px; }
input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea, select {
  width: 100%; border: 1px solid #b9c4cf; border-radius: 8px; padding: 10px 12px; background: #fff; color: var(--ts-ink);
}

@media (max-width: 900px) {
  .ts-nav-toggle { display: inline-flex; }
  .ts-primary-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--ts-navy);
    padding: 0 16px 18px; box-shadow: 0 18px 30px rgba(0,0,0,.18);
  }
  .ts-primary-nav.is-open { display: block; }
  .ts-primary-nav ul { display: block; }
  .ts-primary-nav a { padding: 12px 10px; }
  .ts-school-link { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .ts-site-header { border-top-width: 4px; }
  .ts-header-inner { min-height: 76px; padding: 10px 14px; gap: 10px; justify-content: center; }
  .custom-logo-link, .ts-desktop-logo, .ts-mobile-logo { margin-inline: auto; }
  .custom-logo, .ts-uploaded-logo { max-width: var(--ts-logo-mobile-width, 235px); max-height: 56px; }
  .ts-header-spacer { display: none; }
  .ts-support-strip-inner { padding: 7px 14px 6px; text-align: center; font-size: .72rem; letter-spacing: .06em; }
  .ts-desktop-logo.has-mobile-logo { display: none; }
  .ts-mobile-logo { display: flex; }
  .ts-nav-toggle { position: absolute; right: 12px; }
  .ts-site-tagline { display: none; }
  .ts-site-name { font-size: 1rem; }
  .ts-page-shell,
  .ts-page-shell--portal { padding: 14px 10px 46px; }
  .ts-page-header { margin-bottom: 22px; padding-inline: 4px; }
  .entry-title, .ts-page-title { font-size: clamp(2rem, 11vw, 3rem); }
  .entry-content .alignwide { width: calc(100vw - 20px); }
  .ts-footer-inner { padding: 23px 14px; display: block; }
  .ts-footer-inner > * + * { margin-top: 8px; }

  .ts-content--portal { width: 100%; }
  .ts-content--portal .entry-content { width: 100%; }
  .ts-byod-wrap .ts-byod-card { margin: 10px 0 !important; padding: 15px !important; border-radius: 14px !important; }
  .ts-byod-wrap .ts-byod-title { font-size: clamp(1.75rem, 8.5vw, 2.35rem) !important; }
  .ts-byod-wrap .ts-byod-downloads { max-width: none !important; width: 100% !important; }
  .ts-byod-wrap .ts-byod-downloads a, .ts-byod-wrap .ts-byod-btn { width: 100% !important; min-height: 56px; }
  .ts-byod-wrap .ts-byod-check-card { gap: 12px !important; }
  .ts-byod-wrap .ts-byod-check-icon { width: 48px !important; height: 48px !important; min-width: 48px !important; font-size: 29px !important; }
}

@media (max-width: 900px) {
  .ts-support-layout { grid-template-columns: 1fr; gap: 30px; }
  .ts-support-sidebar { position: static; }
}

@media (max-width: 640px) {
  .ts-support-sidebar-inner { padding: 18px; border-radius: 14px; }
  .ts-support-sidebar .widget { padding: 0; border-radius: 0; }
}

/* Support-site refinements */
.ts-footer-logo { display:flex; align-items:center; flex:0 0 auto; }
.ts-footer-logo img { display:block; width:auto; max-width:150px; max-height:52px; }
.ts-has-byod-portal .entry-content { width:100%; }
.ts-has-byod-portal .ts-page-shell { max-width:none; }
@media (min-width: 1100px) {
  body:not(.ts-has-byod-portal) .ts-content { width:min(100%, 1080px); }
  body:not(.ts-has-byod-portal) .ts-page-header { width:min(100%, 1080px); }
}
@media (max-width:640px) {
  .ts-footer-logo { margin-bottom:12px; }
  .ts-footer-logo img { max-width:130px; max-height:46px; }
}
