/* ============================================================
   tomsc.com
   ============================================================ */

@font-face {
  font-family: "Formular Mono";
  src: url("assets/formular-mono-regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "GT Standard L Light";
  src: url("assets/gt-standard-l-light.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* palette */
  --bg:        #ffffff;
  --ink:       #202020;
  --muted:     rgba(32, 32, 32, 0.6);
  --ghost:     rgba(33, 33, 33, 0.3);
  --rule:      rgba(32, 32, 32, 0.45);

  /* type */
  --mono: "Formular Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "GT Standard L Light", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  /* measure — the content column is a fixed width, centred in the viewport */
  --col:  620px;
  --edge: 72px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* A flex column so the footer is pinned to the bottom of the viewport when
   the page is short, and simply follows the content when it isn't. */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

em { font-style: italic; }

/* ------------------------------------------------------------
   shared type
   ------------------------------------------------------------ */

/* small uppercase monospace — nav, section labels, footer */
.mono-link,
.label {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
  white-space: nowrap;
}

.mono-link {
  font-size: 12px;
  line-height: 12px;
  letter-spacing: 1.2px;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s ease;
}

.mono-link:hover { opacity: 0.55; }

.arr {
  font-size: 11px;
  line-height: 1;
  display: inline-block;
}

/* section label — currently just TOMS CE */
.label {
  font-size: 15px;
  line-height: 21px;
  letter-spacing: 2.25px;
  color: var(--muted);
  margin: 0 0 30px;
}

/* body copy */
.body {
  font-size: 18px;
  line-height: 27px;
  letter-spacing: 0.18px;
  color: var(--ink);
  margin: 20px 0 0;
}

.body:first-of-type { margin-top: 0; }

.body--sm {
  font-size: 16px;
  line-height: 25.6px;
  letter-spacing: -0.16px;
}

.inline-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.25s ease;
}

.inline-link:hover { opacity: 0.55; }

/* ------------------------------------------------------------
   layout
   ------------------------------------------------------------ */

.col {
  width: var(--col);
  margin: 0 auto;
}

.centered {
  width: 700px;
  max-width: calc(100% - var(--edge) * 2);
  margin: 0 auto;
  text-align: center;
}

/* grows to absorb the slack, which is what pushes the footer down;
   the bottom padding keeps the gap honest once the page is long */
main {
  flex: 1 0 auto;
  padding-top: 196px;
  padding-bottom: 168px;
}

/* the closing note sits off on its own, but not adrift */
.section-lg { margin-top: 90px; }

/* ------------------------------------------------------------
   top bar
   ------------------------------------------------------------ */

.topbar {
  position: absolute;
  top: 44px;
  right: var(--edge);
  z-index: 10;
}

.nav {
  display: flex;
  align-items: flex-start;
  gap: 46px;
}

/* A nav item that reveals sub-items on hover. This is a flex column rather
   than a block so its link has no text line-box above it — otherwise the
   half-leading would push it below its plain siblings in the same row. */
.nav-group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Taken out of flow — a hidden submenu still reserves layout space, which
   would otherwise inflate the footer's height by the size of its menu. */
.submenu {
  position: absolute;
  top: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
}

.nav-group:hover .submenu,
.nav-group:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar .submenu { left: 0; align-items: flex-start; }

/* ------------------------------------------------------------
   footer
   ------------------------------------------------------------ */

/* the bottom padding clears the absolutely-placed copyright below it */
.footer {
  position: relative;
  flex: none;
  padding: 0 var(--edge) 120px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.footer-left {
  display: flex;
  align-items: flex-start;
  gap: 30px;
}

.footer-right {
  display: flex;
  justify-content: flex-end;
}

.footer-right .submenu { right: 0; align-items: flex-end; }

/* footer links draw a hairline box on hover, and slide an arrow in */
.boxed {
  border: 1px solid transparent;
  padding: 10px 14px;
  margin: -10px -14px;
  transition: border-color 0.25s ease, opacity 0.25s ease;
}

.boxed:hover {
  border-color: var(--rule);
  opacity: 1;
}

.arr--hover {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.boxed:hover .arr--hover {
  opacity: 1;
  transform: translateX(0);
}

.copyright {
  position: absolute;
  left: 60px;
  top: 58px;
  margin: 0;
  font-size: 13px;
  line-height: 13px;
  letter-spacing: 0.39px;
  color: var(--ghost);
}

/* ------------------------------------------------------------
   scroll reveal — CSS transitions only, no rAF loop, so a
   backgrounded tab still paints correctly
   ------------------------------------------------------------ */

.has-js .reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.has-js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .has-js .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ------------------------------------------------------------
   narrow viewports
   ------------------------------------------------------------ */

@media (max-width: 860px) {
  :root { --edge: 28px; }

  .col {
    width: auto;
    margin: 0 var(--edge);
  }

  main { padding-top: 150px; }

  .topbar { top: 28px; }
  .nav { gap: 28px; }

  .body { font-size: 17px; line-height: 26px; }

  /* must come after .body — same specificity, so order decides it */
  .body--sm { font-size: 14px; line-height: 21px; }

  .footer {
    flex-direction: column;
    gap: 26px;
    padding-bottom: 60px;
  }

  .footer-left { flex-direction: column; gap: 22px; }
  .footer-right { justify-content: flex-start; }
  .footer-right .submenu { left: 0; right: auto; align-items: flex-start; }

  .copyright { position: static; margin-top: 34px; }

  main { padding-bottom: 72px; }
}

@media (max-width: 520px) {
  .nav { gap: 20px; }
  .mono-link { font-size: 11px; letter-spacing: 1px; }
  .label { font-size: 13px; letter-spacing: 1.8px; }
}

