/* SPI phone + table fixes, 26 Nov 2026. Loaded after theme and page-controls. */

/* ----- Periodic table: horizontal names, hyphenate at soft hyphens, 72px rows ----- */
#root #elements .periodic-grid {
  grid-auto-rows: minmax(72px, auto) !important;
}
#root #elements .periodic-grid button.element-cell,
#root .periodic-grid .element-cell {
  height: 100% !important;
  min-height: 72px !important;
}
#root #elements .periodic-grid button.element-cell > span.el-name,
#root .periodic-grid .element-cell > span.el-name {
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  text-align: center !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  -webkit-hyphens: manual !important;
  hyphens: manual !important;
  -webkit-hyphenate-limit-chars: 6 3 3;
  hyphenate-limit-chars: 6 3 3;
  overflow: hidden !important;
  line-height: 1.15 !important;
  writing-mode: horizontal-tb !important;
  transform: none !important;
  max-width: 100% !important;
  height: auto !important;
}

@media (max-width: 640px) {
  /* Names stay hidden on phones so the mass has room. */
  #root #elements .periodic-grid button.element-cell > span.el-name.hidden {
    display: none !important;
  }
  #root #elements .periodic-grid {
    grid-auto-rows: minmax(56px, auto) !important;
  }
  #root #elements .periodic-grid button.element-cell,
  #root .periodic-grid .element-cell {
    min-height: 56px !important;
  }
}

/* ----- Header tagline above the Ff tile; all Learn-toFly banners centred ----- */
#root header > div > div:first-child {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  text-align: center !important;
}
#root header > div > div:first-child > p:first-child {
  order: 2;
  max-width: 22em !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
  text-wrap: balance;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: none !important;
  line-height: 1.35 !important;
}
#root header .header-brand,
#root header .lesson-brand-link {
  order: 1;
  margin-left: auto !important;
  margin-right: auto !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}
#root header .main-site-label {
  text-align: center !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
}
#root main > section:has(> .lesson-brand-link) {
  padding-top: 16px !important;
}
#root main > section > .lesson-brand-link {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 12px auto !important;
  width: fit-content;
  max-width: 100%;
  text-align: center !important;
}
#root footer,
#root footer p,
footer.fl-foot {
  text-align: center !important;
}

@media (max-width: 640px) {
  #root header > div > div:first-child > p:first-child {
    font-size: 11px !important;
    max-width: 18em !important;
  }
}

/* Legal / static pages: keep the brand stack centred. */
html.legal-page #root header > div {
  align-items: center !important;
  text-align: center !important;
}

/* ----- Lab write-up tiles and apparatus names: never split mid-word ----- */
#root #writeup [class*="grid-cols-2"] > span,
#root #writeup [class*="grid-cols-2"] > span span,
#root #lab li,
#root #lab li *,
#root #lab .apparatus-item,
#root #lab .apparatus-item * {
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  -webkit-hyphens: none !important;
  hyphens: none !important;
}
@media (max-width: 640px) {
  /* Widen the labelled-diagram tiles so Stopwatch, Thermometer and
     similar names stay on one line even with larger phone text. */
  #root #writeup [class*="grid-cols-2"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #root #writeup [class*="grid-cols-2"] > span {
    font-size: 12px !important;
    line-height: 1.3;
    text-align: center !important;
  }
}

/* ----- Kit signup forms: stack on phones so the amber button sits
   full-width under the email box, with a horizontal one-line label.
   Root cause: Kit ships min-width="400 500 600 700 800", so
   [min-width~="600"] can match before the script rewrites it, putting
   Email + submit in a row and shrinking the button. These overrides
   force the stacked layout up to 600px and cancel any sideways label. */
@media (max-width: 600px) {
  #root .formkit-form[data-uid][min-width] .formkit-fields,
  #root .formkit-form[data-uid][min-width] .formkit-fields[data-stacked="false"],
  #root [data-kit-embed] .formkit-fields,
  #root #student-go-pro-signup .formkit-fields,
  #root #teacher-waitlist .formkit-fields,
  #root #kit .formkit-fields {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 8px;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  #root .formkit-form[data-uid][min-width] .formkit-fields[data-stacked="false"] .formkit-field,
  #root .formkit-form[data-uid][min-width] .formkit-fields[data-stacked="false"] .formkit-submit,
  #root .formkit-form[data-uid][min-width] .formkit-field,
  #root .formkit-form[data-uid][min-width] .formkit-submit,
  #root [data-kit-embed] .formkit-field,
  #root [data-kit-embed] .formkit-submit,
  #root #student-go-pro-signup .formkit-field,
  #root #student-go-pro-signup .formkit-submit,
  #root #teacher-waitlist .formkit-field,
  #root #teacher-waitlist .formkit-submit,
  #root #kit .formkit-field,
  #root #kit .formkit-submit {
    flex: 1 0 100% !important;
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  #root .formkit-form[data-uid][min-width] .formkit-submit,
  #root [data-kit-embed] .formkit-submit,
  #root #student-go-pro-signup .formkit-submit,
  #root #teacher-waitlist .formkit-submit,
  #root #kit .formkit-submit {
    display: block !important;
    min-height: 44px !important;
    height: auto !important;
    padding: 0 !important;
    overflow: hidden !important;
    writing-mode: horizontal-tb !important;
    transform: none !important;
    container-type: unset;
  }
  #root .formkit-form[data-uid][min-width] .formkit-submit > span,
  #root [data-kit-embed] .formkit-submit > span,
  #root #student-go-pro-signup .formkit-submit > span,
  #root #teacher-waitlist .formkit-submit > span,
  #root #kit .formkit-submit > span {
    writing-mode: horizontal-tb !important;
    transform: none !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
    text-align: center !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: keep-all !important;
    hyphens: none !important;
    padding: 12px 16px !important;
    line-height: 1.2 !important;
    min-height: 44px !important;
  }
}

/* At all widths: never letter-wrap a Kit submit label, and keep a
   comfortable tap height. Desktop may stay side by side. */
#root .formkit-submit {
  container-type: unset;
  min-height: 44px !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  hyphens: none !important;
  writing-mode: horizontal-tb !important;
  transform: none !important;
}
#root .formkit-submit > span {
  writing-mode: horizontal-tb !important;
  transform: none !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  hyphens: none !important;
  white-space: nowrap !important;
}

/* Cancel the previous preview's sideways-column rules at every width,
   with equal or higher specificity, in case a bundled stylesheet still
   carries them. */
#root #student-go-pro-signup .formkit-submit,
#root [data-kit-embed="7855edd421"] .formkit-submit,
#root .formkit-form[data-uid="7855edd421"] .formkit-submit,
#root #teacher-waitlist .formkit-submit,
#root #kit .formkit-submit,
#root [data-kit-embed] .formkit-submit {
  writing-mode: horizontal-tb !important;
  transform: none !important;
  container-type: unset;
  min-height: 44px !important;
}
#root #student-go-pro-signup .formkit-submit > span,
#root [data-kit-embed="7855edd421"] .formkit-submit > span,
#root .formkit-form[data-uid="7855edd421"] .formkit-submit > span,
#root #teacher-waitlist .formkit-submit > span,
#root #kit .formkit-submit > span,
#root [data-kit-embed] .formkit-submit > span {
  writing-mode: horizontal-tb !important;
  transform: none !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  hyphens: none !important;
}

@media (max-width: 600px) {
  #root #student-go-pro-signup .formkit-submit,
  #root [data-kit-embed="7855edd421"] .formkit-submit,
  #root .formkit-form[data-uid="7855edd421"] .formkit-submit {
    flex: 1 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* Fit the full 18-column table (including lanthanide and actinide
   rows) in the screen width. No horizontal page scroll and no inner
   scroll box. Tile and type sizes scale down as the viewport narrows.
   Names stay horizontal with soft hyphens; phones keep symbols only. */
#root #elements [data-elements-table],
#root #elements #elements-table-scroll,
#root #elements #elements-table-scroll.chem-scroll,
#root #elements .periodic-grid {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  overflow-x: visible !important;
}
#root #elements .periodic-grid {
  display: grid !important;
  --pt-gap: 3px;
  gap: var(--pt-gap) !important;
  /* Size tracks from the grid's own width, not content, so 18 columns
     always fit the screen. */
  grid-template-columns: repeat(18, minmax(0, calc((100% - 17 * var(--pt-gap)) / 18))) !important;
  overflow: hidden !important;
}
#root #elements .periodic-grid > *,
#root #elements .periodic-grid button.element-cell,
#root #elements .periodic-grid .element-cell {
  min-width: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#root #elements .periodic-grid button.element-cell,
#root #elements .periodic-grid .element-cell,
#root .periodic-grid .element-cell {
  aspect-ratio: auto !important;
}


/* ~1280 and below: keep names, slightly tighter type */
@media (max-width: 1280px) {
  #root #elements .periodic-grid button.element-cell > span:first-child {
    font-size: 8px !important;
    line-height: 1.05 !important;
  }
  #root #elements .periodic-grid button.element-cell > .el-sym {
    font-size: 14px !important;
    line-height: 1.05 !important;
  }
  #root #elements .periodic-grid button.element-cell > span.el-name {
    font-size: 7px !important;
    line-height: 1.1 !important;
  }
  #root #elements .periodic-grid button.element-cell > span:last-child {
    font-size: 7px !important;
    line-height: 1.05 !important;
  }
}

/* Tablet (~768): shrink type and padding so hyphenated names still fit */
@media (max-width: 900px) {
  #root #elements .periodic-grid {
    --pt-gap: 2px;
    gap: var(--pt-gap) !important;
    padding: 2px 1px 3px !important;
  }
  #root #elements [data-elements-table] {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
  #root #elements .periodic-grid button.element-cell,
  #root #elements .periodic-grid .element-cell {
    padding: 2px 1px 3px !important;
    min-height: 64px !important;
    border-width: 1px !important;
    border-radius: 6px !important;
  }
  #root #elements .periodic-grid {
    grid-auto-rows: minmax(64px, auto) !important;
  }
  #root #elements .periodic-grid button.element-cell > span:first-child {
    font-size: 7px !important;
  }
  #root #elements .periodic-grid button.element-cell > .el-sym {
    font-size: 11px !important;
  }
  #root #elements .periodic-grid button.element-cell > span.el-name {
    font-size: 6px !important;
    line-height: 1.1 !important;
  }
  #root #elements .periodic-grid button.element-cell > span:last-child {
    font-size: 6px !important;
  }
  #root #elements .periodic-grid .element-cell:not(button) {
    font-size: 6px !important;
    line-height: 1.1 !important;
    padding: 1px !important;
  }
  #root #elements .periodic-grid button.element-cell > .el-star,
  #root #elements .element-cell .el-star {
    font-size: 7px !important;
  }
}

/* Phones: symbols only, still a full 18-column table with no sideways scroll */
@media (max-width: 640px) {
  #root #elements .periodic-grid {
    --pt-gap: 1px;
    gap: var(--pt-gap) !important;
    padding: 1px 0 2px !important;
    grid-auto-rows: minmax(36px, auto) !important;
  }
  #root #elements [data-elements-table] {
    padding: 6px 4px !important;
  }
  #root #elements .periodic-grid button.element-cell,
  #root #elements .periodic-grid .element-cell {
    padding: 1px 0 2px !important;
    min-height: 36px !important;
    border-width: 1px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
  }
  #root #elements .periodic-grid button.element-cell > span.el-name,
  #root #elements .periodic-grid button.element-cell > span.el-name.hidden {
    display: none !important;
  }
  #root #elements .periodic-grid button.element-cell > span:first-child {
    font-size: 5px !important;
    line-height: 1 !important;
  }
  #root #elements .periodic-grid button.element-cell > .el-sym {
    font-size: 8px !important;
    line-height: 1 !important;
    margin: 0 !important;
  }
  #root #elements .periodic-grid button.element-cell > span:last-child {
    font-size: 5px !important;
    line-height: 1 !important;
  }
  #root #elements .periodic-grid .element-cell:not(button) {
    font-size: 5px !important;
    line-height: 1.05 !important;
    padding: 0 !important;
  }
  #root #elements .element-cell .el-star {
    font-size: 5px !important;
    top: 0;
    right: 0;
  }
}

/* The table now fits the screen width, so the custom sideways-scroll
   rail and its swipe hint are not needed. */
#root #elements .element-scroll-control,
#root #elements .element-scroll-help {
  display: none !important;
}

/* Element search hint: keep the example visible on phones, never clip mid-word. */
#elements .elements-search-hint {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
#elements .elements-search-input {
  min-width: 0;
}

/* Stacked tagline when space is tight: Learn-toFly, then indented Learn to Excel. */
.site-tagline{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  line-height:1.3;
  max-width:100%;
}
.site-tagline-excel{padding-left:1.15em;}
@media (min-width:641px){
  .site-tagline{display:block;}
  .site-tagline-fly,
  .site-tagline-excel{display:inline;}
  .site-tagline-excel{padding-left:.4em;}
}

@media (min-width:768px){
  .site-menu-button{display:none !important;}
  .site-menu-panel{display:none !important;}
}
@media (max-width:767px){
  .site-nav-desktop{display:none !important;}
}

/* Hub cards and featured short: wrap between words only, fit narrow phones. */
.hub-card h3,
.hub-card p,
.featured-star-stuff h2,
.featured-star-stuff p,
.hub-page h2{
  overflow-wrap:break-word;
  word-break:normal;
  hyphens:none;
}
.featured-star-stuff figure,
.featured-star-stuff .aspect-video{
  max-width:100%;
}

/* Official Pale Blue Dot embed sits beside Star Stuff from 768px, stacked on phones. */
.featured-media{
  display:grid;
  gap:1rem;
  width:100%;
  max-width:100%;
}
.featured-media figure{
  min-width:0;
  max-width:100%;
  margin-left:auto;
  margin-right:auto;
}
.pale-blue-dot-frame{
  position:relative;
  width:100%;
  aspect-ratio:16 / 9;
  overflow:hidden;
}
.pale-blue-dot-frame iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
  display:block;
}
.pale-blue-dot figcaption,
.featured-star-stuff figcaption{
  overflow-wrap:break-word;
  word-break:normal;
  hyphens:none;
}
@media (min-width:768px){
  .featured-media{
    grid-template-columns:1fr 1fr;
    align-items:start;
  }
  .featured-media figure{
    margin-left:0;
    margin-right:0;
    max-width:none;
    width:100%;
  }
}


.lesson-plan-nav a,
.lesson-plan-nav span{
  word-break:normal;
  overflow-wrap:normal;
}

/* New site chrome: do not let the old header order:1 rule send the Learn-toFly
   banner below the nav. Keep it under the tagline, as SiteChrome authors it. */
#root header .header-brand,
#root header .lesson-brand-link {
  order: 0;
}


/* Illustration placements — stack on phones, sit beside copy from 768px. */
.kit-lab-photo,
.writeup-apparatus-figure,
.worksheet-1a-figure,
.kit-form-photo{
  margin: 0;
  max-width: 100%;
}
.kit-lab-photo img,
.writeup-apparatus-figure img,
.kit-form-photo{
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: cover;
  border-radius: 18px;
}
.kit-lab-photo img{
  border: 2px solid rgba(255,255,255,.35);
}
.worksheet-1a-figure{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 8px 12px;
}
.worksheet-1a-figure svg{
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
.worksheet-1a-figure figcaption,
.writeup-apparatus-figure figcaption,
.kit-lab-photo figcaption{
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.writeup-apparatus-grid,
.worksheet-1a-grid{
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.writeup-apparatus-grid > div,
.worksheet-1a-grid > ol{
  min-width: 0;
}
.worksheet-1a{
  overflow: visible;
}
.worksheet-1a-grid > ol{
  padding-left: 2.25rem;
  overflow: visible;
  list-style-position: outside;
}

@media (min-width: 768px){
  .writeup-apparatus-grid,
  .worksheet-1a-grid{
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 1.25rem;
    align-items: start;
  }
}

/* Kit form header: keep Kit markup as-is; align the title left and
   place our picture in the header region on wide screens. */
.kit-form-stage{
  position: relative;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 767px){
  .kit-form-stage{
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .kit-form-stage .kit-form-photo{
    position: static;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
  }
}
@media (min-width: 768px){
  .kit-form-stage .kit-form-photo{
    position: absolute;
    top: 20px;
    right: 20px;
    width: min(44%, 360px);
    height: auto;
    aspect-ratio: 16 / 9;
    z-index: 2;
    pointer-events: none;
    border-radius: 14px;
  }
  .kit-form-stage .formkit-header,
  .kit-form-stage .formkit-header h2,
  .kit-form-stage .formkit-subheader,
  .kit-form-stage .formkit-subheader p{
    text-align: left !important;
  }
  .kit-form-stage .formkit-header,
  .kit-form-stage .formkit-subheader{
    max-width: 52%;
    padding-right: 8px;
  }
  .kit-form-stage .formkit-header{
    margin: 0 0 10px 0 !important;
  }
  .kit-form-stage .formkit-header h2{
    margin-top: 0 !important;
    margin-bottom: 0.25em !important;
  }
  .kit-form-stage .formkit-subheader{
    margin-top: 0 !important;
  }
  .kit-form-stage [data-style="minimal"]{
    padding-top: 20px;
  }
  /* Short Teacher Pro subheader still needs room so fields clear the photo. */
  .kit-form-stage--students .formkit-subheader,
  .kit-form-stage--teachers .formkit-subheader{
    min-height: 140px;
  }
}

@media (max-width: 767px){
  .kit-lab-photo,
  .writeup-apparatus-figure,
  .worksheet-1a-figure,
  .kit-form-photo{
    width: 100%;
  }
}
