/* TurkeyBoards Tools — base styles and shared components (tb-*), site header. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/24px var(--font-ui); }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Shared components (from the design system) ---------- */
.tb-btn { font: 700 13px/20px var(--font-ui); display: inline-flex; align-items: center; gap: var(--space-2); height: 38px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s ease, box-shadow .08s ease, background-color .12s ease; }
.tb-btn:hover { background: var(--surface-sunken); }
.tb-btn svg { width: 16px; height: 16px; flex: none; }
.tb-btn-primary { background: var(--brand-feather); color: var(--on-feather); border: 2px solid var(--sticker-edge); box-shadow: var(--shadow-sticker); }
.tb-btn-primary:hover { background: var(--brand-feather-deep); }
.tb-btn-primary:active { transform: translate(3px, 3px); box-shadow: var(--shadow-sticker-press); }
.tb-btn-ghost { border-color: transparent; background: transparent; }
.tb-btn-sm { height: 30px; padding: 0 var(--space-3); font-size: 13px; }
.tb-btn-danger { color: var(--danger); }
.tb-btn[disabled] { opacity: .45; cursor: not-allowed; }
.tb-iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; }
.tb-iconbtn svg { width: 18px; height: 18px; }
.tb-iconbtn:hover { background: var(--surface-sunken); }
.tb-iconbtn[aria-pressed="true"] { background: var(--brand-feather); color: var(--on-feather); border-color: var(--sticker-edge); }
.tb-iconbtn[disabled] { opacity: .4; cursor: not-allowed; }
.tb-pill { display: inline-flex; align-items: center; gap: 6px; width: fit-content; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); border: 1px solid currentColor; font: 700 11px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; background: transparent; }
.tb-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tb-pill-ready { color: var(--success); }
.tb-pill-soon::before { background: transparent; border: 1.5px solid currentColor; }
.tb-pill-warn { color: var(--warning); }
.tb-pill-new { color: var(--on-beak); background: var(--brand-beak); border-color: var(--brand-beak); }
.tb-pill-new::before { display: none; }
button.tb-pill { cursor: pointer; }
.tb-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--surface-sunken); border: 1px solid var(--line); }
.tb-seg button { font: 700 12px/1 var(--font-ui); height: 26px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); cursor: pointer; }
/* On, open or chosen: every switch, toggle, open menu and chosen segment is feather blue, in every tool */
.tb-seg button[aria-pressed="true"] { background: var(--brand-feather); color: var(--on-feather); box-shadow: 0 0 0 1.5px var(--sticker-edge); }
.tb-seg button[aria-pressed="true"] small { color: var(--on-feather); opacity: .8; }
.tb-btn[aria-pressed="true"], .tb-btn[aria-expanded="true"], .tb-iconbtn[aria-expanded="true"] { background: var(--brand-feather); color: var(--on-feather); border-color: var(--sticker-edge); }
.tb-btn[aria-pressed="true"]:hover, .tb-btn[aria-expanded="true"]:hover { background: var(--brand-feather-deep); }
.tb-label { font: 700 11px/16px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.tb-input { font: 400 13px/20px var(--font-mono); height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-sunken); color: var(--ink); width: 100%; min-width: 0; }
.tb-input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.tb-input::placeholder { color: var(--ink-muted); opacity: .8; }
select.tb-input { padding-right: 4px; }

/* ---------- Site header ---------- */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.site-header-in { display: flex; align-items: center; gap: var(--space-4); min-height: 60px; padding-block: 8px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); max-width: 1240px; margin: 0 auto; }
.editor-mode .site-header-in { max-width: none; min-height: 52px; padding-block: 4px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { width: 40px; height: 43px; object-fit: contain; }
.wordmark { font: 700 18px/1 var(--font-display); letter-spacing: -0.04em; }
.wordmark span { color: var(--ink-muted); font-weight: 700; }
.crumb { display: flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--ink-muted); font-size: 14px; }
.crumb strong { color: var(--ink); font-weight: 700; white-space: nowrap; }
.crumb input { font: 400 14px/20px var(--font-ui); border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: var(--radius-sm); padding: 4px 6px; min-width: 0; width: 220px; }
.crumb input:hover { border-color: var(--line); }
.crumb input:focus { outline: 2px solid var(--focus); outline-offset: 0; background: var(--surface-sunken); }
.site-nav { display: flex; align-items: center; gap: var(--space-5); margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; }
.site-nav a:hover { color: var(--link); }
.site-nav a.ext::after { content: " ↗"; color: var(--ink-muted); }
.header-tools { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.site-nav + .header-tools, .site-nav + .nav-toggle + .header-tools { margin-left: 0; }
.site-nav a[aria-current="page"] { color: var(--link); box-shadow: inset 0 -2px 0 currentColor; padding-block: 4px; }
.editor-mode .site-nav { gap: var(--space-4); }
.editor-mode .site-nav a { font-size: 13px; white-space: nowrap; }
/* in a tool, the crumb's tool menu switches tools: the bar keeps only Shop (the links stay in the page for the scripts that read their hrefs) */
.editor-mode .site-nav a:not(.ext) { display: none; }
.nav-toggle { display: none; }
/* home page: the tool links sit in the middle of the bar; Shop moves beside the theme switch (and into the menu on narrow screens) */
.header-shop { display: none; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; margin-left: var(--space-2); }
.header-shop:hover { color: var(--link); }
.header-shop.ext::after { content: " ↗"; color: var(--ink-muted); }
@media (min-width: 861px) {
  .site-header-in.is-centered { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); }
  .is-centered .brand { justify-self: start; }
  .is-centered .site-nav { margin: 0; justify-self: center; }
  .is-centered .site-nav .only-menu { display: none; }
  .is-centered .header-tools { justify-self: end; margin-left: 0; }
  .is-centered .header-shop { display: inline; }
}
/* folded nav: a Menu button with a drop-down */
.site-nav.is-open { display: flex; position: absolute; top: calc(100% + 4px); right: var(--gutter-r); z-index: 60; flex-direction: column; align-items: stretch; gap: 2px; min-width: 220px; padding: 6px; margin: 0; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
.site-nav.is-open a { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; box-shadow: none; }
.site-nav.is-open a:hover, .site-nav.is-open a:focus-visible { background: var(--surface-sunken); outline: none; }
.site-nav.is-open a[aria-current="page"] { background: var(--surface-sunken); }
@media (max-width: 860px) { .site-nav:not(.is-open) { display: none; } .nav-toggle { display: inline-flex; margin-left: auto; } .crumb input { width: 140px; } }
/* the tools' headers also carry a name field, so they fold sooner */

@media (max-width: 520px) {
  .nav-toggle span { display: none; }
  .site-nav #theme-seg { display: none; }
  .site-nav.is-open #theme-seg { display: flex; margin: 6px 4px 2px; }
  .site-nav.is-open #theme-seg button { flex: 1; }
}
@media (max-width: 520px) { .wordmark span, .crumb strong, .crumb .slash { display: none; } .crumb input { width: 112px; } }


kbd { font: 400 11px/1 var(--font-mono); padding: 3px 6px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); border-bottom-width: 2px; color: var(--ink); background: var(--surface-sunken); white-space: nowrap; }

/* tool switcher and keyboard menu buttons in the tools' header */
.crumb-btn { display: inline-flex; align-items: center; gap: 4px; font: 700 14px/20px var(--font-ui); color: var(--ink); background: none; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 4px 6px; cursor: pointer; white-space: nowrap; }
.crumb-btn:hover { border-color: var(--line); background: var(--surface-sunken); }
.crumb-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crumb-btn[aria-expanded="true"] { border-color: var(--line); background: var(--surface-sunken); }
.crumb-btn .chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; color: var(--ink-muted); }
.crumb-kb { padding: 4px; margin-left: -6px; }
@media (max-width: 520px) { .crumb-btn span { display: none; } .crumb-btn { padding: 4px; } }
/* the name field grows with the name, so the keyboard menu button sits right after it */
@supports (field-sizing: content) { .crumb input { width: auto; field-sizing: content; min-width: 9ch; max-width: 260px; } }
/* phones: the name gives way (ending in …) so the keyboard menu's arrow stays clear of the Menu button; the narrowest
   drop the wordmark beside the logo too */
@media (max-width: 520px) { .crumb { flex: 0 1 auto; } .crumb input { min-width: 5ch; flex: 0 1 auto; } }
@media (max-width: 700px) { .editor-mode .wordmark { display: none; } }
/* tools: the theme switch lives in the Menu once the bar folds */
@media (max-width: 860px) {
  .editor-mode .site-nav #theme-seg { display: none; }
  .editor-mode .site-nav.is-open #theme-seg { display: flex; margin: 6px 4px 2px; }
  .editor-mode .site-nav.is-open #theme-seg button { flex: 1; }
  .editor-mode .crumb { flex: 0 1 auto; min-width: 0; }
  .editor-mode .crumb input { min-width: 5ch; flex: 0 1 auto; }
}
