/* A shared, keyboard-accessible day/night control and raised navigation. */
:root{--surface:#132237;--surface-hover:#1c344d;--nav-ink:#e7f1ff;--nav-shadow:0 3px 7px #0005,inset 0 1px 0 #ffffff12;--focus:#70caff}
:root[data-theme=light]{color-scheme:light;--bg:#f1f5fa;--text:#182b43;--ink:#182b43;--muted:#4c627a;--line:#cad6e3;--accent:#0867b7;--blue:#0867b7;--surface:#fff;--surface-hover:#e6f0fb;--nav-ink:#243e59;--nav-shadow:0 3px 8px #203e5f16,inset 0 1px 0 #fff;--focus:#075fa5}
:root[data-theme=dark]{color-scheme:dark}
header nav{gap:9px!important;position:relative}
header nav a{position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 15px;border-radius:10px;background:var(--surface);color:var(--nav-ink)!important;box-shadow:var(--nav-shadow);font-size:14px!important;font-weight:700;transition:transform .18s,background .18s;white-space:nowrap;overflow:hidden}
header nav a::after{content:"";position:absolute;inset:0;border:1px solid var(--focus);border-radius:inherit;opacity:0;transform:scaleX(.35);transform-origin:left;transition:transform .2s cubic-bezier(.2,.8,.2,1),opacity .16s;pointer-events:none}
header nav a:hover::after,header nav a:focus-visible::after{opacity:.75;transform:scaleX(1)}
header nav a:hover{background:var(--surface-hover);transform:translateY(-2px)}
header nav a:active{transform:translateY(1px)}
header nav a[aria-current],header nav a.current{background:#1265a3;color:#fff!important}
.nav-indicator{position:absolute;left:0;bottom:-7px;width:1px;height:3px;border-radius:3px;background:var(--focus);opacity:0;transform-origin:left;transition:transform .24s cubic-bezier(.2,.8,.2,1),opacity .18s;pointer-events:none}.nav-indicator.is-visible{opacity:1}
.theme-switch{display:inline-flex;align-items:center;gap:9px;flex-shrink:0;background:transparent;border:0;color:var(--nav-ink);padding:5px 0 5px 5px;min-height:44px;font:500 14px/1.2 system-ui;cursor:pointer}
.theme-track{position:relative;display:block;width:64px;height:32px;border-radius:20px;background:#223d5a;box-shadow:inset 0 2px 4px #0003}
.theme-track svg{position:absolute;top:8px;width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;color:#d4e8ff}
.theme-sun{left:8px}.theme-moon{right:8px}.theme-knob{position:absolute;left:4px;top:4px;width:24px;height:24px;background:#fff;border-radius:50%;transition:transform .22s;box-shadow:0 2px 4px #0004}
[aria-checked=true] .theme-knob{transform:translateX(32px)}
[data-theme=light] .theme-track{background:#2378b9}
::view-transition-group(root){animation:none}::view-transition-image-pair(root){isolation:isolate}::view-transition-old(root){animation:none;mix-blend-mode:normal;z-index:1}::view-transition-new(root){mix-blend-mode:normal;z-index:2;animation:theme-portal .65s cubic-bezier(.2,.8,.2,1) both}@keyframes theme-portal{from{clip-path:circle(0 at var(--portal-x) var(--portal-y))}to{clip-path:circle(var(--portal-radius) at var(--portal-x) var(--portal-y))}}
a:focus-visible,button:focus-visible,summary:focus-visible{outline:3px solid var(--focus)!important;outline-offset:4px}
.about-details summary,details>summary{display:flex;align-items:center;gap:10px;list-style:none}.about-details summary::-webkit-details-marker,details>summary::-webkit-details-marker{display:none}.details-mark{position:relative;width:18px;height:18px;flex:0 0 18px;border:1px solid currentColor;border-radius:50%;opacity:.78;transition:transform .24s cubic-bezier(.2,.8,.2,1)}.details-mark::before,.details-mark::after{content:"";position:absolute;left:4px;right:4px;top:8px;height:1.5px;border-radius:2px;background:currentColor}.details-mark::after{transform:rotate(90deg);transition:transform .24s cubic-bezier(.2,.8,.2,1)}details[open]>summary .details-mark{transform:rotate(90deg)}details[open]>summary .details-mark::after{transform:rotate(0) scaleX(0)}details[open]>:not(summary){animation:detail-open .28s cubic-bezier(.2,.8,.2,1) both}@keyframes detail-open{from{opacity:.55;transform:translateY(-4px) scale(.99)}to{opacity:1;transform:none}}
.tool,.macro-card,.note-card{will-change:transform,opacity}.tool.motion-in,.macro-card.motion-in,.note-card.motion-in{animation:card-arrive .48s cubic-bezier(.2,.8,.2,1) var(--motion-delay,0ms) both}@keyframes card-arrive{from{opacity:.72;transform:translateY(10px) scale(.975)}to{opacity:1;transform:none}}
#copy-code{position:relative;overflow:hidden;padding-right:38px}#copy-code::before{content:"";position:absolute;inset:0;background:var(--focus);opacity:.18;transform:scaleX(0);transform-origin:left;pointer-events:none}#copy-code.is-copying::before{animation:copy-sweep .38s cubic-bezier(.2,.8,.2,1)}#copy-code::after{content:"";position:absolute;right:16px;top:50%;width:7px;height:12px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;opacity:0;transform:translateY(-65%) rotate(45deg) scale(.2)}#copy-code.is-copied::after{animation:copy-check .32s cubic-bezier(.2,.8,.2,1) both}@keyframes copy-sweep{to{transform:scaleX(1)}}@keyframes copy-check{to{opacity:1;transform:translateY(-65%) rotate(45deg) scale(1)}}
.home{font-size:16px}.home header{height:auto;min-height:88px}.home .nav{min-height:88px;gap:20px}.home .right{gap:14px}.home nav{margin:0 auto}.home .github{display:none}.home .hero{height:340px}.home .hero h1{font-size:clamp(40px,4.8vw,68px);letter-spacing:-2px}.home .hero h1 span{color:inherit;text-shadow:none}.home .hero p{font-size:18px}.home .hero-background{inset:88px 0 auto;height:500px}.home .section{margin-bottom:36px}.home .section-head h2{font-size:26px}.home .section-head>a{font-size:14px}.home .tools{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.home .tool{min-height:92px;padding:18px 16px;background:#102136e8;border-color:#35516d;gap:13px}.home .tool h3{font-size:16px;margin:0}.home .icon{width:40px;height:44px;border:0;border-radius:8px;background:#1c3853;box-shadow:none;color:#8fd0ff}.home .icon svg{width:25px;height:25px}.home .arrow{display:none}.home .about{grid-template-columns:1fr 72px 2fr;gap:24px;margin:40px 0}.home .portrait{width:72px;height:72px}.home .skills{display:none}.home .bio{border:0;padding:12px 0 0;font-size:16px}.about-details summary{font-size:16px;color:var(--text);cursor:pointer;width:fit-content}.home footer .links a{font-size:14px}
[data-theme=light] body{background:var(--bg);color:var(--text)}
[data-theme=light] header,[data-theme=light] header.top{background:#f1f5faf5;border-color:var(--line);backdrop-filter:none}
[data-theme=light] .brand{color:#135284!important}
[data-theme=light] .hero-background{background:linear-gradient(90deg,#f1f5fa 3%,#f1f5fab8 55%,#f1f5fa30),linear-gradient(0deg,#f1f5fa,transparent 65%),url('hero-forest.webp') center 52%/cover}
[data-theme=light] .scenery,[data-theme=light] #excel-notes .scenery{background:var(--bg)}
[data-theme=light] .home .hero p,[data-theme=light] .home .about p,[data-theme=light] .home footer{color:var(--muted)}
[data-theme=light] .home .tool{background:#ffffffeb;border-color:var(--line)}
[data-theme=light] .home .icon{background:#e2effb;color:#1368ac}
[data-theme=light] .home .tool:hover{border-color:#1579c1}
[data-theme=light] .home .btn{background:#096db9;color:#fff;box-shadow:none}
[data-theme=light] .home .btn.secondary{background:#fff;color:#195580}
[data-theme=light] .home footer strong{color:var(--text)}
[data-theme=light] .languages button,[data-theme=light] .langs button{color:var(--muted)!important}
[data-theme=light] .languages button[aria-pressed=true],[data-theme=light] .langs button[aria-pressed=true]{color:#075fa5!important}
/* Learning pages keep their examples and code, with readable light surfaces. */
[data-theme=light] :is(.macro-card,.macro-panel,.visual-area,.lesson-guide,.lesson-choice,.lesson-panel,.note,.note-card,.panel,.practice,.lesson-body,.guide,.intro){color:var(--text)}
[data-theme=light] :is(.macro-card,.macro-panel,.visual-area,.lesson-guide,.lesson-choice,.lesson-panel,.note-card,.panel){background:#fff!important;border-color:var(--line)!important}
[data-theme=light] :is(.intro p,.lead,.crumb,.eyebrow,.panel-heading p,.lesson-guide p,.demo-disclaimer,.simulation-label,.visual-bottom,.lesson-topic,.lesson-num){color:var(--muted)!important}
[data-theme=light] .template-download{background:#fff;color:#135284;border-color:var(--line)}
[data-theme=light] #excel-notes{--muted:#4c627a;--stroke:#cad6e3}
@media(max-width:1150px){.home .wrap{width:calc(100% - 48px)}.home .nav{flex-wrap:wrap;padding:15px 0;gap:14px}.home nav{order:3;width:100%;justify-content:center}.home .right{margin-left:auto}.home .tools{grid-template-columns:repeat(3,minmax(0,1fr))}.home .hero-background{inset:145px 0 auto}header .header-inner,header .top-inner{flex-wrap:wrap;padding-top:14px;padding-bottom:14px;gap:14px}header .header-inner nav,header .top-inner nav{order:4;width:100%;margin:0;justify-content:center}.theme-switch{margin-left:auto}}
@media(max-width:650px){.nav-indicator{display:none}}
@media(max-width:650px){.home .wrap{width:calc(100% - 32px)}.home .brand{font-size:19px;letter-spacing:1px}.theme-label{display:none}.home nav,header nav{display:flex!important;flex-wrap:wrap;gap:8px!important}.home nav{justify-content:flex-start}.home nav a,header nav a{font-size:14px!important;padding:8px 12px;flex:1 0 auto}.home .hero{height:300px}.home .hero h1{font-size:40px;letter-spacing:-1.5px}.home .hero p{font-size:16px;max-width:300px}.home .actions{gap:9px}.home .btn{font-size:14px;padding:11px 16px}.home .tools{grid-template-columns:repeat(2,minmax(0,1fr))}.home .tool{padding:14px 12px;gap:10px;align-items:flex-start;flex-direction:column;min-height:125px}.home .tool h3{font-size:16px}.home .section-head{gap:12px}.home .section-head h2{font-size:24px}.home .about{grid-template-columns:1fr 72px}.home .about-details{grid-column:1/-1}.home footer .wrap{flex-wrap:wrap}.home footer .links{flex-wrap:wrap}.home .hero-background{height:460px}.languages,.langs{margin-left:0!important}header .header-inner,header .top-inner{padding-left:16px!important;padding-right:16px!important}header .header-inner nav,header .top-inner nav{display:flex!important}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
.home .hero-background{position:absolute;width:100%;pointer-events:none}.home .hero-background:after{display:none}
[data-theme=light] .home .section-head>a{color:#075fa5}
[data-theme=light] :is(.macro-card small,.macro-mark,.example-label,.guide-step,.guide-step strong,.guide-step small,.step-controls,.step-controls button,#step-caption,.macro-actions code,.macro-actions .button span:last-child,#copy-status,.requirements,.code-details,summary,footer,footer a:last-child){color:var(--muted)}
[data-theme=light] .button:not(.primary){color:#135284;border-color:var(--line);background:#fff}
[data-theme=light] .macro-card[aria-selected=true]{background:#dceeff!important;border-color:#2876b2!important}
[data-theme=light] .guide-step[aria-pressed=true] strong{color:#075fa5}
[data-theme=light] .simulation-label{color:#e4f5e9!important}
[data-theme=light] #excel-notes{--ink:#182b43;background:var(--bg);color:var(--ink)}
[data-theme=light] #excel-notes :is(.af-lesson,#excel-article,.article,.af-setup){background:#fff;border-color:var(--stroke)}
[data-theme=light] #excel-notes :is(.lesson-choice strong,.af-lesson-heading p,.af-guide-title,.af-guide-step,.af-guide-step strong,.af-guide-step small,.af-live-result,.af-live-result b,.af-caption-row,.af-benefit,.af-benefit>div,.af-setup summary,.af-summary-action,.af-setup-path,.af-setup-steps button,.af-setup-caption,.af-small-note,.af-sources,.summary,.quick-solution,.section-label span,.demo-caption,.file-note,details,summary,.refs,.footer,.footer b){color:#405c77}
[data-theme=light] #excel-notes .lesson-choice[aria-selected=true]{background:#dceeff!important;border-color:#2876b2!important}
[data-theme=light] #excel-notes :is(.caution,.af-benefit>strong){background:#e6f0fb;color:#1a4e77}
[data-theme=light] #excel-notes .step-button{color:#274c70;border-color:#9eb8cf}
[data-theme=light] #excel-notes .step-button[aria-pressed=true],[data-theme=light] #excel-notes .af-setup-steps button[aria-pressed=true]{color:#fff}
[data-theme=light] #excel-notes .top{background:#f1f5fa}
[data-theme=light] #excel-notes h1 em{color:#0867b7}
[data-theme=light] #excel-notes .af-kicker{color:#4c627a}

/* Shared raised surfaces; spreadsheet cells keep their native grid. */
body :is(button,.btn,.button,.download,.af-download):not(.af-company-button,.theme-switch,[data-segment]),
body :is(.tool,.motion-card,.macro-card,.lesson-choice,.article,.af-lesson) {
  box-shadow: var(--nav-shadow), 0 5px 12px rgb(8 25 43 / 10%) !important;
}
body :is(.sheet-table,.af-table,.sheet-wrap table,.formula-strip,.formula-bar,.af-formula,.excel-ribbon) {
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
}
.excel-ribbon {
  display:flex; gap:16px; align-items:center; padding:6px 12px;
  background:#f4f5f4; color:#303731; border-bottom:1px solid #cbd2ce;
  font-size:12px; overflow:hidden;
}
.excel-ribbon b {border-bottom:2px solid #217346}
body .sheet-table td:not(.rn):not([class~="chosen"]) {border-color:#d3dad5}

:is(.brand,.lab-brand,.site-shellnav-brand):has(> .brand-logo){display:inline-flex;align-items:center;gap:9px}
.brand-logo{display:block;width:30px;height:30px;flex:none}
.brand,.lab-brand,.site-shellnav-brand{font-weight:750}
header,#excel-notes .top,.lab-header{position:sticky!important;top:0;z-index:1000}

/* Keep the global header geometry identical to the home page. */
@media (min-width:1151px){
  header,#excel-notes .top{height:88px!important;min-height:88px!important}
  header > .nav,
  header .header-inner,
  header .lab-header,
  #excel-notes .top-inner{
    width:min(1320px,calc(100% - 88px))!important;
    max-width:none!important;
    height:88px!important;
    min-height:88px!important;
    margin-inline:auto!important;
    padding:0!important;
  }
  :is(.brand,.lab-brand){font-size:23px!important;letter-spacing:3px!important}
}

/* One desktop header template: identical typography and element coordinates on every page. */
@media (min-width:1151px){
  header,
  header :is(.brand,.lab-brand,nav,.languages,.langs,.theme-switch),
  #excel-notes .top,
  #excel-notes .top :is(.brand,nav,.langs,.theme-switch){
    font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue","Segoe UI",Arial,sans-serif!important;
  }
  header > .nav,
  header .header-inner,
  header .lab-header,
  #excel-notes .top-inner{
    position:relative!important;
    display:block!important;
  }
  header :is(.brand,.lab-brand),
  #excel-notes .top .brand{
    position:absolute!important;
    left:0!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    width:208px!important;
    height:38px!important;
    font-size:23px!important;
    line-height:38px!important;
    letter-spacing:3px!important;
  }
  header nav,
  #excel-notes .top nav{
    position:absolute!important;
    left:50%!important;
    top:22px!important;
    transform:translateX(-50%)!important;
    width:622px!important;
    height:44px!important;
    margin:0!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    gap:9px!important;
  }
  header nav a,
  #excel-notes .top nav a{
    font-family:inherit!important;
    font-size:14px!important;
    line-height:1.5!important;
  }
  header :is(.languages,.langs),
  #excel-notes .top .langs{
    position:absolute!important;
    left:auto!important;
    right:139px!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    width:62px!important;
    height:28px!important;
    margin:0!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    gap:7px!important;
    font-size:13px!important;
  }
  header .theme-switch,
  #excel-notes .top .theme-switch{
    position:absolute!important;
    left:auto!important;
    right:15px!important;
    top:22px!important;
    width:111px!important;
    height:44px!important;
    margin:0!important;
    font-family:inherit!important;
    font-size:14px!important;
  }
}

/* Prevent page-to-page header drift from scrollbar and inherited tracking. */
html{scrollbar-gutter:stable}
header nav,header nav a,#excel-notes .top nav,#excel-notes .top nav a{letter-spacing:normal!important}

/* Fixed language and theme controls across every page and state. */
header :is(.languages,.langs),
#excel-notes .top .langs{
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:24px 4px 24px!important;
  align-items:center!important;
  justify-content:center!important;
  column-gap:5px!important;
  width:62px!important;
  height:28px!important;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue","Segoe UI",Arial,sans-serif!important;
  font-size:13px!important;
  font-weight:400!important;
  line-height:20px!important;
}
header :is(.languages,.langs) button,
#excel-notes .top .langs button{
  box-sizing:border-box!important;
  width:24px!important;
  height:28px!important;
  min-width:24px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  background:transparent!important;
  font:400 13px/20px -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue","Segoe UI",Arial,sans-serif!important;
  letter-spacing:0!important;
  text-align:center!important;
}
header :is(.languages,.langs) > span,
#excel-notes .top .langs > span{
  box-sizing:border-box!important;
  width:4px!important;
  height:20px!important;
  margin:0!important;
  padding:0!important;
  font:400 13px/20px -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue","Segoe UI",Arial,sans-serif!important;
  text-align:center!important;
}
header :is(.languages,.langs) button[aria-pressed=true],
#excel-notes .top .langs button[aria-pressed=true]{
  font-weight:400!important;
  text-decoration:underline!important;
  text-underline-offset:6px!important;
  text-decoration-thickness:1px!important;
}
header .theme-switch,
#excel-notes .top .theme-switch{
  box-sizing:border-box!important;
  width:127px!important;
  min-width:127px!important;
  height:44px!important;
  padding:5px 0 5px 5px!important;
  gap:8px!important;
  font:500 14px/16.8px -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue","Segoe UI",Arial,sans-serif!important;
}
header .theme-label,
#excel-notes .top .theme-label{
  display:block!important;
  flex:0 0 50px!important;
  width:50px!important;
  font:500 14px/16.8px -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue","Segoe UI",Arial,sans-serif!important;
  text-align:left!important;
  white-space:nowrap!important;
}
header .theme-track,
#excel-notes .top .theme-track{
  flex:0 0 64px!important;
  width:64px!important;
  height:32px!important;
}
@media (min-width:1151px){
  header :is(.languages,.langs),
  #excel-notes .top .langs{right:155px!important}
  header .theme-switch,
  #excel-notes .top .theme-switch{right:15px!important;width:127px!important}
}

/* Compact mobile header: keeps the hero image visible without removing navigation. */
.mobile-menu-toggle{display:none}
@media(max-width:650px){
  .home header{min-height:72px;height:72px;position:relative;z-index:20}
  .home .nav{position:relative;min-height:72px;height:72px;padding:0!important;display:flex;flex-wrap:nowrap!important;align-items:center;gap:8px!important}
  .home .brand{font-size:16px!important;letter-spacing:.7px!important;gap:8px}
  .home .brand-logo{width:27px;height:27px}
  .home .right{margin-left:auto!important;display:flex;align-items:center;gap:5px!important}
  .home .languages{display:flex;align-items:center;gap:2px!important;white-space:nowrap}
  .home .languages button{min-width:28px;padding:5px 3px!important;font-size:12px!important}
  .home .languages span{font-size:12px}
  .home .theme-label{display:none!important}
  .home .theme-switch{min-width:42px;min-height:40px;padding:4px 0!important;gap:0}
  .home .theme-track{width:42px;height:24px}
  .home .theme-track svg{display:none}
  .home .theme-knob{left:3px;top:3px;width:18px;height:18px}
  .home [aria-checked=true] .theme-knob{transform:translateX(18px)}
  .mobile-menu-toggle{width:40px;height:40px;padding:10px;display:grid;align-content:center;gap:4px;border:0;border-radius:8px;background:var(--surface);color:var(--nav-ink);box-shadow:none}
  .mobile-menu-toggle span{display:block;width:20px;height:2px;border-radius:2px;background:currentColor;transition:transform .2s ease,opacity .2s ease}
  .menu-open .mobile-menu-toggle span:nth-child(1){transform:translateY(6px) rotate(45deg)}
  .menu-open .mobile-menu-toggle span:nth-child(2){opacity:0}
  .menu-open .mobile-menu-toggle span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}
  .home header nav{display:none!important;position:absolute;left:0;right:0;top:72px;width:100%;margin:0!important;padding:12px 0 16px;grid-template-columns:1fr 1fr;gap:8px!important;background:var(--bg);border-bottom:1px solid var(--line);z-index:30}
  .home .nav.menu-open nav{display:grid!important}
  .home header nav a{min-height:44px;padding:9px 10px!important;display:flex!important;flex:initial!important;font-size:13px!important}
  .home header nav a:last-of-type{grid-column:auto}
  .home .hero-background{pointer-events:none}
}
@media(max-width:370px){
  .home .brand{font-size:0!important}
  .home .brand-logo{width:30px;height:30px}
}
